【Vegas原创】用gateway设置多个SQL访问
例:新增DTSVEGAS的访问。
gateway服务器:
1,在$ORACLE_HOME\tg4msql\admin下新写initdtsvegas.ora:
# This is a sample agent init file that contains the HS parameters that are
# needed for the Transparent Gateway for SQL Server
#
# HS init parameters
#
HS_FDS_CONNECT_INFO="SERVER=dtsvegas;DATABASE=Private"
HS_DB_NAME=Private
HS_FDS_TRACE_LEVEL=OFF
HS_FDS_RECOVERY_ACCOUNT=RECOVER
HS_FDS_RECOVERY_PWD=RECOVER
2,更改$ORACLE_HOME\network\admin 下的listener.ora内容:
# listener.ora Network Configuration File: G:\oracle\product\10.2.0\tg_1\NETWORK\ADMIN\listener.ora
# Generated by Oracle configuration tools.
LSNDTSGATEWAY =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1))
(ADDRESS = (PROTOCOL = TCP)(HOST = [Server])(PORT = 1522))
)
)
SID_LIST_LSNDTSGATEWAY =
(SID_LIST =
(SID_DESC =
(SID_NAME = tg4msql)
(ORACLE_HOME = G:\oracle\product\10.2.0\tg_1)
(PROGRAM = tg4msql)
)
(SID_DESC =
(SID_NAME = dtsvegas)
(ORACLE_HOME = G:\oracle\product\10.2.0\tg_1)
(PROGRAM = tg4msql)
)
)
# Generated by Oracle configuration tools.
LSNDTSGATEWAY =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1))
(ADDRESS = (PROTOCOL = TCP)(HOST = [Server])(PORT = 1522))
)
)
SID_LIST_LSNDTSGATEWAY =
(SID_LIST =
(SID_DESC =
(SID_NAME = tg4msql)
(ORACLE_HOME = G:\oracle\product\10.2.0\tg_1)
(PROGRAM = tg4msql)
)
(SID_DESC =
(SID_NAME = dtsvegas)
(ORACLE_HOME = G:\oracle\product\10.2.0\tg_1)
(PROGRAM = tg4msql)
)
)
3,重启Listener.(凡重复1,2步骤,就需重启listener)
注意:重启不成功,就将tg4msql进程kill掉!再继续开启listener!
Oradb服务器:
1,配置tnsnames.ora:
# tnsnames.ora Network Configuration File: F:\oracle\product\10.2.0\db_1\NETWORK\ADMIN\tnsnames.ora
# Generated by Oracle configuration tools.
AAA =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = [server])(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = bcs)
)
)
DTSVEGAS =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = dtsdb01.dts.daxon.com)(PORT = 1521))
)
(CONNECT_DATA =
(SID = dtsvegas)
)
(HS = dtsvegas)
)
# Generated by Oracle configuration tools.
AAA =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = [server])(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = bcs)
)
)
DTSVEGAS =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = dtsdb01.dts.daxon.com)(PORT = 1521))
)
(CONNECT_DATA =
(SID = dtsvegas)
)
(HS = dtsvegas)
)
2,tnsping一下,看否通。
3,建立数据链接:
create public database link dtsvegas
connect to sa identified by "wo****" using 'DTSVEGAS';
connect to sa identified by "wo****" using 'DTSVEGAS';
4,访问SQLDB:
Caution:
1,配置Oradb tnsnames.ora时,
SID or SERVICE_NAME需和Gateway上listener.ora的SID一致。
2,在访问SQLDB,select的时候,如果select到详细的栏位,记得栏位加“”,并注意栏位名的大小写!
如:
喜欢请赞赏一下啦^_^