1. View Dblink
Select owner,object_namefromwhere object_type=' DATABASE LINK';
Or
Select * from Dba_db_links;
2. Create Dblink
Premise:
The user who created the Dblink has the corresponding database permissions
Create Public Database Database
can use
Grant Create Public database link,createdatabase to MyAccount;
To authorize.
Create Public Database to by '(DESCRIPTION = (Address_list = (ADDRESS = (PROTOCOL = TCP) (HOST = database_ip) (PORT = 1521))) ( Connect_data = (service_name =servicename))';
If you do not add public after create, the created Dblink is not common, only the creator can use it.
Add: How to determine the servicename of a database:
1. Use in Sqlplus
Show parameter[s] service_names;
Note that both parameter and parameters can
2. Use
Select from where name='service_names'
3. Using DB link
For example, a scott_rmthost public dblink (using a Scott user connection to a remote host) is created on the native database, and a sqlplus is connected to the native database, and a select * from [email protected]_ Rmthot can get the data from the EMP table under the Scott user on the remote database.
You can also create a synonym in the local to point to [email protected]_rmthost, so that the value is much more convenient.
4. Delete
Note: The user has create public database link or CREATE DATABASE link permission.
Drop Public database link dblinkname;
View creation and deletion of DB link (go)