Oracle DB_LINK, oracledb_link

Source: Internet
Author: User

Oracle DB_LINK, oracledb_link

1. Create a remote database service name first (Note: if the server has both an oracle server and a client, you must configure the service name in tnsnames. ora of the server; otherwise, the following error is reported ):

SQL> select count (*) from webxxxt_pic.xxx @ pic_link; select count (*) from webxxxt_pic.xxx @ pic_link * row 1st error: ORA-12154: TNS: Unable to parse the specified connection identifier

2. Grant DB_LINK creation permission:

grant CREATE PUBLIC DATABASE LINK,DROP PUBLIC DATABASE LINK to scott;

Check which users have the permission to create DB_LINK:

select * from user_sys_privs t where t.privilege like upper('%link%');

3. Create DB_LINK with the authorized user:

create database link DBLINK_NAME connect to USER01 identified by PASSWORD using 'TNS_NAME';

DBLINK_NAME: name of DB_LINK
USER01: Remote database account
PASSWORD: Account of the remote database
TNS_NAME: Remote database service name

4. view all the db_links in oracle:

select owner,db_link,username from dba_db_links;

5. Use DB_LINK:

select * from scott.tb_test@DBLINK_NAME;
insert into scott.tb select * from scott.tb@pic_link;

 


 

 

Related Article

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.