关键字:Oracle 数据库
方法2:
如果没有权限修改tnsnames.ora,那么就没有办法建立到adb数据库的tns别名,那么就只能采用在创建dblink的时候,全写解析符号。创建dblink的方法如下:
create database link
connect to bdb identified by identified by bdb
using '(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 10.70.9.12)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = dbtestb)
)
)';
创建好tns别名之后,可以采用sqlplus username/password@tnsname来测试创建的tns别名是否正确。
我在生产系统中创建的一个dblink示例:
create database link NEW_DBLINK
connect to AIIPS identified by "1qaz2wsx"
using '(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 10.70.193.12)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = zjpub)
)
)';