時(shí)間:2015-06-28 00:00:00 來(lái)源:IT貓撲網(wǎng) 作者:網(wǎng)管聯(lián)盟 我要評(píng)論(0)
我現(xiàn)在有兩種數(shù)據(jù)庫(kù),一個(gè)為oracle 11g,版本為:11.1.0.6.0 - 64bit,安裝在HP-IA64的服務(wù)器上,一個(gè)為mysql 5.1,安裝在同一臺(tái)服務(wù)器中。
現(xiàn)在要實(shí)現(xiàn)oracle的數(shù)據(jù)庫(kù)能夠查詢mysql數(shù)據(jù)庫(kù)的表,想要通過(guò)oracle的異構(gòu)功能來(lái)實(shí)現(xiàn),但由于小弟對(duì)數(shù)據(jù)庫(kù)了解不深,還請(qǐng)各位幫忙。
以下為我的各個(gè)配置文件,不知道錯(cuò)誤出在哪兒里了:
1、由于oracle 11g沒(méi)有了hsodbc,需要采用dg4odbc,dg4odbc運(yùn)行正常:
$ dg4odbc
Oracle Corporation — TUESDAY? NOV 17 2009 16:36:56.450
Heterogeneous Agent Release 11.1.0.6.0 - 64bit Production? Built with
Oracle Database Gateway for ODBC
2、odbc.ini文件:
[localdp]
Description??? = hsdp
Driver??? = /app/lib/libmyodbc3_r-3.51.25.so
Server??? = localhost
Database? = dp
Port????? = 3306
UID????? = root
Password? = 123456
Socket??? =
Option??? = 7340295
Stmt????? =
3、isql運(yùn)行正常:
$ isql -v localdp
+—————————————+
| Connected!??? |
|? |
| sql-statement????? |
| help [tablename]??? |
| quit??? |
|? |
+—————————————+
SQL>
4、init <>.ora文件:
$ cat initdp.ora
HS_FDS_CONNECT_INFO=localdp
HS_FDS_TRACE_LEVEL= off
HS_FDS_SHAREABLE_NAME=app/lib/libmyodbc3_r-3.51.25.so
HS_LANGUAGE=american_america.zhs16cgb231280
HS_OPEN_CURSORS=300
set ODBCINI=/app/configinfo/odbc.ini
set ORACLE_HOME=/app/oracle/app/oracle/product/11.1.0/db_2
#p#副標(biāo)題#e#
5、listener.ora中加入的內(nèi)容:
(SID_DESC =
(SID_NAME = dp)
(ORACLE_HOME = /app/oracle/app/oracle/product/11.1.0/db_2)
(PROGRAM = dg4odbc)
(ENVS="LD_LIBRARY_PATH=/app/oracle/app/oracle/product/11.1.0/db_2/lib:/app/unixodbc/lib")
)
6、tnsnames.ora文件中加入內(nèi)容:
hsd =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.0.1)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = dp)
)
(HS = OK)
)
7、tnsping hsd
$ tnsping hsd
TNS Ping Utility for HPUX: Version 11.1.0.6.0 - Production on 17-NOV-2009 16:43:46
Copyright (c) 1997, 2007, Oracle.? All rights reserved.
Used parameter files:
/app/oracle/app/oracle/product/11.1.0/db_2/admin/sqlnet.ora
Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.0.1)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = dp)) (HS = OK))
OK (0 msec)
8、創(chuàng)建DBLINK可以成功。
create public database link hsdlink connect to "root" identified by "123456" using 'hsd';
9、查詢出錯(cuò):
SQL> select * from dp.dp_path@hsdlink;
select * from dp.dp_path@hsdlink
*
ERROR at line 1:
ORA-28500: connection from ORACLE to a non-Oracle system returned this message:
ORA-02063: preceding line from HSDLINK
現(xiàn)在找不到錯(cuò)誤的原因,還請(qǐng)各位大俠幫忙。先行謝過(guò)?。?!
附加:oracle的環(huán)境變量:
export ORACLE_BASE=/app/oracle/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/11.1.0/db_2
export ORA_CRS_HOME=$ORACLE_HOME/crs
export ORACLE_SID=ora11ghs
export ORACLE_PATH=$ORACLE_BASE/common/oracle/sql:$ORACLE_HOME/rdbms/admin
export PATH=$PATH:$ORACLE_HOME/bin:/usr/local/bin:/app/unixodbc/bin:$HOME/bin:.
export TNS_ADMIN=$ORACLE_HOME/admin
export ORA_NLS10=$ORACLE_HOME/nls/data
export SHLIB_PATH=$ORACLE_HOME/lib:$ORACLE_HOME/lib:$ORACLE_HOME/rdbms/lib:/app/lib:/app/unixodbc/lib
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:$ORACLE_HOME/rdbms/lib:/usr/lib:/usr/local/lib:$ORACLE_HOME/oracm/lib:/app/unixodbc/lib:/app/lib
export CLASSPATH=$ORACLE_HOME/rdbms/jlib:$ORACLE_HOME/jlib:$ORACLE_HOME/jlib:$ORACLE_HOME/JRE
export THREADS_FLAG=native
export TEMP=/tmp
export TMPDIR=/tmp
export NLS_LANG=american_america.zhs16cgb231280
export ODBCINI=/app/configinfo/odbc.ini這個(gè)問(wèn)題,沒(méi)有哪位高手遇到過(guò)嗎?
--------------------------------------------------------------------------------
關(guān)鍵詞標(biāo)簽:oracle 11g,mysql,異構(gòu)
相關(guān)閱讀
熱門文章 Oracle中使用alter table來(lái)增加,刪除,修改列的語(yǔ)法 oracle中使用SQL語(yǔ)句修改字段類型-oracle修改SQL語(yǔ)句案例 誤刪Oracle數(shù)據(jù)庫(kù)實(shí)例的控制文件 為UNIX服務(wù)器設(shè)置Oracle全文檢索
人氣排行 oracle中使用SQL語(yǔ)句修改字段類型-oracle修改SQL語(yǔ)句案例 Oracle中使用alter table來(lái)增加,刪除,修改列的語(yǔ)法 ORACLE SQL 判斷字符串是否為數(shù)字的語(yǔ)句 ORACLE和SQL語(yǔ)法區(qū)別歸納(1) oracle grant 授權(quán)語(yǔ)句 ORACLE修改IP地址后如何能夠使用 如何加速Oracle大批量數(shù)據(jù)處理 Oracle刪除表的幾種方法