How to Find DDL of DB_LINK in Oracle: A Step-by-Step Guide

DDL of DB_LINK in Oracle
In this article, we will learn how to find DDL of DB_LINK in Oracle. Let’s go through this.

Query :

Find DDL of all the DB_LINK in Oracle:

SELECT 'CREATE '
|| DECODE (Y.NAME, 'PUBLIC', 'PUBLIC ')
|| 'DATABASE LINK "'
|| DECODE (Y.NAME, 'PUBLIC', NULL, Y.NAME || '.')
|| X.NAME
|| '" CONNECT TO "'
|| X.USERID
|| '" IDENTIFIED BY VALUES "'
|| X.PASSWORD
|| '" USING "'
|| X.HOST
|| '";'
TEXT
FROM sys.link$ X, sys.user$ Y
WHERE X.OWNER# = Y.USER#;

Hope this helps!!

Also, you can get more details from the below Oracle Doc :

DBMS_METADATA.GET_DDL for ‘DB_LINK’ Always Returns BY VALUES ‘:1’ (Doc ID 1912244.1)

Related Articles on Oracle :

How to find all the DB_Link Details in Oracle database: Easy Guide

Leave a Reply