This machine: 192.168.0.1
Remote host: 192.168.0.2
(1) Tnsnames.ora configuration on this machine is as follows
Orcl_2 = (DESCRIPTION = (Address_list = (ADDRESS = (PROTOCOL = TCP) (HOST = 192.168.0.2) (PORT = 1521))) (CO Nnect_data = (service_name = ORCL)))
(2) Create a database connection on this computer
CREATE DATABASE link Link CONNECT to backup identified by Backupusing ' orcl_2 ';
Note: Backup is a user on 192.168.0.2 and the password is backup
# # #查看存在数据库连接
Select Owner,object_name from dba_objects where object_type= ' DATABASE LINK ';
(3) test
SELECT * FROM [email protected];
# # #删除数据库连接
DROP DATABASE link link;
Create a public connection
CREATE public DATABASE LINK Link3connect to backup identified by backup USING ' orcl_2 ';
Public is the global Dblink, that is, all users on the database can query, to SYS or system users to create (of course, users with SYSDBA permissions); If you do not use public is a private dblink, Only the user who created the Dblink can query to see if the connection was successful.
SELECT * FROM [email protected]; SELECT * FROM [e-mail protected];## #删除公共连接DROP public DATABASE LINK LINK3;
This article is from the "Notes" blog, so be sure to keep this source http://sunflower2.blog.51cto.com/8837503/1678868
Oracle---DBLink