Sunday, October 12, 2008

DATABASE LINK in ORACLE

A database link is a schema object in one database that enables you to access objects on another database. The other database need not be an Oracle Database system. To create a private database link, you must have the CREATE DATABASE LINK system privilege. To create a public database link, you must have the CREATE PUBLIC DATABASE LINK system privilege.

Examples:
CREATE DATABASE LINK local CONNECT TO hr IDENTIFIED BY hr USING 'local';

CREATE PUBLIC DATABASE LINK remote USING 'remote';

CREATE DATABASE LINK remote.us.oracle.com CONNECT TO CURRENT_USER USING 'remote';

SELECT * FROM employees@local;

Here 'local' is connect string. Specify the service name of a remote database. If you specify only the database name, then Oracle Database implicitly appends the database domain to the connect string to create a complete service name. Therefore, if the database domain of the remote database is different from that of the current database, then you must specify the complete service name.

No comments:

search engine

Custom Search