SlideShare ist ein Scribd-Unternehmen logo
1 von 11
Downloaden Sie, um offline zu lesen
DATABASE LINK FROM ORACLE TO MYSQL
Introduction
This document describe steps to create database link between oracle to MySQL (Heterogeneous
Services) / Oracle Gateway, Regarding to Oracle Documentation Gateways will integrate with any
number of non-Oracle systems from an Oracle application.
Environment:-
Operating System: Solaris 11.1
Database: - 11.2.0.3
In my case Grid Infrastructure installed on both node, so I choose one node to configure database link.
Software Needed:-
1- UnixODBC (Generic), Download From here.
2- MySQL ODBC/Connector, Download From Here.
Notes:-
Command Line will be in Red Color.
Output for command Line will be in Blue Color.
DATABASE LINK FROM ORACLE TO MYSQL
About the Author
Osama Mustafa has progressive experience in Oracle Products, community. He recently served as
Oracle Database Administrator.
Provide Database Implementation Solutions, High Availability Solution, Infrastructure and Storage
Planning, Install, Configure, Implement and manage Oracle E-Business Suite environments. Architect,
build and support highly-available Oracle EBS, Database and Fusion Middleware environments including
appropriate reporting, Installs, configures, upgrades, tunes, and maintains production, development and
test databases.
He entered Oracle ACE Program in 2013, he is author for the book Oracle Penetration Testing, Osama
Mustafa Certified OCP 10g,11g, Linux Implementations , Certified Ethical hacker and LPT , and Solaris
Administrator.
Include to all this Osama Mustafa is international Speaker in Oracle User Group and Oracle OTN Tour,
Published Online Articles in His blog about Oracle Technology.
Twitter: @OsamaOracle
G+: Osama Mustafa
SlidShare: Osama Mustafa
LinkedIn: http://www.linkedin.com/in/osamamustafa
Blog: https://osamamustafa.blogpsot.com.
DATABASE LINK FROM ORACLE TO MYSQL
To start Configure Database Link you need to follow the below steps first, to make easier I already upload
the necessary files you will need on my account here: -
https://github.com/OsamaOracle/db4odbc.git
You Can Download it and Change Path depend on files and Library Locations, You can create your entire
in Listener.ora and Tnsnames.ora but Sometimes problem related to space and “(“ “)” will show up.
Step #1:-
Determine Version for dg4odbc on Operating system using
file $ORACLE_HOME/bin/dg4odbc
ELF 64-bit LSB executable, Intel x86-64, version 1 (SYSV), for GNU/Linux 2.6.9, dynamically
linked (uses shared libs), for GNU/Linux 2.6.9, not stripped
This Command Explain which version of ODBC Driver I should use Which 64 bit.
Step #2:-
(This step should be done as root user).
It’s Time to Download and Install unixODBC, I will assume you already download the file and upload to
the server, I am using Solaris 11.2 but as I already mentioned before I will build unixODBC manually
therefore I will not use unixODBC.pkg.
In the website http://unixODBC.org they already mentioned step to configure it but I will re mention it here
again.
I prefer to setup and configure unixODBC under /usr/local/unixODBC.
Installation Steps:-
# unzip unixODBC.
DATABASE LINK FROM ORACLE TO MYSQL
# cd UnixODBC.
# export CFLAGS="-m64"
# ./configure --prefix=/usr/local/unixODBC
# make
# make install
Step #3:-
(As Oracle User).
Now unixODBC installed and configured under /usr/local/unixODBC, Next Step Download MySQL ODBC
Connecter, Choose the right one for your OS depend on MySQL Version.
Upload connector to the server and unzip it only (without do anything else) under /u01/app/oracle/.
Step #4:-
(As Oracle User).
Export Variables.
In Linux  .bash_profile
In Solairs  .profile
First Variable:-
export LD_LIBRARY_PATH=
/u01/app/oracle/product/11.2.0/db_home1/lib32:/usr/local/unixODBC/lib/:/u01/app/oracle/mysql-
connector-odbc-5.1.6-solaris11-x86-32bit/lib/libmyodbc5.so
Second Variable:-
export ODBCINI=/usr/local/unixODBC/etc/odbc.ini
export ODBCSYSINI= /usr/local/unixODBC/etc
This step is very important and without will cause problem with Library.
DATABASE LINK FROM ORACLE TO MYSQL
Step #5:-
( As Root User ).
Configure odbc.ini located in ( /usr/local/unixODBC/etc ), the file should look like the below :-
[DSN-NAME]
Driver = /u01/app/oracle/mysql-connector-odbc-3.51.30-solaris10-sparc-64bit/lib/libmyodbc3.so
DATABASE = <MySQL-Database-name>
DESCRIPTION = MySQL ODBC 5.2.5 Connector Sample
PORT =<listing Port for MySQL> Default 3306
SERVER = < MySQL Server IP >
UID= username
PWD = password (should be complex).
Option=3
Examples:-
[MySQL]
Driver = /u01/app/oracle/mysql-connector-odbc-3.51.30-solaris10-sparc-
64bit/lib/libmyodbc3.so
DATABASE = 4s
DESCRIPTION = MySQL ODBC 5.2.5 Connector Sample
PORT = 3306
SERVER = 172.16.2.120
UID= root
PWD = Osama123
Option=3
It’s configured.
DATABASE LINK FROM ORACLE TO MYSQL
Step #6:-
I choose to put this as steps because it will avoid time wasting which library test.
As Oracle User:-
# ldd libmyodbc3.so
The output will be like:-
libsocket.so.1 => /lib/64/libsocket.so.1
libnsl.so.1 => /lib/64/libnsl.so.1
libm.so.2 => /lib/64/libm.so.2
librt.so.1 => /lib/64/librt.so.1
libz.so.1 => /lib/64/libz.so.1
libodbcinst.so.1 => /usr/lib/64/libodbcinst.so.1
libdl.so.1 => /lib/64/libdl.so.1
libthread.so.1 => /lib/64/libthread.so.1
libc.so.1 => /lib/64/libc.so.1
libmp.so.2 => /lib/64/libmp.so.2
libmd.so.1 => /lib/64/libmd.so.1
libltdl.so.7 => /usr/lib/64/libltdl.so.7
libpthread.so.1 => /lib/64/libpthread.so.1
libcryptoutil.so.1 => /lib/64/libcryptoutil.so.1
/lib/sparcv9/../libm/sparcv9/libm_hwcap1.so.2
The Most Important thing in the above output to check if there is nothing in library “Not Found”
Step #7:-
(As oracle User).
DATABASE LINK FROM ORACLE TO MYSQL
Test connection using odbc only, Only on OS Level, go the /usr/local/unixODBC/bin.
# ./isql –v [DSN-NAME]
Example:-
# ./isql –v MySQL.
The below is output:-
+---------------------------------------+
| Connected! |
| |
| sql-statement |
| help [tablename] |
| quit |
| |
+---------------------------------------+
SQL>
Until this step you didn’t do anything only configure odbc, next step will explain how to configure Oracle.
Step #8:-
DATABASE LINK FROM ORACLE TO MYSQL
Configuration for Oracle Start with initSID.ora file. Oracle already create template located in
$ORACLE_HOME/hs/admin just copy with new name, the default one initdg4odbc.ora you can leave
without change and edit it.
Edit the file and set the new variables like the below:-
#
#HS init parameters
#
HS_FDS_CONNECT_INFO= [DSN_NAME]  same as odbc.ini
HS_FDS_TRACE_LEVEL= DEBUG  Trace level.
HS_FDS_SHAREABLE_NAME= /usr/local/unixODBC/lib/libodbc.so
HS_FDS_SUPPORT_STATISTICS= FALSE
HS_LANGUAGE=AMERICAN_AMERICA.WE8ISO8859P1
#HS_NLS_DATE_FORMAT=YYYY-MM-DD
#
# ODBC specific environment variables
#
set ODBCINI=/usr/local/unixODBC/etc/odbc.ini
Example:-
#
#HS init parameters
#
HS_FDS_CONNECT_INFO= MySQL
HS_FDS_TRACE_LEVEL= off
HS_FDS_SHAREABLE_NAME= /usr/local/unixODBC/lib/libodbc.so
HS_FDS_SUPPORT_STATISTICS= FALSE
HS_LANGUAGE=AMERICAN_AMERICA.WE8ISO8859P1
#HS_NLS_DATE_FORMAT=YYYY-MM-DD
#
# ODBC specific environment variables
#
set ODBCINI=/usr/local/unixODBC/etc/odbc.ini
Step #9:
DATABASE LINK FROM ORACLE TO MYSQL
This Step will describe how to configure Listener.ora, You can download Listener.ora and copy/Paste the
entire to make sure there’s nothing wrong or you can create your own.
Open Listener.ora and add the below line depend on your Configuration :-
SID_LIST_LISTENER=
(SID_LIST=
(SID_DESC=
(SID_NAME=dg4odbc)
(ORACLE_HOME=/u01/app/oracle/product/11.2.0/db_home1)
(ENVS=LD_LIBRARY_PATH=/usr/local/unixODBC/lib:/u01/app/oracle/product/11.2.0/db_home1
/lib:/u01/app/oracle/mysql-connector-odbc-3.51.30-solaris10-sparc-64bit/lib)
(PROGRAM=dg4odbc)
)
)
Some Notes about the above:-
1- SID_LIST_LISTENER  Indicate to your LISTENER NAME.
2- SID_NAME= Depend init….ora file.
3- Change ORACLE_HOME.
4- LD_LIBRARY_PATH Depend where you installed unixODBC and MySQL connecter.
5- Program Indicate to init…ora name.
Now After edit Listener.ora Save it, this step require to restart Listener.ora
LSNRCTL > stop LISTENER
LSNRCTL > Start LISTENER
Output:-
DATABASE LINK FROM ORACLE TO MYSQL
Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Solaris: Version 11.2.0.3.0 - Production
Start Date 16-JUN-2014 15:51:47
Uptime 0 days 1 hr. 50 min. 11 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /u01/app/11.2.0/grid/network/admin/listener.ora
Listener Log File /u01/app/grid/diag/tnslsnr/Node1/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=LISTENER)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=Node1)(PORT=1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=Node2)(PORT=1521)))
Services Summary...
Service "+ASM" has 1 instance(s).
Instance "+ASM1", status READY, has 1 handler(s) for this service...
Service "PRDSBL" has 1 instance(s).
Instance "PRDSBL1", status READY, has 1 handler(s) for this service...
Service "PRDSBLXDB" has 1 instance(s).
Instance "PRDSBL1", status READY, has 1 handler(s) for this service...
Service "dg4odbc" has 1 instance(s).
Instance "dg4odbc", status UNKNOWN, has 1 handler(s) for this service...
The command completed successfully
Step #10:-
Finally add new entire to tnsnames.ora
dg4odbc =
(DESCRIPTION=
(ADDRESS=(PROTOCOL=tcp)(HOST=sbl-prd-db1)(PORT=1521))
(CONNECT_DATA=(SID=dg4odbc))
(HS=OK)
)
tnsping dg4odbc should work.
Step #11:-
DATABASE LINK FROM ORACLE TO MYSQL
SQL > create public database link <DB-LINK-NAME> connect "usename" identified by "password" using
'odbc';
Notes:
1- Username & password should be the same as odbc.ini ( in my case root and Osama123);
2- Tnsnames.ora should be the same as entire in tnsnames.ora.
Now Test it :-
SQL > Select * from “Table-name”@DB-Link
Reference:-
 How to Resolve Common Errors Encountered while using Database Gateways (DG4IFMX,
Dg4MSQL, DG4SYBS), DG4ODBC or Generic Connectivity (Doc ID 234517.1)
 Database Gateway and Generic Connectivity (DG4ODBC) Licensing Considerations (Doc ID
232482.1)
 Gateway Configuration Utility for Database Gateway for ODBC - DG4ODBC - to Connect to Non-
