oracle 跨库操作 @link

时间:2024-03-20 10:26:00

平时在两个IP地址相同的oracle库中操作数据时,是可以如下操作:(直接数据库名.后跟表名访问)

select * from KDBS.Ka01

oracle 跨库操作 @link

 

create database link link_test
connect to DB2 identified by DB2
using'(DESCRIPTION =
   (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.7.XX)(PORT = 1521))
                )(CONNECT_DATA =
                (SERVICE_NAME = orcl)
                )
                )';
                         
select * from [email protected]_test ;
create table tbs as select * from [email protected]_test ;
insert into tbs(t1,t3) select a.t1,a.t2 from [email protected]_test a ;
insert into [email protected]_test(t1,t2) values('33d','667h');
delete [email protected]_test a where a.t1='32';


在数据库a中创建数据库b的@link;既可在a库中访问b库数据