How to create a DB link between two Oracle instances. Let's say A and B are two instances. I want to access the data in instance B from the instance A.
A database link is a pointer that defines a one-way communication path from an Oracle Database server to another database server. The link pointer is actually defined as an entry in a data dictionary table. To access the link, you must be connected to the local database that contains the data dictionary entry.
CREATE DATABASE LINK to_db1 CONNECT TO hr1 IDENTIFIED BY hr1 USING DB1; For this to work you got to have both databases with the right TNS, or else you got to use a connection string instead of the database service.
If you want to access the data in instance B from the instance A. Then this is the query, you can edit your respective credential.
CREATE DATABASE LINK dblink_passport CONNECT TO xxusernamexx IDENTIFIED BY xxpasswordxx USING '(DESCRIPTION= (ADDRESS= (PROTOCOL=TCP) (HOST=xxipaddrxx / xxhostxx ) (PORT=xxportxx)) (CONNECT_DATA= (SID=xxsidxx)))';
After executing this query access table
SELECT * FROM tablename@dblink_passport;
You can perform any operation DML, DDL, DQL
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With