Oracle Databases For Example - DB2, SQL*Server, Sybase, Informix, MySQL (Doc ID 1274143.1)
 Master Note for Oracle Gateway Products (Doc ID 1083703.1)
 What Are The Options To Connect From Oracle Via a Database Link Using DG4ODBC To MySQL
Using An ODBC Driver? (Doc ID 1526864.1)
Thank you
Osama Mustafa
Oracle ACE.

Weitere ähnliche Inhalte

Was ist angesagt?

Oracle 10g Performance: chapter 02 aas
Oracle 10g Performance: chapter 02 aasOracle 10g Performance: chapter 02 aas
Oracle 10g Performance: chapter 02 aas
Kyle Hailey
 
Introduction to Redis
Introduction to RedisIntroduction to Redis
Introduction to Redis
TO THE NEW | Technology
 

Was ist angesagt? (20)

Basic oracle-database-administration
Basic oracle-database-administrationBasic oracle-database-administration
Basic oracle-database-administration
 
Step by Step to Install oracle grid 11.2.0.3 on solaris 11.1
Step by Step to Install oracle grid 11.2.0.3 on solaris 11.1Step by Step to Install oracle grid 11.2.0.3 on solaris 11.1
Step by Step to Install oracle grid 11.2.0.3 on solaris 11.1
 
