--1. 查询DBLINK权限 select * from sys.user_sys_privs t where t.privilege like upper(‘%link%‘); --2. 赋予DBLINK权限 grant CREATE PUBLIC DATABASE LINK,DROP PUBLIC DATABASE LINK to demobase; --3. 查询创建的DBLINK连接 select * from DBA_DB_LINKS; --4. 创建DBLINK连接 create public database link to_db11 connect to demobase identified by demobase using ‘ (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = 11.11.11.11)(PORT = 1521)) ) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = demo) ) )‘; --5. 删除DBLINK连接 drop public database link to_db11;
--查询远程数据库的信息 select * from demobase.my_demo@to_db11; --复制表信息 create table my_test as select * from my_demo where 1=2 ; --全表复制 create table my_test as select * from demobase.my_demo@to_db11; --创建临时表,复制LOB字段 create global temporary table my_temp as select * from demobase.my_demo@to_db11;
时间: 2024-11-05 22:32:50