时间:2021-07-01 10:21:17 帮助过:3人阅读
安装过程中,踩了不少的坑,需要配置很多的东西,QQ群里也请教不少人,都很少人听说还有这玩意,现在做数据对接,都是走到接口,传JSON字符串过来,回答我的人,也是寥寥无几,一万句“fuck you”,真的是坑啊,最终花了一天的时间把捣鼓出来,所以把整个安装步骤记录下来。
需要的朋友请到我的百度云盘上下载
链接:https://pan.baidu.com/s/1pLsPI8jw7e5JiTazPJpFwQ
提取码:m7od
1 这个目录下可以看到以下initdg4msql.ora文件,上面在安装透明网关的时候有配置的要链接SQL SERVER数据的地址和数据库名称,在这里都可以体现:
1 # This is a customized agent init file that contains the HS parameters 2 # that are needed for the Database Gateway for Microsoft SQL Server 3 4 # 5 # HS init parameters 6 # 7 HS_FDS_CONNECT_INFO=[127.0.0.1]:1433//DEMO 注:连接其他的SQL Server可修改此处 8 HS_FDS_TRACE_LEVEL=OFF 9 HS_FDS_RECOVERY_ACCOUNT=RECOVER 10 HS_FDS_RECOVERY_PWD=RECOVER
1 # This is a sample listener.ora that contains the NET8 parameters that are 2 # needed to connect to an HS Agent 3 4 LISTENER = 5 (ADDRESS_LIST= 6 (ADDRESS=(PROTOCOL=tcp)(HOST=localhost)(PORT=1521)) 7 ) 8 9 SID_LIST_LISTENER= 10 (SID_LIST= 11 (SID_DESC= 12 (SID_NAME=dg4msql) 13 (ORACLE_HOME=D:\Oracle\product\11.2.0\dbhome_1) 14 (PROGRAM=dg4msql) 15 ) 16 ) 17 18 #CONNECT_TIMEOUT_LISTENER = 0
1 # This is a sample tnsnames.ora that contains the NET8 parameters that are 2 # needed to connect to an HS Agent 3 4 dg4msql = 5 (DESCRIPTION= 6 (ADDRESS=(PROTOCOL=tcp)(HOST=localhost)(PORT=1521)) 7 (CONNECT_DATA=(SID=dg4msql)) 8 (HS=OK) 9 )
1 # This is a sample listener.ora that contains the NET8 parameters that are 2 # needed to connect to an HS Agent 3 SID_LIST_LISTENER = 4 (SID_LIST = 5 (SID_DESC = 6 (SID_NAME = CLRExtProc) 7 (ORACLE_HOME = D:\Oracle\product\11.2.0\dbhome_1) 8 (PROGRAM = extproc) 9 (ENVS = "EXTPROC_DLLS=ONLY:D:\Oracle\product\11.2.0\dbhome_1\bin\oraclr11.dll") 10 ) 11 (SID_DESC= 12 (SID_NAME=dg4msql) 13 (ORACLE_HOME=D:\Oracle\product\11.2.0\dbhome_1) 14 (PROGRAM=dg4msql) 15 ) 16 ) 17 18 LISTENER = 19 (DESCRIPTION_LIST = 20 (DESCRIPTION = 21 (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521)) 22 (ADDRESS = (PROTOCOL = TCP)(HOST = YRDLG5GS4G3ODYI)(PORT = 1521)) 23 (ADDRESS=(PROTOCOL=tcp)(HOST=127.0.0.1)(PORT=1521)) 24 ) 25 ) 26 27 ADR_BASE_LISTENER = D:\Oracle 28 29 #CONNECT_TIMEOUT_LISTENER = 0
1 这里需要注意的主要是一下几点: 2 PROGRAM为dg4msql:因为实例的配置文件在dg4msql目录下,就是上面的initdg4msql.ora文件所在的目录 3 SID_NAME为dg4msql:这个sid就是上面的文件名中的sid,initdg4msql.ora的sid为dg4msql 4 ORACLE_HOME就是我们透明网关的安装目录 5 ORACLE的监听端口是1521,我的oracle和透明网关是安装在同一台机器上的,所以透明网关的监听端口设置为1522。 6 一个initSID.ora文件就对应一个SID_DESC,可以根据想要链接的数据库来配置。
1 # sqlnet.ora Network Configuration File: D:\Oracle\product\11.2.0\dbhome_1\network\admin\sqlnet.ora 2 # Generated by Oracle configuration tools. 3 4 # This file is actually generated by netca. But if customers choose to 5 # install "Software Only", this file wont exist and without the native 6 # authentication, they will not be able to connect to the database on NT. 7 8 SQLNET.AUTHENTICATION_SERVICES= (NONE) 9 10 NAMES.DIRECTORY_PATH= (TNSNAMES, EZCONNECT)
1 # This is a sample tnsnames.ora that contains the NET8 parameters that are 2 # needed to connect to an HS Agent 3 ORCL = 4 (DESCRIPTION = 5 (ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521)) 6 (CONNECT_DATA = 7 (SERVER = DEDICATED) 8 (SERVICE_NAME = orcl) 9 ) 10 ) 11 12 dg4msql = 13 (DESCRIPTION= 14 (ADDRESS=(PROTOCOL=tcp)(HOST=127.0.0.1)(PORT=1521)) 15 (CONNECT_DATA=(SID=dg4msql)) 16 (HS=OK) 17 )
1 命令:lsnrctl reload
1 如:grant create public database link to system ; 2 格式:grant create public database link to 用户名 ;
1 create database link DBTEST1 2 connect to SA identified by "password" 3 using ‘dg4msql‘; 4 5 6 7 格式: 8 create database link DBLink名称 9 connect to SQL Server账户 identified by "SQL Server密码" 10 using ‘SID‘;
捣鼓一下午,问题找到是因为这6个文件配置出问题了,这次就不再叙述了,修改那个配置文件了,配置文件因人而异,剩下的自己百度去查吧~~~~好了,捣鼓一天了,洗洗睡了,拜~~
Oracle DBLink跨数据库访问SQL server数据同步 踩坑实录
标签:字符 朋友 建立 param 技术 generate base not png