Oracle 10g Performance: chapter 02 aas
Oracle 10g Performance: chapter 02 aasOracle 10g Performance: chapter 02 aas
Oracle 10g Performance: chapter 02 aas
 
Odi 12c-getting-started-guide-2032250
Odi 12c-getting-started-guide-2032250Odi 12c-getting-started-guide-2032250
Odi 12c-getting-started-guide-2032250
 
Step By Step to Install Oracle Business Intelligence
Step By Step to Install Oracle Business IntelligenceStep By Step to Install Oracle Business Intelligence
Step By Step to Install Oracle Business Intelligence
 
Overview of Microsoft Exchange Server
Overview of Microsoft Exchange ServerOverview of Microsoft Exchange Server
Overview of Microsoft Exchange Server
 
Oracle Real Application Clusters 19c- Best Practices and Internals- EMEA Tour...
Oracle Real Application Clusters 19c- Best Practices and Internals- EMEA Tour...Oracle Real Application Clusters 19c- Best Practices and Internals- EMEA Tour...
Oracle Real Application Clusters 19c- Best Practices and Internals- EMEA Tour...
 
Oracle REST Data Services Best Practices/ Overview
Oracle REST Data Services Best Practices/ OverviewOracle REST Data Services Best Practices/ Overview
Oracle REST Data Services Best Practices/ Overview
 
Data Guard Architecture & Setup
Data Guard Architecture & SetupData Guard Architecture & Setup
Data Guard Architecture & Setup
 
Introduction to Redis
Introduction to RedisIntroduction to Redis
Introduction to Redis
 
Make Your Application “Oracle RAC Ready” & Test For It
Make Your Application “Oracle RAC Ready” & Test For ItMake Your Application “Oracle RAC Ready” & Test For It
Make Your Application “Oracle RAC Ready” & Test For It
 
