Name

CREATE DATABASE LINK

Synopsis

CREATE [SHARED] [PUBLIC] DATABASE LINK
dblink
[CONNECT TO {CURRENT USER | username
IDENTIFIED BY password}
[AUTHENTICATED BY username IDENTIFIED BY
password]
   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.

Keywords

SHARED

Specifies that the database link will share a connection through the Multi-Threaded Server.

PUBLIC

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.

CONNECT TO

Specifies the username and password used to connect to the remote database.

CURRENT USER

Creates a “current user database link” that can only be used by users authenticated globally by the Oracle Security Server.

IDENTIFIED BY

Specifies the password for the username.

AUTHENTICATED BY

Specifies the username and password on the remote database, used when a SHARED database link is specified.

USING

Specifies the SQL*Net database specification (`connect_string') for the remote database.

Notes

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.

Examples

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
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset