View, create, and delete of DATABASE LINK

Source: Internet
Author: User

1. View Dblink
SELECT owner,object_name from  dba_objects  WHERE object_type= ' DATABASE LINK ';

Or

SELECT * from Dba_db_links;  

2. Create Dblink Prerequisites:

The user who created the Dblink has the corresponding database permissions. Create public or CREATE DATABASE link

can use

To authorize.

Create Public database link Dblinkname connect to username identified by password  using ' (DESCRIPTION =         (address_l IST =         (ADDRESS = (PROTOCOL = TCP) (HOST = database_ip) (PORT = 1521)))         (Connect_data =         (service_name =servicena me)) ';  

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 Name,value from V$parameter where name= ' service_names ';  
3. Using Dblink

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 Dblink

Note: The user has create public database link or CREATE DATABASE link permission.

View, create, and delete of DATABASE LINK

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.