DB Time, Average Active Sessions, and ASH Math - Oracle performance fundamentals
DB Time, Average Active Sessions, and ASH Math - Oracle performance fundamentalsDB Time, Average Active Sessions, and ASH Math - Oracle performance fundamentals
DB Time, Average Active Sessions, and ASH Math - Oracle performance fundamentals
 
Linux
LinuxLinux
Linux
 
Learning sed and awk
Learning sed and awkLearning sed and awk
Learning sed and awk
 
Oracle EBS R12.2 - Deployment and System Administration
Oracle EBS R12.2 - Deployment and System AdministrationOracle EBS R12.2 - Deployment and System Administration
Oracle EBS R12.2 - Deployment and System Administration
 
Oracle RAC on Extended Distance Clusters - Presentation
Oracle RAC on Extended Distance Clusters - PresentationOracle RAC on Extended Distance Clusters - Presentation
Oracle RAC on Extended Distance Clusters - Presentation
 
Disaster Recovery with MySQL InnoDB ClusterSet - What is it and how do I use it?
Disaster Recovery with MySQL InnoDB ClusterSet - What is it and how do I use it?Disaster Recovery with MySQL InnoDB ClusterSet - What is it and how do I use it?
Disaster Recovery with MySQL InnoDB ClusterSet - What is it and how do I use it?
 
Oracle DBA
Oracle DBAOracle DBA
Oracle DBA
 
MySQL InnoDB Cluster - A complete High Availability solution for MySQL
MySQL InnoDB Cluster - A complete High Availability solution for MySQLMySQL InnoDB Cluster - A complete High Availability solution for MySQL
MySQL InnoDB Cluster - A complete High Availability solution for MySQL
 
AIOUG : OTNYathra - Troubleshooting and Diagnosing Oracle Database 12.2 and O...
AIOUG : OTNYathra - Troubleshooting and Diagnosing Oracle Database 12.2 and O...AIOUG : OTNYathra - Troubleshooting and Diagnosing Oracle Database 12.2 and O...
AIOUG : OTNYathra - Troubleshooting and Diagnosing Oracle Database 12.2 and O...
 

Andere mochten auch

Andere mochten auch (19)

How to add storage to esxi 5.5
How to add storage to esxi 5.5How to add storage to esxi 5.5
How to add storage to esxi 5.5
 
Erp installation r12.2
Erp installation r12.2Erp installation r12.2
Erp installation r12.2
 
J2ee user managment using dwh builder
J2ee user managment using dwh builderJ2ee user managment using dwh builder
J2ee user managment using dwh builder
 
Installing oracle timesten database On Linux
Installing oracle timesten database On Linux Installing oracle timesten database On Linux
Installing oracle timesten database On Linux
 
Enable Mobile Apps Designer in OBIEE
Enable Mobile Apps Designer in OBIEEEnable Mobile Apps Designer in OBIEE
Enable Mobile Apps Designer in OBIEE
 
Upgrade EBS DB from 11g to 12c.
Upgrade EBS DB from 11g to 12c.Upgrade EBS DB from 11g to 12c.
Upgrade EBS DB from 11g to 12c.
 
Install oracle solaris 11.2 using gui
Install oracle solaris 11.2 using guiInstall oracle solaris 11.2 using gui
Install oracle solaris 11.2 using gui
 
Oracle autovue
Oracle autovueOracle autovue
Oracle autovue
 
Discoverer 11.1.1.7 web logic (10.3.6) & ebs r12 12.1.3) implementation guide...
Discoverer 11.1.1.7 web logic (10.3.6) & ebs r12 12.1.3) implementation guide...Discoverer 11.1.1.7 web logic (10.3.6) & ebs r12 12.1.3) implementation guide...
Discoverer 11.1.1.7 web logic (10.3.6) & ebs r12 12.1.3) implementation guide...
 
Ebs clone r12.2.4
Ebs clone r12.2.4Ebs clone r12.2.4
Ebs clone r12.2.4
 
OBIA Installation
OBIA Installation OBIA Installation
OBIA Installation
 
Install oracle grid infrastructure on linux 6.6
Install oracle grid infrastructure on linux 6.6Install oracle grid infrastructure on linux 6.6
Install oracle grid infrastructure on linux 6.6
 
Install oracle siebel on windows 2008 r2
Install oracle siebel on windows 2008 r2Install oracle siebel on windows 2008 r2
Install oracle siebel on windows 2008 r2
 
How to apply new patch on siebel 8.2.2.4
How to apply new patch on siebel 8.2.2.4How to apply new patch on siebel 8.2.2.4
How to apply new patch on siebel 8.2.2.4
 
Oracle obia 11.1.1.10.1 installation
Oracle obia 11.1.1.10.1 installation Oracle obia 11.1.1.10.1 installation
Oracle obia 11.1.1.10.1 installation
 
Oracle Access Manager Overview
Oracle Access Manager OverviewOracle Access Manager Overview
Oracle Access Manager Overview
 
