|
|
|
|
|
Re: A question about CREATE PUBLIC DATABASE LINK and ORA-12154 error [message #434990 is a reply to message #434418] |
Sun, 13 December 2009 03:35 |
|
dariyoosh
Messages: 538 Registered: March 2009 Location: France
|
Senior Member |
|
|
mrbaddy@rediffmail.com wrote on Wed, 09 December 2009 10:48Hi Dariyoosh,
Can you post the modified TNSNAMES.ORA so that I can notice the change you made?
I am also facing a similar kind of issue.
Regards,
Badarinath
Hello there,
Sorry for the delay to answer your question, I just saw your post this morning. As dear Michel explained, all that has to be done is that you refer to the correct tnsnames.ora on the right server. In order to better clarify this I'm going to describe my situation. I have the oracle 10g client on my system which of course has a TNSNAMES.ORA file allowing me to connect to an oracle server which I name it here srvA.
What I wanted to do was to be able to access the data on the srvB while connecting to the srvA without needing to change the user connection. Therefore, I had to create a database link from srvA to srvB. But the mistake that I made was that I forgot the fact that the TNSNAMES.ORA of srvA didn't include the proper entry. This is important because when you create a database link from srvA to srvB, it is in fact srvA that becomes client (in this context) of the srvB so if there is a TNSNAMES.ORA file that has to be checked (or modified if needed) it is the one of the srvA and surely not the one installed on your PC used for connecting to srvA.
However, if for some reason it is not possible to change the TNSNAMES.ORA of the srvA (for example if the administrator is not currently available), you can create the database link directly with its whole content instead of using the tns entry in the tnsnames.ora file. So in my situation the link is created in the following way:
CREATE PUBLIC DATABASE LINK SR001_dblink CONNECT TO user IDENTIFIED BY password USING
'(DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (COMMUNITY=tcp.world)
(PROTOCOL=TCP)(HOST=here I write the IP address of srvB)(PORT=1521)
)
)
(CONNECT_DATA = (SID = DGPAPROD))
)';
And this works pretty well. However I noticed that if you create the database link in this way, you have to specify the IP address of the destination server and not its hostname (even if you access the server by using its hostname) and I have no explanation for that!
However using directly the IP address of the server has a drawback: if one day for some reason the IP address of the server is changed your database link will not work until it has updated with the new IP address.
I hope this can help.
Kind Regards,
Dariyoosh
|
|
|
|