A database link allows you to reference objects in a remote database. Typically, the remote database will be another Oracle database, but it can be any ODBC compliant database.When accessing a remote object over a database link, the local database is acting as an Oracle client.

Remote Username: remo / remo

 

Private database link to a user in a remote database (To access the table in one and only SYS user from the Database).

 

SQL> show user

USER is “REMO”

SQL> conn / as sysdba

Connected.

SQL> desc dba_db_links;

Name        Null? Type

—————————————————– ——– ————————————

OWNER        NOT NULL VARCHAR2(128)

DB_LINK        NOT NULL VARCHAR2(128)

USERNAME VARCHAR2(128)

HOST VARCHAR2(2000)

CREATED        NOT NULL DATE

HIDDEN VARCHAR2(3)

 

SQL> create public database link dblink1 connect to remo identified by remo using ‘raj’;

 

Database link created.

 

Private database link to a user in a remote database, with full connection string.

 

CREATE DATABASE LINK dblink_remo CONNECT TO remo IDENTIFIED BY remo USING

 

‘(DESCRIPTION=

(ADDRESS=(PROTOCOL=TCP)(HOST=server1.example.com)(PORT=1521))

(CONNECT_DATA=(SERVICE_NAME=HRDEV1)))’;

 

Public Database link(To access the table in any users from the Database).

 

SQL> create public database link dblink1 connect to remo identified by remo using ‘raj’;

 

Database link created.

 

 

Private database link to a user in the local database.

 

CREATE DATABASE LINK remo_local

CONNECT TO remo IDENTIFIED BY remo

USING ‘local’;

 

 

Recent Posts

Start typing and press Enter to search