今天发现一个奇怪的问题
$ ./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