利用 docker 部署 oracle 11g
拉取镜像
docker pull sath89/oracle-xe-11g
创建实例
docker run -d --restart always -p 8080:8080 -p 1521:1521 -v /etc/localtime:/etc/localtime:ro -v /my/oracle/data:/u01/app/oracle sath89/oracle-xe-11g
<!–more–>
时间同步的参数详见: <http://jerry.red/453/docker-容器与宿主机时间不同步的解决办法>
连接信息
Connect database with following setting:
hostname: localhost
port: 1521
sid: xe
username: system
password: oracle
Password for SYS & SYSTEM:
oracle
Connect to Oracle Application Express web management console with following settings:
http://localhost:8080/apex
workspace: INTERNAL
user: ADMIN
password: oracle
镜像详情:<https://hub.docker.com/r/sath89/oracle-xe-11g/>,利用 daocloud.io 可加速拉取镜像。
安装 Oracle Instant Client
Install RPMs
- Download the Oracle Instantclient RPM files from http://www.oracle.com/technetwork/database/features/instant-client/index-097480.html. Everyone needs either "Basic" or "Basic lite", and most users will want "SQL*Plus" and the "SDK".
-
Convert these .rpm files into .deb packages and install using "alien" ("sudo apt-get install alien" if you don’t have it).
-
For example, for version 12.1.0.2.0-1 for Linux x86_64 (64-bit):
alien -i oracle-instantclient12.1-basic-12.1.0.2.0-1.x86_64.rpm
alien -i oracle-instantclient12.1-sqlplus-12.1.0.2.0-1.x86_64.rpm
alien -i oracle-instantclient12.1-devel-12.1.0.2.0-1.x86_64.rpm
- Test your Instantclient install by using "sqlplus" or "sqlplus64" to connect to your database:
sqlplus system/oracle@//localhost:1521/xe
If you execute sqlplus and get "sqlplus: command not found", see the section below about adding the ORACLE_HOME variable.
If sqlplus complains of a missing libsqlplus.so file, follow the steps in the section "Integrate Oracle Libraries" below.
If sqlplus complains of a missing libaio.so.1 file, run
sudo apt-get install libaio1
or, if you’re installing the 32 bit instant client on 64 bit,
sudo apt-get install libaio1:i386
Integrate Oracle Libraries
If oracle applications, such as sqlplus, are complaining about missing libraries, you can add it to the system library list create a new file as follows:
sudo vi /etc/ld.so.conf.d/oracle.conf && sudo chmod o+r /etc/ld.so.conf.d/oracle.conf
and add the oracle library path as the first line. For example,
/usr/lib/oracle/12.1/client64/lib/
Then run ldconfig:
sudo ldconfig
ORACLE_HOME
Many Oracle database applications look for Oracle software in the location specified in the environment variable ‘ORACLE_HOME’.
Typical workstations will only have one Oracle install, and will want to define this variable in a system-wide location.
sudo vi /etc/profile.d/oracle.sh && sudo chmod o+r /etc/profile.d/oracle.sh
Add the following:
export ORACLE_HOME=/usr/lib/oracle/12.1/client64
Alternatively, each user can define this in their ~/.bash_profile
Note: From Ubuntu 11.04 (confirmed in 11.04 and 14.04) sqlplus was not recognized as a command unless the following line was also included in the oracle.sh file:
export PATH=$PATH:$ORACLE_HOME/bin
更多详情:<https://help.ubuntu.com/community/Oracle%20Instant%20Client>