Search This Blog

Monday, 10 November 2025

extract DDL for database links with passwords -

 follow the link


https://forums.oracle.com/ords/apexds/post/how-to-extract-ddl-for-all-database-links-7664


set lines 200
set pages 0
set feed off
set heading off
spool get_ddl/get_dblink_ddl.run.sql

SELECT 'CREATE OR REPLACE PROCEDURE '||DECODE(U.NAME,'PUBLIC','SYSTEM',U.NAME)||'.dba$sp_create_dblink_tmp AS '||CHR(10)||'BEGIN'||CHR(10)||
'EXECUTE IMMEDIATE '||''''||
'create '||DECODE(U.NAME,'PUBLIC','public ',' ')||'database link '||L.name
||' connect to ' || L.USERID || ' identified by values '
||''''||''''||L.PASSWORDX||''''||''''||' using '||''''||''''|| L.host ||''''||''''||''''||';'|| CHR(10)||'END dba$sp_create_dblink_tmp; '
||CHR(10)||'/'||CHR(10)||
'EXECUTE '||DECODE(U.NAME,'PUBLIC','SYSTEM',U.NAME)||'.dba$sp_create_dblink_tmp;'||CHR(10)||
'DROP PROCEDURE '||DECODE(U.NAME,'PUBLIC','SYSTEM',U.NAME)||'.dba$sp_create_dblink_tmp;'||CHR(10)
||CHR(10)
TEXT
FROM sys.link$ L, sys.user$ U
WHERE L.OWNER# = U.USER#
;

spool off

No comments:

OCI - Oralce linux - warning your password will expire in 6 days - use command "chage"

  If OS user gets the warning message for password expiry in OCI Oracle linux, then change the password expiry, following are the 2 methods ...