[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 ');