折腾我好久!翻阅千山万水也没有命中问题!今天我要公布于世!如何解决!
起因:服务器那边重启了我运行良好的主机导致上述问题!
感谢各位CSDN默默贡献的大神,是你们促进互联网的发展!虽然没有帮到我在这个问题上!
【特别鸣谢】感谢ReadyGPT(呱呱AI智能助手)https://readygpt.cn/chat/ 只要你会问他会一步一步给你解释,甚至看不懂的代码直接发给他,遇到的错误代码提示直接扔给他
正确检测步骤
1.检查Oracle环境变量
Oracle数据库环境变量配置+修改数据库密码_Leoysq的博客-CSDN博客
1.2.1 设置Adimistrator变量
变量名: ORACLE_HOME
变量值:C:\app\Administrator\product\11.2.0\dbhome_1
1.2.2 新建一个变量home,再在path中添加:%ORACLE_HOME%\BIN
注明:path中有很多变量了,如果添加新的需要在每个变量后面用;号隔开!
1.2.3 系统变量
变量名: ORACLE_HOME
变量值:C:\app\Administrator\product\11.2.0\dbhome_1\BIN
注意:如果重启电脑后监听失败,请将该变量值改为C:\app\Administrator\product\11.2.0\dbhome_1(结合自己路径)
2.检查配置文件(一般每人动这个)路径看自己
tnsnames.ora (C:\Program Files (x86)\Oracle\Instant Client\network\admin)
注意:你需要单独安装 Instant Client Setup .exe,最后会讲解
# tnsnames.ora Network Configuration File.
# Generated by Oracle InstantClient tools.
# For more information, please visit: http://www.oracle.com/technetwork/database/features/instant-client/index-100365.html
# Sample:
#DatabaseName =
# (DESCRIPTION =
# (ADDRESS_LIST =
# (ADDRESS = (PROTOCOL = TCP)(HOST = 127.0.0.1)(PORT = 1521))
# )
# (CONNECT_DATA =
# (SERVER = DEDICATED)
# (SERVICE_NAME = orcl)
# (INSTANCE_NAME = orcl)
# )
# )
# Modify the following content to fit your own needs.
DummyDatabase =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 127.0.0.1)(PORT = 1521))
)
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = DummyService)
)
)
tnsnames.ora(C:\app\Administrator\product\11.2.0\dbhome_1\NETWORK\ADMIN)
listener.ora(C:\app\Administrator\product\11.2.0\dbhome_1\NETWORK\ADMIN)
# listener.ora Network Configuration File: C:\app\Administrator\product\11.2.0\dbhome_1\NETWORK\ADMIN\listener.ora
# Generated by Oracle configuration tools.
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = CLRExtProc)
(ORACLE_HOME = C:\app\Administrator\product\11.2.0\dbhome_1)
(PROGRAM = extproc)
(ENVS = "EXTPROC_DLLS=ONLY:C:\app\Administrator\product\11.2.0\dbhome_1\bin\oraclr11.dll")
)
)
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
)
)
ADR_BASE_LISTENER = C:\app\Administrator
3.尝试热心网友们说的使用PLSQL强制链接Instant(没有解决目标主机问题但是接近了)
4.【大结局】 单独安装 Instant Client Setup .exe
解决办法是 重装了远程链接的
下载链接:https://pan.baidu.com/s/1ri4rBNz1On-0HBfOCJFnog?pwd=leoy
提取码:leoy 【永久】
1.安装到默认路径后设置环境变量
2修改安装目录admin里面的tnsnames. ora
就链接成功了
3.中间有很多GPT告诉我的CMD命令检测方法
1.检测数据库监听是否开启
lsnrctl 转 status
2.sqlplus 检测数据库是否启动
sqlplus 数据库用户名/密码@//localhost:1521/orcl
orcl 是你在配置文件中的数据库名 这些你都可以问GPT
转查询表格:
SELECT table_ name FROM user_ tables ;
exit 是退出
你可以去查询更多命令