Oracle很多BUG类问题需要找到函数调用,分析函数意义,方便定位问题,最近oracle官方的查询网址不知道为什么不能用了,墨天轮也有此功能但一次只能查询一个函数Oracle C函数查询 - 墨天轮数据库在线运维平台 (modb.pro),较为不方便,写了个小爬虫实现批量查询
已经打包成.exe可以下载直接用
「oracle_c函数批量查询器.exe」,点击链接保存,或者复制本段内容,打开「阿里云盘」APP ,无需下载极速在线查看,视频原画倍速播放。 链接:https://www.aliyundrive.com/s/QFa8NQmoHjN
代码如下
#-*- codeing = utf-8 -*-
#@Time : 2021/12/1 11:41
#@Author: jiacheng
#@File : ora 函数.py
#@Software : PyCharm
import re
import urllib.request
def askURL(baseurl):
head = {
"User-Agent": "Mozilla / 5.0(Windows NT 10.0; Win64; x64) AppleWebKit / 537.36(KHTML, like Gecko) Chrome / 80.0.4389.128 Safari / 537.36"
}
request = urllib.request.Request(baseurl,headers=head)
html = ""
try:
response = urllib.request.urlopen(request)
html = response.read().decode("gbk")
except urllib.error.URLError as e:
if hasattr(e,"code"):
print(e.code)
if hasattr(e,"reason"):
print(e.reason)
return html
while True:
input_line = input('输入c函数内容:')
result_list = re.findall('[a-zA-Z_]+',input_line)
#print(result_list)
print('·'*100)
lst = []
lst2 = []
for i in result_list:
#print(i)
baseurl = 'https://www.modb.pro/api/sql/oraFun?search=%s'%i
html = askURL(baseurl)
if len(html) < 3:
lst2.append(i)
else:
lst.append(html)
for c in lst:
d = c.replace('"','')
e = d.replace('[{name:','')
f = e.replace('}]','')
g = f.replace(',description','')
print(g)
num = len(lst2)
print("有%d个c函数没查询到!"%num)
print("未查询到的c函数如下.")
for c1 in lst2:
print(c1)