Deploy agent in em12c
Deploy agent in em12cDeploy agent in em12c
Deploy agent in em12c
 
Rac&asm
Rac&asmRac&asm
Rac&asm
 
Refresh development from productions
Refresh development from productionsRefresh development from productions
Refresh development from productions
 

Ähnlich wie Oracle to MySQL DatabaseLink

2nodesoracle12craconyourlaptopvirtualboxstepbystepguide1 0-130627143310-phpapp02
2nodesoracle12craconyourlaptopvirtualboxstepbystepguide1 0-130627143310-phpapp022nodesoracle12craconyourlaptopvirtualboxstepbystepguide1 0-130627143310-phpapp02
2nodesoracle12craconyourlaptopvirtualboxstepbystepguide1 0-130627143310-phpapp02
shaikyunus1980
 
Oracle 12c RAC On your laptop Step by Step Implementation Guide 1.0
Oracle 12c RAC On your laptop Step by Step Implementation Guide 1.0Oracle 12c RAC On your laptop Step by Step Implementation Guide 1.0
Oracle 12c RAC On your laptop Step by Step Implementation Guide 1.0
Yury Velikanov
 
Oracle olap-installation
Oracle olap-installationOracle olap-installation
Oracle olap-installation
Amit Sharma
 

Ähnlich wie Oracle to MySQL DatabaseLink (20)

Usage Note of Qt ODBC Database Access on Linux
Usage Note of Qt ODBC Database Access on LinuxUsage Note of Qt ODBC Database Access on Linux
Usage Note of Qt ODBC Database Access on Linux
 
RAC 12c
RAC 12cRAC 12c
RAC 12c
 
2nodesoracle12craconyourlaptopvirtualboxstepbystepguide1 0-130627143310-phpapp02
2nodesoracle12craconyourlaptopvirtualboxstepbystepguide1 0-130627143310-phpapp022nodesoracle12craconyourlaptopvirtualboxstepbystepguide1 0-130627143310-phpapp02
2nodesoracle12craconyourlaptopvirtualboxstepbystepguide1 0-130627143310-phpapp02
 
Using microsoft odbc and oracle gateway
Using microsoft odbc and oracle gatewayUsing microsoft odbc and oracle gateway
Using microsoft odbc and oracle gateway
 
12c (12.1) Database installation on Solaris 11(11.2)
12c (12.1) Database  installation on Solaris 11(11.2)12c (12.1) Database  installation on Solaris 11(11.2)
12c (12.1) Database installation on Solaris 11(11.2)
 
Asian Spirit 3 Day Dba On Ubl
Asian Spirit 3 Day Dba On UblAsian Spirit 3 Day Dba On Ubl
Asian Spirit 3 Day Dba On Ubl
 
Installing oracle grid infrastructure and database 12c r1
Installing oracle grid infrastructure and database 12c r1Installing oracle grid infrastructure and database 12c r1
Installing oracle grid infrastructure and database 12c r1
 
Rac on NFS
Rac on NFSRac on NFS
Rac on NFS
 
Oracle 12c RAC On your laptop Step by Step Implementation Guide 1.0
Oracle 12c RAC On your laptop Step by Step Implementation Guide 1.0Oracle 12c RAC On your laptop Step by Step Implementation Guide 1.0
Oracle 12c RAC On your laptop Step by Step Implementation Guide 1.0
 
Oracle 12c Multi Process Multi Threaded
Oracle 12c Multi Process Multi ThreadedOracle 12c Multi Process Multi Threaded
Oracle 12c Multi Process Multi Threaded
 
Oracle 12cR2 RAC Database Software Installation and Create Database
Oracle 12cR2 RAC Database Software Installation and Create DatabaseOracle 12cR2 RAC Database Software Installation and Create Database
Oracle 12cR2 RAC Database Software Installation and Create Database
 
Create your oracle_apps_r12_lab_with_less_than_us1000
Create your oracle_apps_r12_lab_with_less_than_us1000Create your oracle_apps_r12_lab_with_less_than_us1000
Create your oracle_apps_r12_lab_with_less_than_us1000
 
My First 100 days with a MySQL DBMS (WP)
My First 100 days with a MySQL DBMS (WP)My First 100 days with a MySQL DBMS (WP)
My First 100 days with a MySQL DBMS (WP)
 
Oracle 11g R2 RAC setup on rhel 5.0
Oracle 11g R2 RAC setup on rhel 5.0Oracle 11g R2 RAC setup on rhel 5.0
Oracle 11g R2 RAC setup on rhel 5.0
 
BDM32: AdamCloud Project - Part II
BDM32: AdamCloud Project - Part IIBDM32: AdamCloud Project - Part II
BDM32: AdamCloud Project - Part II
 
Oracle olap-installation
Oracle olap-installationOracle olap-installation
Oracle olap-installation
 
Vbox virtual box在oracle linux 5 - shoug 梁洪响
Vbox virtual box在oracle linux 5 - shoug 梁洪响Vbox virtual box在oracle linux 5 - shoug 梁洪响
Vbox virtual box在oracle linux 5 - shoug 梁洪响
 
