docker通过Dockerfile安装oracle-12c数据库

1、 克隆oracle的docker-imges仓库

git clone https://github.com/oracle/docker-images.git

2、从oracle官网下载orcale-12c 的linux压缩包 linuxx64_12201_database_4.zip

下载链接如下:

https://www.oracle.com/database/technologies/oracle-database-software-downloads.html

3、将linuxx64_12201_database_4.zip放入docker-images内的12.2.0.1文件夹内

路径如下:

docker-images/OracleDatabase/SingleInstance/dockerfiles/12.2.0.1

然后进入上一级目录,路径如下:

docker-images/OracleDatabase/SingleInstance/dockerfile

然后执行下列命令

./buildDockerImage.sh -v 12.2.0.1 -e

安装好后

docker运行容器

docker run   --name myoracle \
-p 1521:1521 -p 5500:5500 \
-e ORACLE_SID=orcl \
-e ORACLE_PDB=orclpdb1 \
-e ORACLE_PWD=123456 \
-e ORACLE_CHARACTERSET=al32utf8 \
-e ORACLE_BASE=/opt/oracle \
-e ORACLE_HOME=/opt/oracle/product/12.2.0.1/dbhome_1 \
-e PATH=/opt/oracle/product/12.2.0.1/dbhome_1/bin:/opt/oracle/product/12.2.0.1/dbhome_1/OPatch/:/usr/sbin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin \
-v /home/nicemoe/oradata:/opt/oracle/oradata \
oracle/database:12.2.0.1-ee

注意/home/nicemoe/oradata为自己创建orcale数据存放目录,注意更改合适权限

4、容器中的Oracle数据库还配置了Oracle Enterprise Manager Express。要访问OEM Express,请启动浏览器并按照以下URL进行操作:

https://localhost:5500/em/
用户名 system/sys等
口令 123456
容器名 orclpdb1

若要以sysdba身份登录:

用户名 sys
口令 123456
容器名 orclpdb1

5、修改密码

docker exec   ./setPassword.sh 
例如:

docker exec  d38c6077ec85 ./setPassword.sh 123456

6、登录数据库

进入环境

docker exec -it  /bin/bash

登录数据库

sqlplus sys/@//localhost:1521/ as sysdba
sqlplus system/@//localhost:1521/
sqlplus pdbadmin/@//localhost:1521/
例子:
sqlplus sys/123456@//localhost:1521/orcl as sysdba
sqlplus system/123456@//localhost:1521/orcl
sqlplus pdbadmin/123456@//localhost:1521/orclpdb1

 

你可能感兴趣的:(docker,docker,oracle)