Tuesday, February 12, 2013

Oracle 8i : DB Links script with credentials

The Following script is very much helpful to generate script for DB Links created in the server.

 

SELECT 'create '||DECODE(U.NAME,'PUBLIC','public ')||'database link '||CHR(10)

||DECODE(U.NAME,'PUBLIC',Null, U.NAME||'.')|| L.NAME||chr(10)

||'connect to ' || L.USERID || ' identified by '

||L.PASSWORD||' using ''' || L.host || ''''

||chr(10)||';' TEXT

FROM sys.link$ L, sys.user$ U

WHERE L.OWNER# = U.USER#;