The existing two Oracle DB is a and B, in order to be able to operate the B database in a database, we need to establish a dblink to B in the a database.
Before we create the Dblink, we first check the value of the global_names of DB A (select Name,value from v$parameter where name = ' Global_names '), When this value is true indicates that Dblink is acting on a db with the same name, whereas the two DB Dblink connections can have different names, the DB will not have the same name, so we need this parameter value to False, if true, it needs to be changed to FALSE (alter system Set Global_names=false;).
Now we can create Dblink and execute the following statement:
Create Public database link A_to_b
Connect to < user name > identified by < password >
Using ' (DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP) (HOST = 192.168.75.134) (PORT = 1521))
(Connect_data =
(SERVER = dedicated)
(service_name = B)
)
)‘;
where < username > and < password > user name and password for database access for DB B, using the configuration path of TNS followed by DB B. If the access path to DB B is already configured in the TNS file in db A, the above creation statement can also be simply as follows:
Create Public database link A_to_b
Connect to < user name > identified by < password >
Using ' B ';
Once the Dblink is created, we are ready to operate on DB B in db A. For example, if we log in to db A to see the data of the EMP table in DB B, we can write the query statement (SELECT * from [email protected]_to_b)
Oracle Remote Connectivity