Loading

数据库链路创建方法

数据库链路创建方法

学习了:http://www.linuxidc.com/Linux/2010-08/27595.htm

删除数据库链接:drop database link linkname;

创建数据库链接:
create database link linkname
connect to username
identified by password
using 'connection string';


如果想建立全局链接,则需要使用关键字:public

create public database link linkname
connect to username
identified by password
using 'connection string';


connection string可以有两种形式:
1,在文件tnsnames.ora配置的名称:
如:
CDRDL =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 10.147.129.29)(PORT = 2521))
)
(CONNECT_DATA =
(SERVICE_NAME = cdrdb)
)
)
此时可以写成:
create database link linkname
connect to username
identified by password
using 'CDRDL';

2,也可以直接使用‘=’号后面的字符串,
如:
create database link linkname
connect to username
identified by password
using '(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=10.147.129.29)(PORT=2521)))(CONNECT_DATA=(SERVICE_NAME=cdrdb)))';

 

posted @ 2017-05-19 11:41  stono  阅读(1275)  评论(0编辑  收藏  举报