Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: TNSPING from PL/SQL?
I agree mr Bakker and TAF is the elegant way to solve this issue.
But if you don't won't to implement it you can reinvent the wheel like
this:
declare
newline char(1) := chr(10); /* Newline command */
string varchar2(1000);
l_db_link user_db_links.db_ink%type;
cursor each_c is select db_link
from user_db_links;
fetch each_c into l_db_link; exit when each_c%NOTFOUND; begin dbms_sql.parse ( 'delete from dual@' || l_db_link , dbms_sql.native ); string := 'conn hr/hr@' || l_db_link || newline || ' @c:\script1.sql;' || newline || ' @c:\script2.sql;' || newline || ' @c:\script3.sql;' || insert into temptbl (command) values (string); when others dbms_output.put_line ( '--The databadase pointed by ' || l_db_link || ' is down' ); end;