连接数据库偶尔报TNS-03505/ora-12154/ora-12162的问题

今天发现一个奇怪的问题

$ ./tnsping cdb1

TNS Ping Utility for Linux: Version 20.0.0.0.0 - Development on 05-MAY-2019 01:53:57

Copyright © 1997, 2019, Oracle. All rights reserved.

Used parameter files:

TNS-03505: Failed to resolve name

怀疑可能是因为tnsnames.ora里面的串是大写,后来发现不是

这个问题是偶然的,不是每次都能碰到

CDB1 =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = scan_name)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = cdb1)
)
)

./sqlplus “sys/password@cdb1pdb10019 as sysdba”

ERROR:
ORA-12154: TNS:could not resolve the connect identifier specified

$ ./oerr ora 12162
12162, 00000, “TNS:net service name is incorrectly specified”
// *Cause: The connect descriptor corresponding to the net service name in
// TNSNAMES.ORA or in the directory server (Oracle Internet Directory) is
// incorrectly specified.
// *Action: If using local naming make sure there are no syntax errors in
// the corresponding connect descriptor in the TNSNAMES.ORA file. If using
// directory naming check the information provided through the administration
// used for directory naming. If using ORACLE_SID, please check if ORACLE_SID is// set.

最后基本确认应该是环境变量TNS_ADMIN这个变量要设置

TNS_ADMIN=/scratch/u01/app/crsusr/product/12.1.0/dbhome_1/network/admin

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值