Linux Oracle has been widely used but is constantly updated. Here we will introduce how to install and use Linux Oracle to help you access MySQL through Linux Oracle some time before installing and updating the Linux Oracle System, test environment: CentOS5_X64, Oracle10g_X64, and MySQL5. Share some experiences with you!
1. First, install MySQL Client software on the computer where Linux Oracle is located, and install x86_64 and i386 versions to connect to the MySQL database. Check the Client installation status:
Rpm-qa | grep mysql
Mysql-5.0.45-7.el5
Mysql-5.0.45-7.el5
Two records, x86_64 and i386, are obtained.
If you see that the mysql client software has not been installed, you need to install:
Yum install mysql
Yum install mysql. i386
Verify that the computer on which the Linux Oracle is located can connect to the MySQL database of the target host:
Mysql-h 192.168.1.1-u root-p mysql
2. Check whether the MySQL ODBC client is installed on the Linux Oracle computer, and install the x86_64 and i386 versions. Rpm-qa | grep mysql-connect if mysql-connector-odbc is not installed, run the following command to download and install mysql-connector-odbc: wget ftp://mirror.switch.ch/pool/3/mirror/centos/5.2/ OS /i386/CentO S/mysql-connector-odbc-3.51.12-2.2.i386.rpm install mysql-connector-odbc: rpm-ivh mysql-connector-odbc-3.51.12-2.2.i386.rpm to get the prompt libltdl. so.3 is needed by mysql-connector-odbc-3.51.12-2.2.i386 and found that libtool's i386 version needs to be installed, so install the libtool-ltdl.i386 through the following command:
Yum list *. i386 | grep libtool
Yum install libtool-ltdl.i386
3. Edit the/etc/odbc. ini file on the computer where Oracle is located in Linux, and test ODBC operations vi/etc/odbc. ini # odbc. ini. The content is as follows:
- [test]
- Driver=/usr/lib64/libmyodbc3.so
- Description=MySQL
- Server=192.168.1.1(MySQL Server IP)
- Port=3306
- User= (MySQL Username)
- UID= (MySQL Username)
- Password= (MySQL PWD)
- Database= (MySQL Database Name)
- Option=3
- Socket=
If you run the following commands on the command line, you must be able to successfully log on to the MySQL Client window, proving that ODBC functions properly: isql-v testquit
4. Edit the hs configuration file vi/ora10g/hs/admin/inittest. ora. (Note that the blue part of the file name is the blue one in odbc. ini)
- HS_FDS_CONNECT_INFO=Test
- HS_FDS_TRACE_LEVEL=OnAfter formal use, set it to off when troubleshooting is not required)
- HS_FDS_TRACE_FILE_NAME=Test. Trc
- HS_FDS_SHAREABLE_NAME=/Usr/lib/libmydbc3.so
- SetODBCINI=/Etc/odbc. ini
5. Edit the configuration file of the Oracle listener on the computer where the Linux Oracle is located, create a listening method to simulate the Oracle Listener, and prepare for dblink creation in the future: vi/ora10g/network/admin/listener. add the following statement to ora:
- (SID_DESC =
- (SID_NAME = test)
- (ORACLE_HOME = /ora10g)
- (PROGRAM = hsodbc)
- (ENVS=LD_LIBRARY_PATH=/ora10g/lib32:/usr/lib64:/ora10g/lib)
The current content of the listener. ora file is changed:
- SID_LIST_LISTENER = (
- SID_LIST =
- (SID_DESC =
- (ORACLE_HOME = /ora10g)
- (PROGRAM = extproc)
- (GLOBAL_DBNAME=prod)
- (SID_NAME=prod)
- (SID_DESC =
- (SID_NAME = test)
- (ORACLE_HOME = /ora10g)
- (PROGRAM = hsodbc)
- (ENVS=LD_LIBRARY_PATH=/ora10g/lib32:/usr/lib64:/ora10g/lib)
- LISTENER =
- (DESCRIPTION_LIST =
- (DESCRIPTION = (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1)
- (ADDRESS = (PROTOCOL = TCP)(HOST = 0.0.0.0)(PORT = 1521)
Execute lsnrctl reload to make Listener take effect:
- su – oracle
- lsnrctl reload
- LSNRCTL for Linux: Version 10.2.0.4.0 - Production on 09-FEB-2009 13:59:38 Copyright (c) 1991, 2007, Oracle.
- All rights reserved. Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1)))
- The command completed successfully
- lsnrctl status
- LSNRCTL for Linux: Version 10.2.0.4.0 - Production on 12-FEB-2009 08:56:00
- Copyright (c) 1991, 2007, Oracle.All rights reserved.
- Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1)))
- STATUS of the LISTENER
- AliasLISTENER
- Version TNSLSNR for Linux: Version 10.2.0.4.0 - Production
- Start Date 03-JAN-2009 03:47:39
- Uptime40 days 5 hr. 8 min. 20 sec
- Trace Leveloff
- SecurityON: Local OS Authentication
- SNMP OFF
- Listener Parameter File/ora10g/network/admin/listener.ora
- Listener Log File/ora10g/network/log/listener.log
- Listening Endpoints Summary...
- (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1)))
- (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=0.0.0.0)(PORT=1521)))
- Services Summary...
- Service "PLSExtProc" has 1 instance(s).
- Instance "PLSExtProc", status UNKNOWN, has 1 handler(s) for this service...
- Service "test" has 1 instance(s).
- Instance "test", status UNKNOWN, has 1 handler(s) for this service...
- The command completed successfully
6. Edit the tnsnames. ora file on the computer where Linux Oracle is located to create a dblink. Note: This tnsnames configuration supports tnsping, but does not support sqlplus logon. It is only used for dblink: vi/ora10g/network/admin/tnsnames. ora
- test =
- (DESCRIPTION =
- (ADDRESS = (PROTOCOL = TCP)(HOST = 127.0.0.1)(PORT = 1521))
- (CONNECT_DATA =
- (SID = test)
- (HS = OK)
7. Create a dblink in Oracle Database:
- create public database link MYSQL
- connect to "mysql username" identified by "mysql pwd"
- using '(DESCRIPTION =
- (ADDRESS = (PROTOCOL = TCP) (HOST = 127.0.0.1) (PORT =1521) )
- (CONNECT_DATA = (SID= test) )
- (HS=OK)
Note that double quotation marks are required for the user name and password. Otherwise, all characters transmitted in Linux Oracle are uppercase letters, and you may not be able to log on to MySQL.
8. Because the table name in MySQL is case-sensitive, double quotation marks must be used to expand the table name during SQL queries.
Select * from "tablename" @ test
- Linux Oracle 10 Gb software installation database
- Linux Oracle can be installed on WMware virtual machines
- Linux mount Command System mounting and image processing
- Linux vmstat process information and memory information
- Linux PHP compilation and generation extension and Configuration Modification