Broken DBLinks in Oracle after network outage or remote DB shutdown

We have two enterprise apps each with their own Oracle 11g database.  App2 has a dblink to App1.  When App1 is taken offline for scheduled maintenance, and then restored - our dblink is broken.  Users run a report and will receive ORA-03114.  The error only occurs once because when the user runs the report again there are no issues.

We are positive the issue is caused when App1 goes offline during a reboot or network outage.

Is there a way to restore the dblink once App1 is brought online after maintenance?
Who is Participating?
Geert GConnect With a Mentor Oracle dbaCommented:
yes... use scheduled job at db start with a delay
and run procedure from app1 across a dblink to app2 ... :)

and vice versa for the other

or if you use a startup script for the database, add a script for such a query on the other database

example on windows: start.cmd
net start OracleServiceAPP1
set oracle_sid=APP1
sqlplus "/ as sysdba" @startup.sql

sqlplus user/pass@APP2 @checkdblink.sql

 startup open

select * from table@dblink
where 1 = 0;

Open in new window

Geert GOracle dbaCommented:
running a query with table@dblink should recreate the dblink session

you could do this after app1 starts
bmsandeAuthor Commented:
any suggestions on automating this?
bmsandeAuthor Commented:
Thanks for the additional info.  Is the behavior we receive with the ORA error expected when the remote db is shutdown or restarted?  Is this common with db links?
Geert GOracle dbaCommented:
dblinks are not very stable

they sometimes just fail and then you have to find the session on the remote db and kill them to fix the problem
the db will automatically make new dblink session after they were killed
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.