SULTHAN's PHP, MySQL & wordpress
SULTHAN's PHP, MySQL & wordpressSULTHAN's PHP, MySQL & wordpress
SULTHAN's PHP, MySQL & wordpress
 
MySQL JSON Functions
MySQL JSON FunctionsMySQL JSON Functions
MySQL JSON Functions
 
Mysql ppt
Mysql pptMysql ppt
Mysql ppt
 

Mehr von Osama Mustafa

Mehr von Osama Mustafa (15)

Case study for software architect
Case study for software architectCase study for software architect
Case study for software architect
 
DevOps for database
DevOps for databaseDevOps for database
DevOps for database
 
Does cloud mean the end of the dba
Does cloud mean the end of the dbaDoes cloud mean the end of the dba
Does cloud mean the end of the dba
 
Using git hub for your code
Using git hub for your codeUsing git hub for your code
Using git hub for your code
 
DevOps Project
DevOps Project DevOps Project
DevOps Project
 
Java business service
Java business serviceJava business service
Java business service
 
Steps creating data_integration_services
Steps creating data_integration_servicesSteps creating data_integration_services
Steps creating data_integration_services
 
Build, Deploy and Run Node Js Application on Azure using Docker
Build, Deploy and Run Node Js Application on Azure using DockerBuild, Deploy and Run Node Js Application on Azure using Docker
Build, Deploy and Run Node Js Application on Azure using Docker
 
Oracle api gateway installation as cluster and single node
Oracle api gateway installation as cluster and single nodeOracle api gateway installation as cluster and single node
Oracle api gateway installation as cluster and single node
 
Helping implementer dealing with famous siebel based system messages and er...
Helping implementer dealing with famous siebel   based system messages and er...Helping implementer dealing with famous siebel   based system messages and er...
Helping implementer dealing with famous siebel based system messages and er...
 
Weblogic and docker
Weblogic and dockerWeblogic and docker
Weblogic and docker
 
Weblogic 101 for dba
Weblogic  101 for dbaWeblogic  101 for dba
Weblogic 101 for dba
 
Oracle Enterprise manager 13c Installation
Oracle Enterprise manager 13c InstallationOracle Enterprise manager 13c Installation
Oracle Enterprise manager 13c Installation
 
Eouc 12 on 12c osama mustafa
Eouc 12 on 12c osama mustafaEouc 12 on 12c osama mustafa
Eouc 12 on 12c osama mustafa
 
12c on RHEL7
12c on RHEL712c on RHEL7
12c on RHEL7
 

Kürzlich hochgeladen

Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Victor Rentea
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Victor Rentea
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
WSO2
 

Kürzlich hochgeladen (20)

Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
Six Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal OntologySix Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal Ontology
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 

