-
db link init
Hi Guys,
I am querying remote database via db link. In between the queries the remote db goes down and up. Next time I do my query established db link fails. Though when I repeat the query second time and it works. Obviously db link was rectified (re- init) after first failure. The Question is :
Is there a clean way to identify if the dblink is broken and re-init it before issuing a query.
Thanks in advance
-
The link is nothing more than a definition (where to go find table or view at some remote location). The target database is either able to accept connections or it is not. There is nothing rectified or "re-init" for a link. From a SQL perspective, there is no way the source server knows the remote server is up unless a connection attempt is made via a statement. You could also be constrained by the allowable number of open links. And what does "established db link fails" mean in terms of an error or result?
-
Ok. Here is a scenario :
1. sqlplus hr/hr@T101
2. create dblink - JOPRIM_DBLINK to access JOPRIM db.
3 select sysdate from dual@JOPRIM_DBLINK
4. Result 9/12/2010 4:15:53 PM - all fine !
5. .oraenv JOPRIM. slqplus '/as sysdba'. startup force. - it will bounce JOPRIM database.
6. select sysdate from dual@JOPRIM_DBLINK (I am still in the same session from step1)
7. ORA-02068: following severe error from JOPRIM_DBLINK
ORA-03113: end-of-file on communication channel
8. select sysdate from dual@JOPRIM_DBLINK (do it again)
9 . 9/12/2010 4:47:01 PM all Ok!!!
Note it happens because I am in the same session if I logout and login this won't happen.
-
This is expected as connection was lost when you bounced the database. It is not a good practice to persist a database connection for a long time. You can try to catch the exception if it is queried in a stored procedure.
-
How you expect the connection to be alive after killing the database?
Nevertheless, question is... why in the world you would do a startup force in the middle of a session?
Last edited by PAVB; 12-09-2010 at 01:44 PM.
Pablo (Paul) Berzukov
Author of Understanding Database Administration available at amazon and other bookstores.
Disclaimer: Advice is provided to the best of my knowledge but no implicit or explicit warranties are provided. Since the advisor explicitly encourages testing any and all suggestions on a test non-production environment advisor should not held liable or responsible for any actions taken based on the given advice.
-
I test a scenario when remote database I am quering on regular basis went down. But anyway I got a work around. Thanks for your input.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|