oracle的db link
cd $ORACLE_HOME/network/admin
vi tnsnames.ora
添加
CCPBS_19 =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 10.130.38.19)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = CCPBS)
)
)
>create public database link ecbm_19 connect to ecbm_userName identified by ecbm_pwd using 'CCPBS_19';
Database link created.
createpublicdatabaselink link_name connectto user identifiedby password using 'SID';
则创建了一个连接到10.130.38.19 ccpbs上以ecbm_userName 用户的连接
查询数据时带上@ecbm_19 就ok了 如select * from emp@ecbm_19;
删除 DROPPUBLICDATABASELINK ecbm_19;
3、建立同义词,为了使有关分布式操作更透明,ORACLE数据库里有同义词的对象synonym
SQL>create synonym bjscottemp for emp@beijing;
于是就可以用bjscottemp来替代带@符号的分布式链接操作emp@beijing。
create public synonym poh for po_headers_all@erp_danzheng_test;
查看所有的数据库链接,进入系统管理员SQL>操作符下,运行命令:
SQL>select owner,object_name from dba_objects where object_type='DATABASE LINK';