1.创建odbc
2.在 product\11.2.0\dbhome_1\hs\admin\ 下拷贝initdg4odbc,把名字改为initcrmsql(init+所建odbc的名称)
HS_FDS_CONNECT_INFO =crmsql #odbc名称 HS_FDS_TRACE_LEVEL= 0 HS_FDS_RECOVERY_ACCOUNT=sa #要连接的数据库名称 HS_FDS_RECOVERY_PWD=123456 #要连接的数据密码
3.配置 product\11.2.0\dbhome_1\NETWORK\ADMIN 文件夹下 listener,增加
SID_LIST_LISTENER = (SID_LIST = (SID_DESC = (SID_NAME = CLRExtProc) (ORACLE_HOME = E:\app\Administrator\product\11.2.0\dbhome_1) (PROGRAM = extproc) (ENVS = "EXTPROC_DLLS=ONLY:E:\app\Administrator\product\11.2.0\dbhome_1\bin\oraclr11.dll") ) # 增加开始 (SID_DESC = (SID_NAME = crmsql) (ORACLE_HOME = E:\app\Administrator\product\11.2.0\dbhome_1) (PROGRAM =dg4odbc) ) # 增加结束 )
tnsnames文件中增加
crmsql= (DESCRIPTION= (ADDRESS=(PROTOCOL=tcp)(HOST= 192.168.2.4)(PORT=1521)) (CONNECT_DATA=(SID=crmsql)) (HS=OK) )
3.重启oracle监听。
4.打开sql plus,输入连续的oracle的用户名和账号。
create public database link crmsql connect to sa indentified by "123456" using ‘crmsql‘;
5.验证
select * from [email protected]
时间: 2024-12-09 16:29:04