Create DATABASE LINK
You might want to create a database link, for instance, if you want the data in a remote database updated when the local database is updated. Here’s how to accomplish this:
The first thing you need to do is to create a database link pointing to the other location. The database link can be created with a command similar to the following:
CREATE [SHARED | PUBLIC] DATABASE LINK <link-name>
[CONNECT TO <username> IDENTIFIED BY <password>]
[USING <connect-string>];
To create a fixed user database link, a username and password to connect with must be specified. For example:
CREATE PUBLIC DATABASE LINK BASING
CONNECT TO USRCRY IDENTIFIED BY CRYPWD
USING BASING_ORA;
Select count(*) from table@basing;
You’ll want to give the database link a better name, use the appropriate userid/password to connect to the remote database, and configure your TNSNAMES.ORA file with a TNS alias to point to that database.
Leave a Reply
Want to join the discussion?Feel free to contribute!