ORACLE9i 的透明閘道器的配置 (轉)

worldblog發表於2007-08-16
ORACLE9i 的透明閘道器的配置 (轉)[@more@]

實現異種連線服務的技術叫做透明閘道器(Transparent Gateway)。
目前ORACLE利用透明閘道器可以實現和 SERVER、、2等多種主流資料庫的互聯。

筆者由於工作需要,透過oracle訪問sybase資料庫,把oracleTRANSPARENT GATEWAY FOR SYBASE
的步驟寫成文件,供需要的網友參考!
 
配置TRANSPARENT GATEWAY FOR SYBASE步驟

1.
oracle所在上sybase client(或者在同一臺server上安裝oracle、sybase伺服器)
確保能夠訪問sybase資料庫

2.
安裝TRANSPARENT GATEWAY FOR SYBASE選件,要用自定義安裝。
正確選擇sybase的安裝目錄

3.
選擇一個sid字串準備賦給sybase資料庫。如:tg4sybs
設定SYBASE的dll路徑到環境變數PATH(這一步很重要)

4.
修改初始化,預設的是:
ORACLE_HOME g4sybsadmininittg4sybs.ora
設定引數
HS_FDS_CONNECT_INFO
格式:HS_FDS_CONNECT_INFO= server_name. database_name[,INTERFACE= interface_file]
server_name. database_name是大小寫敏感的。
INTERFACE可選

例子:如下
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
# This is a sample agent init file that contains the HS parameters that are
# needed for the Transparent Gateway for Sybase

#
# HS init parameters
#
HS_FDS_CONNECT_INFO=migration_serv.tax
HS_FDS_TRACE_LEVEL=OFF
HS_FDS_RECOVERY_ACCOUNT=RECOVER
HS_FDS_RECOVERY_PWD=RECOVER

#
# Environment variables required for Sybase
#
set SYBASE=d:sybase
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
上例中
server_name是migration_serv
database_name是tax

5.
配置oracle服務的listener,配置檔案是:listener.ora
預設路徑:ORACLE_HOMEworkadmin
加入如下

SID_LIST_LISTENER=
(SID_LIST=
(SID_DESC=
(SID_NAME= gateway_sid)
(ORACLE_HOME= oracle_home_directory)
(PROGRAM=tg4sybs)
)
)

gateway_sid就是3選擇的sid字串
oracle_home_directory是ORACLE_HOME
tg4sybs若是SYBASE是特定的。如果是其他資料庫,會不同。
例子如下:
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
  (SID_DESC=
  (SID_NAME=tg4sybs)
  (ORACLE_HOME = D:oracleora92)
  (PROGRAM=tg4sybs)
  )
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$

6.
停止

lsnrctl stop


重新啟動監聽

lsnrctl start

7.
配置oracle server的tnsnames.ora使其能夠訪問sybase
connect_descriptor=
(DESCRIPTION=
(ADDRESS=
(PROTOCOL=TCP)
(HOST= host_name)
(PORT= port_number)
)
(CONNECT_DATA=
(SID= gateway_sid))
(HS=OK))

connect_descriptor是連線串,任取,一般為sybs
host_name:oracle server的name
port_number:oracle監聽埠
gateway_sid就是3選擇的sid字串

例子如下:
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
sybs=
  (DESCRIPTION=
  (ADDRESS_LIST =
  (ADDRESS=(PROTOCOL=TCP)(HOST= dw-server1)(PORT= 1521))
  )
  (CONNECT_DATA=
  (SID= tg4sybs)
  )
  (HS=OK)
  )

$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$

8.建立database link

如:
CREATE  DATABASE LINK sybs  CONNECT TO sa
  NTIFIED BY prient 
  USING 'SBYS' ;
 
即可訪問sybase 資料庫。


需要注意的是,sybase資料庫的表名,欄位名,如果是小寫的,那麼在oracle裡訪問的時候要加上雙引號""

如:
SQL〉 "a" from to:"b"@sybs'>"b"@sybs;


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

相關文章