DB Links – Oracle

Standard

Private database link syntax

SQL Statement Result
CREATE DATABASE LINK link_name; A private link using the global database name to the remote database.The link uses the userid/password of the connected user. So if scott uses the link in a query, the link establishes a connection to the remote database asscott.
CREATE DATABASE LINK link_name
CONNECT TO user IDENTIFIED BY ...
USING 'service';
A private fixed user link to the database with service name service. The link connects to the remote database with the userid/password regardless of the connected user.
CREATE DATABASE LINK link_name
CONNECT TO CURRENT_USER USING 'service';
A private link to the database with service name service. The link uses the userid/password of the current user to log onto the remote database.

Public database link syntax

SQL Statement Result
CREATE PUBLIC DATABASE LINK link_name; A public link to the remote database. The link uses the userid/password of the connected user. So if scott uses the link in a query, the link establishes a connection to the remote database as scott.
CREATE PUBLIC DATABASE LINK link_name
CONNECT TO CURRENT_USER USING 'service';
A public link to the database with service nameservice. The link uses the userid/password of the current user to log onto the remote database.
CREATE PUBLIC DATABASE LINK link_name
CONNECT TO user IDENTIFIED BY ....;
A public fixed user link. The link connects to the remote database with the userid/password.

Leave a comment