Oracle DB Link 用过的两种(Gateways/Gateway for ODBC)
Oracle透明网关下载地址: http://download.oracle.com/ot...
Oracle官方文档:http://docs.oracle.com/cd/E11...
Oracle11g 连接多个 sqlserver
参照官方文档
1.配置tg_1 initdg4msql.ora
如果连接多个Sqlserver需要配置多个initdg4msql.ora文件
[sql] view plaincopy
D:appAdministratorproduct11.2.0tg_1dg4msqladmin
copy initdg4msql.ora initdg4msql1.ora
copy initdg4msql.ora initdg4msql2.ora
Change the value of the HS_FDS_CONNECT_INFO parameter in the new files.
For initdg4msql1.ora, enter the following:
HS_FDS_CONNECT_INFO=192.168.1.225//DB1
HS_FDS_TRACE_LEVEL=OFF
HS_FDS_RECOVERY_ACCOUNT=RECOVER
HS_FDS_RECOVERY_PWD=RECOVER
For initdg4msql2.ora, enter the following:
HS_FDS_CONNECT_INFO=192.168.1.225//DB2
HS_FDS_TRACE_LEVEL=OFF
HS_FDS_RECOVERY_ACCOUNT=RECOVER
HS_FDS_RECOVERY_PWD=RECOVER
2.配置tg_1 LISTENER
D:appAdministratorproduct11.2.0tg_1NETWORKADMIN
listener.ora
[sql] view plaincopy
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = dg4msql1)
(ORACLE_HOME = D:\app\Administrator\product\11.2.0\tg_1)
(PROGRAM = dg4msql)
)
(SID_DESC =
(SID_NAME = dg4msql2)
(ORACLE_HOME = D:\app\Administrator\product\11.2.0\tg_1)
(PROGRAM = dg4msql)
)
)
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = digiocto)(PORT = 1522))
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1522))
)
)
ADR_BASE_LISTENER = D:appAdministratorproduct11.2.0tg_1
3.配置tg_1 tnsnames.ora
[sql] view plaincopy
LISTENER_ORCL =
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1522))
dg4msql1 =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1522))
(CONNECT_DATA =(SID = dg4msql1))
(HS=OK)
)
dg4msql2 =
(DESCRIPTION=
(ADDRESS = (PROTOCOL = tcp)(HOST = localhost)(PORT = 1522))
(CONNECT_DATA=(SID = dg4msql2))
(HS=OK)
)
4.增加dbhome_1 tnsnames.ora
[sql] view plaincopy
dg4msql1 =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1522))
(CONNECT_DATA =(SID = dg4msql1))
(HS=OK)
)
dg4msql2 =
(DESCRIPTION=
(ADDRESS = (PROTOCOL = tcp)(HOST = localhost)(PORT = 1522))
(CONNECT_DATA=(SID = dg4msql2))
(HS=OK)
)
5.Restart dbhome1 、tg_1 的LISTENER
6.Create DB Link
[sql] view plaincopy
CREATE PUBLIC DATABASE LINK MSQL1
CONNECT TO "sa"
IDENTIFIED BY "passwd1"
USING 'dg4msql1';
[sql] view plaincopy
CREATE PUBLIC DATABASE LINK MSQL2
CONNECT TO "sa"
IDENTIFIED BY "passwd2"
USING 'dg4msql2';
7.TEST Connection
[sql] view plaincopy
SQL> SELECT * FROM ALL_USERS@MSQL1;
SQL> SELECT * FROM ALL_USERS@MSQL2;