Oracle to MySQL DatabaseLink

  • 1. DATABASE LINK FROM ORACLE TO MYSQL Introduction This document describe steps to create database link between oracle to MySQL (Heterogeneous Services) / Oracle Gateway, Regarding to Oracle Documentation Gateways will integrate with any number of non-Oracle systems from an Oracle application. Environment:- Operating System: Solaris 11.1 Database: - 11.2.0.3 In my case Grid Infrastructure installed on both node, so I choose one node to configure database link. Software Needed:- 1- UnixODBC (Generic), Download From here. 2- MySQL ODBC/Connector, Download From Here. Notes:- Command Line will be in Red Color. Output for command Line will be in Blue Color.
  • 2. DATABASE LINK FROM ORACLE TO MYSQL About the Author Osama Mustafa has progressive experience in Oracle Products, community. He recently served as Oracle Database Administrator. Provide Database Implementation Solutions, High Availability Solution, Infrastructure and Storage Planning, Install, Configure, Implement and manage Oracle E-Business Suite environments. Architect, build and support highly-available Oracle EBS, Database and Fusion Middleware environments including appropriate reporting, Installs, configures, upgrades, tunes, and maintains production, development and test databases. He entered Oracle ACE Program in 2013, he is author for the book Oracle Penetration Testing, Osama Mustafa Certified OCP 10g,11g, Linux Implementations , Certified Ethical hacker and LPT , and Solaris Administrator. Include to all this Osama Mustafa is international Speaker in Oracle User Group and Oracle OTN Tour, Published Online Articles in His blog about Oracle Technology. Twitter: @OsamaOracle G+: Osama Mustafa SlidShare: Osama Mustafa LinkedIn: http://www.linkedin.com/in/osamamustafa Blog: https://osamamustafa.blogpsot.com.
  • 3. DATABASE LINK FROM ORACLE TO MYSQL To start Configure Database Link you need to follow the below steps first, to make easier I already upload the necessary files you will need on my account here: - https://github.com/OsamaOracle/db4odbc.git You Can Download it and Change Path depend on files and Library Locations, You can create your entire in Listener.ora and Tnsnames.ora but Sometimes problem related to space and “(“ “)” will show up. Step #1:- Determine Version for dg4odbc on Operating system using file $ORACLE_HOME/bin/dg4odbc ELF 64-bit LSB executable, Intel x86-64, version 1 (SYSV), for GNU/Linux 2.6.9, dynamically linked (uses shared libs), for GNU/Linux 2.6.9, not stripped This Command Explain which version of ODBC Driver I should use Which 64 bit. Step #2:- (This step should be done as root user). It’s Time to Download and Install unixODBC, I will assume you already download the file and upload to the server, I am using Solaris 11.2 but as I already mentioned before I will build unixODBC manually therefore I will not use unixODBC.pkg. In the website http://unixODBC.org they already mentioned step to configure it but I will re mention it here again. I prefer to setup and configure unixODBC under /usr/local/unixODBC. Installation Steps:- # unzip unixODBC.
  • 4. DATABASE LINK FROM ORACLE TO MYSQL # cd UnixODBC. # export CFLAGS="-m64" # ./configure --prefix=/usr/local/unixODBC # make # make install Step #3:- (As Oracle User). Now unixODBC installed and configured under /usr/local/unixODBC, Next Step Download MySQL ODBC Connecter, Choose the right one for your OS depend on MySQL Version. Upload connector to the server and unzip it only (without do anything else) under /u01/app/oracle/. Step #4:- (As Oracle User). Export Variables. In Linux  .bash_profile In Solairs  .profile First Variable:- export LD_LIBRARY_PATH= /u01/app/oracle/product/11.2.0/db_home1/lib32:/usr/local/unixODBC/lib/:/u01/app/oracle/mysql- connector-odbc-5.1.6-solaris11-x86-32bit/lib/libmyodbc5.so Second Variable:- export ODBCINI=/usr/local/unixODBC/etc/odbc.ini export ODBCSYSINI= /usr/local/unixODBC/etc This step is very important and without will cause problem with Library.
  • 5. DATABASE LINK FROM ORACLE TO MYSQL Step #5:- ( As Root User ). Configure odbc.ini located in ( /usr/local/unixODBC/etc ), the file should look like the below :- [DSN-NAME] Driver = /u01/app/oracle/mysql-connector-odbc-3.51.30-solaris10-sparc-64bit/lib/libmyodbc3.so DATABASE = <MySQL-Database-name> DESCRIPTION = MySQL ODBC 5.2.5 Connector Sample PORT =<listing Port for MySQL> Default 3306 SERVER = < MySQL Server IP > UID= username PWD = password (should be complex). Option=3 Examples:- [MySQL] Driver = /u01/app/oracle/mysql-connector-odbc-3.51.30-solaris10-sparc- 64bit/lib/libmyodbc3.so DATABASE = 4s DESCRIPTION = MySQL ODBC 5.2.5 Connector Sample PORT = 3306 SERVER = 172.16.2.120 UID= root PWD = Osama123 Option=3 It’s configured.
  • 6. DATABASE LINK FROM ORACLE TO MYSQL Step #6:- I choose to put this as steps because it will avoid time wasting which library test. As Oracle User:- # ldd libmyodbc3.so The output will be like:- libsocket.so.1 => /lib/64/libsocket.so.1 libnsl.so.1 => /lib/64/libnsl.so.1 libm.so.2 => /lib/64/libm.so.2 librt.so.1 => /lib/64/librt.so.1 libz.so.1 => /lib/64/libz.so.1 libodbcinst.so.1 => /usr/lib/64/libodbcinst.so.1 libdl.so.1 => /lib/64/libdl.so.1 libthread.so.1 => /lib/64/libthread.so.1 libc.so.1 => /lib/64/libc.so.1 libmp.so.2 => /lib/64/libmp.so.2 libmd.so.1 => /lib/64/libmd.so.1 libltdl.so.7 => /usr/lib/64/libltdl.so.7 libpthread.so.1 => /lib/64/libpthread.so.1 libcryptoutil.so.1 => /lib/64/libcryptoutil.so.1 /lib/sparcv9/../libm/sparcv9/libm_hwcap1.so.2 The Most Important thing in the above output to check if there is nothing in library “Not Found” Step #7:- (As oracle User).
  • 7. DATABASE LINK FROM ORACLE TO MYSQL Test connection using odbc only, Only on OS Level, go the /usr/local/unixODBC/bin. # ./isql –v [DSN-NAME] Example:- # ./isql –v MySQL. The below is output:- +---------------------------------------+ | Connected! | | | | sql-statement | | help [tablename] | | quit | | | +---------------------------------------+ SQL> Until this step you didn’t do anything only configure odbc, next step will explain how to configure Oracle. Step #8:-
  • 8. DATABASE LINK FROM ORACLE TO MYSQL Configuration for Oracle Start with initSID.ora file. Oracle already create template located in $ORACLE_HOME/hs/admin just copy with new name, the default one initdg4odbc.ora you can leave without change and edit it. Edit the file and set the new variables like the below:- # #HS init parameters # HS_FDS_CONNECT_INFO= [DSN_NAME]  same as odbc.ini HS_FDS_TRACE_LEVEL= DEBUG  Trace level. HS_FDS_SHAREABLE_NAME= /usr/local/unixODBC/lib/libodbc.so HS_FDS_SUPPORT_STATISTICS= FALSE HS_LANGUAGE=AMERICAN_AMERICA.WE8ISO8859P1 #HS_NLS_DATE_FORMAT=YYYY-MM-DD # # ODBC specific environment variables # set ODBCINI=/usr/local/unixODBC/etc/odbc.ini Example:- # #HS init parameters # HS_FDS_CONNECT_INFO= MySQL HS_FDS_TRACE_LEVEL= off HS_FDS_SHAREABLE_NAME= /usr/local/unixODBC/lib/libodbc.so HS_FDS_SUPPORT_STATISTICS= FALSE HS_LANGUAGE=AMERICAN_AMERICA.WE8ISO8859P1 #HS_NLS_DATE_FORMAT=YYYY-MM-DD # # ODBC specific environment variables # set ODBCINI=/usr/local/unixODBC/etc/odbc.ini Step #9:
  • 9. DATABASE LINK FROM ORACLE TO MYSQL This Step will describe how to configure Listener.ora, You can download Listener.ora and copy/Paste the entire to make sure there’s nothing wrong or you can create your own. Open Listener.ora and add the below line depend on your Configuration :- SID_LIST_LISTENER= (SID_LIST= (SID_DESC= (SID_NAME=dg4odbc) (ORACLE_HOME=/u01/app/oracle/product/11.2.0/db_home1) (ENVS=LD_LIBRARY_PATH=/usr/local/unixODBC/lib:/u01/app/oracle/product/11.2.0/db_home1 /lib:/u01/app/oracle/mysql-connector-odbc-3.51.30-solaris10-sparc-64bit/lib) (PROGRAM=dg4odbc) ) ) Some Notes about the above:- 1- SID_LIST_LISTENER  Indicate to your LISTENER NAME. 2- SID_NAME= Depend init….ora file. 3- Change ORACLE_HOME. 4- LD_LIBRARY_PATH Depend where you installed unixODBC and MySQL connecter. 5- Program Indicate to init…ora name. Now After edit Listener.ora Save it, this step require to restart Listener.ora LSNRCTL > stop LISTENER LSNRCTL > Start LISTENER Output:-
  • 10. DATABASE LINK FROM ORACLE TO MYSQL Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521)) STATUS of the LISTENER ------------------------ Alias LISTENER Version TNSLSNR for Solaris: Version 11.2.0.3.0 - Production Start Date 16-JUN-2014 15:51:47 Uptime 0 days 1 hr. 50 min. 11 sec Trace Level off Security ON: Local OS Authentication SNMP OFF Listener Parameter File /u01/app/11.2.0/grid/network/admin/listener.ora Listener Log File /u01/app/grid/diag/tnslsnr/Node1/listener/alert/log.xml Listening Endpoints Summary... (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=LISTENER))) (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=Node1)(PORT=1521))) (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=Node2)(PORT=1521))) Services Summary... Service "+ASM" has 1 instance(s). Instance "+ASM1", status READY, has 1 handler(s) for this service... Service "PRDSBL" has 1 instance(s). Instance "PRDSBL1", status READY, has 1 handler(s) for this service... Service "PRDSBLXDB" has 1 instance(s). Instance "PRDSBL1", status READY, has 1 handler(s) for this service... Service "dg4odbc" has 1 instance(s). Instance "dg4odbc", status UNKNOWN, has 1 handler(s) for this service... The command completed successfully Step #10:- Finally add new entire to tnsnames.ora dg4odbc = (DESCRIPTION= (ADDRESS=(PROTOCOL=tcp)(HOST=sbl-prd-db1)(PORT=1521)) (CONNECT_DATA=(SID=dg4odbc)) (HS=OK) ) tnsping dg4odbc should work. Step #11:-
  • 11. DATABASE LINK FROM ORACLE TO MYSQL SQL > create public database link <DB-LINK-NAME> connect "usename" identified by "password" using 'odbc'; Notes: 1- Username & password should be the same as odbc.ini ( in my case root and Osama123); 2- Tnsnames.ora should be the same as entire in tnsnames.ora. Now Test it :- SQL > Select * from “Table-name”@DB-Link Reference:-  How to Resolve Common Errors Encountered while using Database Gateways (DG4IFMX, Dg4MSQL, DG4SYBS), DG4ODBC or Generic Connectivity (Doc ID 234517.1)  Database Gateway and Generic Connectivity (DG4ODBC) Licensing Considerations (Doc ID 232482.1)  Gateway Configuration Utility for Database Gateway for ODBC - DG4ODBC - to Connect to Non- Oracle Databases For Example - DB2, SQL*Server, Sybase, Informix, MySQL (Doc ID 1274143.1)  Master Note for Oracle Gateway Products (Doc ID 1083703.1)  What Are The Options To Connect From Oracle Via a Database Link Using DG4ODBC To MySQL Using An ODBC Driver? (Doc ID 1526864.1) Thank you Osama Mustafa Oracle ACE.