View creation and deletion of DB link

Source: Internet
Author: User

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)

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.