[Oracle] cross-database query methods: database link and transparent gateway

Source: Internet
Author: User

[Oracle] cross-database query method: database link and transparent gateway 1. How to Create a dblink when oracle database A accesses another oracle database B1: create public database link dblink connect to totalplant identified by totalplant using '(DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP) (HOST = LOCALHOST) (PORT = 1521 ))) (CONNECT_DATA = (SERVICE_NAME = prd. gdc) '; Syntax explanation: create public database link DBLINK name (from your own) connect to user name identified by password using' (DESCRI PTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP) (HOST = ip address of the server where the database to be connected is located) (PORT = 1521 ))) (CONNECT_DATA = (SERVICE_NAME = Local Service name of the database to be connected (that is, the SID of the database to be connected) '; 2. if you create a private DBLINKcreate database link dblink connect to totalplant identified by totalplant using '(DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP) (HOST = LOCALHOST) (PORT = 1521) (CONNECT_DATA = (SERVICE_NAME = prd. gdc)) '; 3. after the connection is successful, you can obtain the number from the connected database: select * from tbl_ost_notebook @ dblink; Note: you only need to add "@ DBLINK name" to the table name. 4. to view all the dblinks in the current database, select * from dba_db_links; 5. delete a specified DBLINK in the current database: If a public DBLINK is created, drop public database link dblink must be used to delete it. If a private DBLINK is created, drop database link dblink is required for deletion. Description: drop public database link DBLINK name; 6. how to view the Global Database Name of the current database: select * from global_name; 7. method to view the permissions of the current user for DBLINK: select distinct privilege as "Database Link Privileges" FROM ROLE_SYS_PRIVS where privilege in ('create session', 'create DATABASE link ', 'create public database 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.