How to extract the DB LINKS DDL with the password

Here is a simple script to extract the DB Links DDL with the encripted password.

SET LONG 9000 — to print the complete string
SELECT DBMS_METADATA.GET_DDL(‘DB_LINK’,a.db_link,a.owner) FROM dba_db_links a;

Advertisements

7 comments

  1. By using above query,I didn’t get real password details.Hence my LIVE account has locked suddenly.

    Noone is able to provide the password.

    • I do recommend to test it before you execute anything in your production systems at your own risk.

      In the Disclaimer:
      I do not recommend apply any information posted here in your production system without fully test it in your testing systems.

  2. SELECT ‘CREATE ‘
    || DECODE (U.NAME, ‘PUBLIC’, ‘PUBLIC ‘)
    || ‘DATABASE LINK “‘
    || DECODE (U.NAME, ‘PUBLIC’, NULL, U.NAME || ‘.’)
    || L.NAME
    || ‘” CONNECT TO “‘
    || L.USERID
    || ‘” IDENTIFIED BY VALUES ”’
    || L.PASSWORDX
    || ”’ USING ”’
    || L.HOST
    || ””
    || CHR (10)
    || ‘;’
    TEXT
    FROM sys.link$ L, sys.user$ U
    WHERE L.OWNER# = U.USER#;

    — i found this on net dont recall the site but this should work

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.