This error, seen as ORA-12154, means SQL*Net could not find the database alias specified for a database connection in the TNSNAMES.ORA file or other naming adapter. The database alias is specified after the “@” character in a database connection string. For example, if the connect string “SYSTEM/MANAGER@PROD” is used, “PROD” is the database alias. The following is a list of steps to follow when troubleshooting an ORA-12154 error.
Find the Oracle SQL*Net configuration files – there are two main files Oracle uses on the client when connecting to a database, TNSNAMES.ORA and SQLNET.ORA. Oracle will typically scan for these files using the following sequence:
Current Directory – the directory the application was started from. SQL*Plus typically resides in ORACLE_HOME\bin, but if the current directory was C:\TEMP when it started, Oracle will look here first.
TNS_ADMIN – the directory specified by the TNS_ADMIN environment variable or registry entry
/var/opt/oracle (UNIX only)
ORACLE_HOMEetwork\admin
Sometimes you can also use the TNSPING utility to determine where the files are located. As part of the output, this utility typically displays the parameters files used.
Determine the converted database alias name that Oracle will use – inside the SQLNET.ORA file determine if a parameter NAMES.DEFAULT_DOMAIN is specified. For example, you may see a line that reads:
NAMES.DEFAULT_DOMAIN = mycompany.com
In that case, Oracle will append this name to the database alias name to connect to the database. For example, if you use a database alias of PROD, the converted name Oracle will use is "PROD.MYCOMPANY.COM" (case insensitive). If this parameter is not found the converted alias would be "PROD" 3 Find the converted alias name in the TNSNAMES.ORA file – inside the TNSNAMES.ORA file, search for the converted alias name to find an exact match. A typical entry would look similar to the following (ignoring white spaces):
If an exact match is not found, you will receive a TNS-12154 error. If you find an entry that looks similar, i.e. the alias in the TNSNAMES.ORA read “PROD” without the domain name appended to it, then either; 1) add the domain to the end of TNSNAMES.ORA alias name; or 2) remove the NAMES.DEFAULT_DOMAIN parameter from the SQLNET.ORA file. If no similar matches are found, an entry similar to the one shown above will need to be added to the TNSNAMES.ORA file.
Modify the AUTOMATIC_IPC parameter in SQLNET.ORA – if this parameter is currently set to ON, change it to OFF. If it is currently OFF, change it to ON. Try the connection again.
Verify the TNSNAMES.ORA and SQLNET.ORA files are accessible – If the files exist and appear to be configured properly, verify the permissions are set properly. Try changing the permissions to full open, e.g. if this is UNIX then change the permissions to “rwxrwxrwx” (chmod 777 tnsnames.ora).
Manually configure the environment – if all else fails, set the TNS_ADMIN environment variable to “C:\TEMP” and create a new TNSNAMES.ORA file in that directory. Add the proper entry to the TNSNAMES.ORA file and the connection should work.
이 내용에 흥미가 있습니까?
현재 기사가 여러분의 문제를 해결하지 못하는 경우 AI 엔진은 머신러닝 분석(스마트 모델이 방금 만들어져 부정확한 경우가 있을 수 있음)을 통해 가장 유사한 기사를 추천합니다: