Database Link 建立注意的兩點

myhuaer發表於2005-08-10

Database Link 建立注意的兩點:

一般建立(Database Link Name 和 Service Name 一致)

A: 先在 Server 端的tnsname.ora 中增加要訪問的 database的連線字串格式如下:

BPCS = (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = Ip Address)(PORT = 1521)) ) (CONNECT_DATA = (SERVICE_NAME = bpcs) ) )

B: 再用SQL /或OEM 建立 為某使用者的DBlink  

CREATE DATABASE LINK "bpcs" CONNECT TO "BQY" IDENTIFIED BY "********" USING 'bpcs'     

特殊建立(Database Link Name 和Service Name 不一致)

A: 首先要在Server 端的 tnsname.ora 中增加要訪問的 database的連線字串格式如下

BACHS = (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = IpAddress)(PORT = 1521)) ) (CONNECT_DATA = (SERVICE_NAME = bpcs) ) )  

B: 要將 Global_name=false

(如果Global_name =true 則在使用建立好的 Databaselink 時會出現如下錯誤提示)

/* ORA-02085 database link strin conects to strings Cause: The database link attempted to connect to a database with a different name.The name of the database link must be the same as the name of the database. Acton: Create a database link with the same name as the database to which it connects. */

C: 再用SQL /或OEM 建立 為某使用者的DBlink

CREATE DATABASE LINK "BACHS" CONNECT TO "BQY" IDENTIFIED BY "********" USING 'BACHS'

[@more@]

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/34596/viewspace-804184/,如需轉載,請註明出處,否則將追究法律責任。

相關文章