干货 | Oracle通过dblink连接GBase 8a MPP Cluster
说明
GBase 8a MPP Cluster是南大通用公司自主研发的大规模分布式分析型数据库,由于具备列存储、压缩、智能索引和分布式计算等特点,在统计分析场景上性能卓越。那么经过GBase 8a数据库分析完的数据如何返回到oracle数据库中,再进行其他处理呢,这是许多客户提出的问题。这里介绍通过Oracle的dblink连接GBase 8a MPP Cluster的操作方法,希望能对有这种需求的客户有所帮助。
感谢学友IT小Chen(网名chenoracle)总结整理!
原文请看ITPUB博客:http://blog.itpub.net/29785807/viewspace-2691054/
文章内容已在如下环境上测试:
源端:
Oracle版本:Oracle 11.2.0.3.0
OS版本:Redhat 7.5 IP:192.168.38.20
目标端:
GBase版本:GBase8a_MPP_Cluster-NoLicense-FREE-8.6.2_build43-R7
OS版本:Redhat 7.5 IP:192.168.38.10
相关关键字:GBase 8a MPP Cluster、dblink、oracle、数据迁移
一
Oracle端安装gateway
说明:Oracle 11.2.0.3.0默认安装了gateway
[oracle@cjcos02 hs]$ pwd
/u01/app/oracle/product/11.2.0/db_1/hs
查看gateway信息
[oracle@cjcos02 hs]$ dg4odbc
Oracle Corporation --- SATURDAY MAY 09 2020 15:07:10.503
Heterogeneous Agent Release 11.2.0.3.0 - 64bit Production Built with
Oracle Database Gateway for ODBC
二
Oracle端安装GBase ODBC
GBase ODBC下载地址:
http://www.gbase8a.com/forum.php?mod=viewthread&tdtype=document&tid=1319
安装:
[root@cjcos02 odbc]# rpm -ivh GBaseODBC-8.3.81.53-build53.17-redhat7-x86_64.rpm
Preparing... ################################# [100%]
Updating / installing...
1:gbaseodbc-8.3-53.17 ################################# [100%]
三
Oracle端配置odbcinst.in
[root@cjcos02 odbc]# vim /etc/odbcinst.ini
[GBase ODBC 8.3 Driver]
Driver=/usr/lib64/libgsodbc8.so
UsageCount=1
DontDLClose=1
Threading=0
四
Oracle端配置GBase ODBC数据源
4.1 查看配置文件位置
[root@cjcos02 odbc]# odbcinst -j
unixODBC 2.3.1
DRIVERS............: /etc/odbcinst.ini
SYSTEM DATA SOURCES: /etc/odbc.ini
FILE DATA SOURCES..: /etc/ODBCDataSources
USER DATA SOURCES..: /root/.odbc.ini
SQLULEN Size.......: 8
SQLLEN Size........: 8
SQLSETPOSIROW Size.: 8
4.2 配置odbc.in
[root@cjcos02 odbc]# vim /etc/odbc.ini
[gbase]
Description = ODBC for GBase
Driver = GBase ODBC 8.3 Driver
Server = 192.168.38.10
Port = 5258
UID = cjc
Password = cjc
Database = cjcdb
五
验证ODBC连接
[root@cjcos02 odbc]# isql gbase
SQL> select version();
SQL> select * from t1;
六
配置tnsnames.ora
[oracle@cjcos02 ~]$ cd $ORACLE_HOME/network/admin
[oracle@cjcos02 admin]$ vim tnsnames.ora
[oracle@cjcos02 admin]$ tnsping gbase
七
配置listener.ora
[oracle@cjcos02 admin]$ vim listener.ora
[oracle@cjcos02 admin]$ lsnrctl reload
[oracle@cjcos02 admin]$ lsnrctl status
八
配置initgbase.ora
[oracle@cjcos02 admin]$ pwd
/u01/app/oracle/product/11.2.0/db_1/hs/admin
[oracle@cjcos02 admin]$ vim initgbase.ora
HS_FDS_CONNECT_INFO = gbase
HS_FDS_TRACE_LEVEL = 0
HS_FDS_SHAREABLE_NAME=/usr/lib64/libodbc.so
HS_FDS_SUPPORT_STATISTICS=FALSE
HS_LANGUAGE=AMERICAN_AMERICA.WE8ISO8859P15
set ODBCINI = /etc/odbc.ini
九
创建dblink
SQL> create public database link gbase connect to "cjc" identified by "cjc" using 'gbase';
Database link created.
十
验证数据
Oracle端:
[oracle@cjcos02 ~]$ sqlplus / as sysdba
SQL> select * from t1@gbase;
GBase端:
[gbase@cjcos01 ~]$ gccli -ucjc -p
gbase> use cjcdb;
gbase> select * from t1;
十一
常见错误
如下报错一般都是initgbase.ora配置问题,添加HS_FDS_SHAREABLE_NAME参数即可。
SQL> select * from t1@gbase;
select * from t1@gbase
*
ERROR at line 1:
ORA-28500: connection from ORACLE to a non-Oracle system returned this message:
ORA-02063: preceding line from GBASE
Oracle停库时报错ORA-01097,切换会话后之前的会话会自动提交或回滚,再执行停库命令。
SQL> shutdown immediate
ORA-01097: cannot shutdown while in a transaction - commit or rollback first
切换会话
SQL> conn / as sysdba
Connected.
SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
以上就是Oracle通过dblink连接GBase 8a MPP Cluster的操作说明,希望能帮助有此需求的用户。
THE END