Code Project

Link Unit

Friday, January 11, 2008

Error : ORA-12154

Please note that before trying to solve this error user must be aware that

For a database name to be recognized, it must be resolved by Oracle Client. To resolve a name, Oracle client uses either a TNSNames.ora, A Directory Server or an Oracle Names Server. So this name has to be entered into the TNSNAMES.ORA at a minimum to make this work.

Normally ORA-12154 tnsnames issues arise out of multiple homes, incorrect entries made somewhere in the file tnsnames.ora . So make sure all the entries are correct.

I was also facing the same problem when i create the DB Link as

CREATE PUBLIC DATABASE LINK TestService USING 'TestService';


TNS COULD NOT RESOLVE SERVICE NAME.

This is basically the problem with the TNSNAME.ora file, the 'Using' clause not able to find the service name in the TNSNAMES.ora

This is how i solved: I just copy paste the TestService`s Description part as

CODE

alter system set global_names=false
/
CREATE PUBLIC DATABASE LINK TestService
using
'(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = TestHost)(PORT = 1521))
)
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = TestService)
)
)
'
/
here my destination server host is TestHost & service name is TestService .

NOTE: If I had set the "GLOBAL_NAME" parameter to "TRUE", then the DBLink name need to be same as that of DBName .
Post a Comment