标签:sele 技术 def 访问 host using 注释 img art
当用户要跨本地数据库,访问另外一个数据库表中的数据时,本地数据库中必须创建了远程数据库的dblink,通过dblink本地数据库可以像访问本地数据库一样访问远程数据库表中的数据。
select * from user_sys_privs where privilege like upper(‘%DATABASE LINK%‘);
grant CREATE PUBLIC DATABASE LINK,CREATE DATABASE LINK,DROP PUBLIC DATABASE LINK to local_username;
create public database link dblink_name
connect to remote_username identified by remote_password
using ‘(DESCRIPTION =(ADDRESS_LIST =(ADDRESS =(PROTOCOL = TCP)(HOST = 127.0.0.1)(PORT = 1521)))(CONNECT_DATA =(SERVICE_NAME = orcl)))‘;
select * from dba_db_links;
select * from all_db_links;
select owner,object_name from dba_objects where object_type=‘DATABASE LINK‘;
select * from table_name@dblink_name;
drop public database link dblink_name;
local_username:
本地数据库用户名dblink_name:
创建dblink的名称remote_username:
远程数据库用户名remote_password:
远程数据库密码HOST:
远程数据库IPSERVICE_NAME:
远程数据库实例名table_name:
远程数据库表名参考资料
标签:sele 技术 def 访问 host using 注释 img art
原文地址:https://www.cnblogs.com/hopeiscoming/p/12430805.html