Oracle implements cross-database query (transfer)

 Achievement result: use DBLINK to connect to another database under a user in one database, fetch data from a user in this database, and then insert it into a table in the current database.

First, create a new DBLINK under the Database links menu (Name cannot be the same as the existing one!):

Second, the method of fetching data from the connected database after the connection is successful:

select * from db_log@to_log;

Note: Just add "@DBLINK name " after the table name .

Third, view all DBLINK methods in the current database :

select * from dba_db_links;     

Fourth, the method of deleting a specified DBLINK under the current database :

     1.  If you create a public DBLINK , you need to use the

        drop public database link to_log;

     2.  If you create a private DBLINK , you need to use

        drop database link to_log;

     Description: drop public database link DBLINK name ;     

Fifth, the method of viewing the global database name of the current database:

select * from global_name;   

Sixth, how to check which permissions the current user has 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');    

 

 

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=327019249&siteId=291194637