TNS-03505 name cannot be resolved
TNS-03505 name cannot be resolved
Symptom:
[Oracle @ db01 admin] $ tnsping pri
TNS Ping Utility for Linux: Version 11.2.0.4.0-Production on 15-JUN-2015 21:57:52
Copyright (c) 1997,201 3, Oracle. All rights reserved.
Used parameter files:
TNS-03505: failure to resolve name
[Oracle @ db01 admin] $ sqlplus system/oracle @ pri
SQL * Plus: Release 11.2.0.4.0 Production on Mon Jun 15 21:58:48 2015
Copyright (c) 1982,201 3, Oracle. All rights reserved.
ERROR:
ORA-12154: TNS: cocould not resolve the connect identifier specified
Enter user-name: ^ C
Problem Analysis:
There are usually two reasons for this problem: 1. the name does not exist. 2. The tns configuration file does not exist.
Troubleshooting:
1. Check all configuration information of tnsnames. ora.
[Oracle @ db01 admin] $ cat tnsname. ora
Pri =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP) (HOST = 192.168.1.50) (PORT = 1521 ))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = woo)
)
)
2. Check the users and user groups of tnsnames. ora files and files
[Oracle @ db01 admin] $ ll tnsnames. ora
-Rwxr -- r -- 1 oracle oinstall 350 Jun 16 tnsname. ora
# From this point of view, there is no problem. The file belongs to the oinstall user group, and all its permissions are also Oracle
3. At this time, we chose to skip tnsnames. ora and manually log in to verify that the database is normal.
[Oracle @ db01 admin] $ sqlplus system/oracle@192.168.1.50/woo
SQL * Plus: Release 11.2.0.4.0 Production on Tue Jun 16 22:34:40 2015
Copyright (c) 1982,201 3, Oracle. All rights reserved.
Connected:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0-Production
With the Partitioning, Oracle Label Security, OLAP, Data Mining,
Oracle Database Vault and Real Application Testing options
SQL> select name from v $ database;
NAME
---------
WOO
SQL> select instance_name, status from v $ instance;
INSTANCE_NAME STATUS
----------------------------
Woo OPEN
SQL>
# From this we can see that the database is certainly no problem, so next we will replace the listening file with a good listening file to solve this problem.
4. upload an available Listener Configuration File for comparison.
[Oracle @ db01 admin] $ ls
Listener. ora samples shrept. lst sqlnet. ora tnsname. ora tnsnames. ora
[Oracle @ db01 admin] $ chmod u + x tnsnames. ora
[Oracle @ db01 admin] $ ll
Total 24
-Rwxr-xr-x 1 oracle oinstall 711 Jun 16 listener. ora
Drwxr-xr-x 2 oracle oinstall 4096 Jun 11 samples
-Rw-r -- 1 oracle oinstall 381 Dec 17 2012 shrept. lst
-Rw-r -- 1 oracle oinstall 221 Jun 16 sqlnet. ora
-Rwxr -- r -- 1 oracle oinstall 350 Jun 16 tnsname. ora
-Rwxr -- r -- 1 oracle oinstall 350 Jun 16 tnsnames. ora ---- This is uploaded later
# Through comparison, I found that the name of the previously manually created file is incorrect, even if the content is correct, it will not help.
5. Solve the problem by modifying and replacing the listening file:
[Oracle @ db01 admin] $ cat tnsname. ora> tnsnames. ora
[Oracle @ db01 admin] $ rm-rf tnsname. ora
[Oracle @ db01 admin] $ sqlplus system/oracle @ pri
SQL * Plus: Release 11.2.0.4.0 Production on Tue Jun 16 23:02:15 2015
Copyright (c) 1982,201 3, Oracle. All rights reserved.
Connected:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0-Production
With the Partitioning, Oracle Label Security, OLAP, Data Mining,
Oracle Database Vault and Real Application Testing options
SQL> select name from v $ database;
NAME
---------
WOO
SQL> select instance_name, status from v $ instance;
INSTANCE_NAME STATUS
----------------------------
Woo OPEN
SQL>
SQL> host ls-rtl
Total 20
-Rw-r -- 1 oracle oinstall 381 Dec 17 2012 shrept. lst
Drwxr-xr-x 2 oracle oinstall 4096 Jun 11 samples
-Rw-r -- 1 oracle oinstall 221 Jun 16 sqlnet. ora
-Rwxr-xr-x 1 oracle oinstall 711 Jun 16 listener. ora
-Rwxr -- r -- 1 oracle oinstall 350 Jun 16 tnsnames. ora
SQL>