Create a database link

Syntax:

– CREATE [SHARED][PUBLIC] DATABASE LINK link_name
[CONNECT TO user IDENTIFIED BY password]
[AUTHENTICATED BY user IDENTIFIED BY password]
[USING ‘connect_string’]

– DR-OP DATABASE LINK

Examples Using DB Links
Choose one of the following SQL statement to create a Database link:

1- CREATE DATABASE LINK link_name
CONNECT TO user IDENTIFIED BY password USING ‘(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)
(HOST=prodserver)(PORT=1521)))
(CONNECT_DATA=(SERVICE_NAME=prod_db)))’

2- CREATE DATABASE LINK link_name CONNECT TO user identified by password USING ‘SID serverice_name’;

You can also use the following SQL command to verify that your database links are set up:

SELECT sysdate FROM DUAL@link_name;

Leave a Reply

Your email address will not be published. Required fields are marked *

*