创建dblink

CREATE PUBLIC DATABASE LINK dblink1 CONNECT TO username IDENTIFIED BY userpassword USING '(DESCRIPTION =
     (ADDRESS_LIST =
       (ADDRESS = (PROTOCOL = TCP)(HOST = 127.0.0.1)(PORT = 1521))
     )
     (CONNECT_DATA =
    (SERVICE_NAME = orcl)
     )
   )' 

注意:如果密码存在大小写的话,需要用双引号括起来

create public database link dblink1 connect to db1 identified by "123*456" using 'db11'

删除dblink

 drop public database link dblink1;

查看dblink

select * from  all_db_links;
select * from user_db_links;

创建远程数据库同义

create synonym  for TABLENAME@DBLNKNAME; 

使用dblink

--查询  
select * from TABLENAME@DBLNKNAME;
--操纵远程数据库记录
insert into TABLENAME@DBLNKNAME (a,b)  values (va,vb);
update    TABLENAME@DBLNKNAME  set a='this';
delete from TABLENAME@DBLNKNAME;
--怎样执行远程的内嵌过程
begin
otherdbpro@to_html(参数);
end;
文章作者: zlinks
本文链接:
版权声明: 本站所有文章除特别声明外,均采用 CC BY-NC-SA 4.0 许可协议。转载请注明来自 ZFS的成长之路
Oracle Oracle基本语法
喜欢就支持一下吧