Script to get the Metadata of all Dblinks in the Database
set lines 240
set echo off
set feedb off
set termout off
set heading off
SET VERIFY off
set trimspool on
set long 32766
set longchunksize 120
col l1 format a80
col l2 format a160 newline
define spoolfile=/tmp/metadata_all_dblinks_out.sql
spool &spoolfile
select 'select '||''''||'-- '||owner||'.'||db_link||''''||' from dual; ' l1,
'select dbms_metadata.get_ddl('||''''||'DB_LINK'||''''||','||
''''||db_link||''''||','||''''||owner||''''||') from dual; ' l2
from dba_db_links
order by owner, db_link
/
spool off
set termout on
@&spoolfile
set echo on
set feedb on
set heading on
SET VERIFY on
undefine spoolfile