CREATE DATABASE LINK
CREATE [SHARED] [PUBLIC] DATABASE LINKdblink
[CONNECT TO {CURRENT USER |username
IDENTIFIED BYpassword
} [AUTHENTICATED BYusername
IDENTIFIED BYpassword
] USING 'connect string
'
Creates a database link (dblink), which allows access to objects on a remote database; dblink must be a valid Oracle object name.
Specifies that the database link will share a connection through the Multi-Threaded Server.
Specifies that the database link will be available to all users. If PUBLIC is omitted, the database link is private and is available only to you.
Specifies the username and password used to connect to the remote database.
Creates a “current user database link” that can only be used by users authenticated globally by the Oracle Security Server.
Specifies the password for the username.
Specifies the username and password on the remote database, used when a SHARED database link is specified.
Specifies the SQL*Net database specification (`connect_string') for the remote database.
You must have the CREATE DATABASE LINK privilege to create a private database link. You must have the CREATE PUBLIC DATABASE LINK privilege to create a public database link. In addition, you must have the CREATE SESSION privilege on the remote database, and SQL*Net must be operating on both the local and remote databases.
The following example creates a public database link to scott’s account on the TEST database:
CREAT PUBLIC DATABASE LINK testscott CONNECT TO scott IDENTIFIED BY tiger USING 'TEST'
Any user on the local database may now access any of scott’s objects for which they have privileges on the TEST database. For example, to select the emp table on the remote database, specify the following SQL statement:
SELECT * FROM emp@testscott