docker搭建oracle-12c
docker的安装太简单了就不说了哈。centos7搭建docker,docker搭建oracle-12c1、修改镜像下载地址。因为是国内的所以我修改了国内的镜像下载源地址。vi /etc/docker/daemon.json[root@k8s-client1 ~]# cat/etc/docker/daemon.json{"registry-m...
·
docker的安装太简单了就不说了哈。
centos7搭建docker,docker搭建oracle-12c
1、修改镜像下载地址。
因为是国内的所以我修改了国内的镜像下载源地址。
vi /etc/docker/daemon.json
[root@k8s-client1 ~]# cat /etc/docker/daemon.json
{
"registry-mirrors": ["http://hub-mirror.c.163.com"]
}
2、下载镜像文件。
2.1 查询镜像#docker search oracle
docker pull docker.io/truevoly/oracle-12c
下载好了使用docker images查看
3、启动数据库
3.1 启动前注意内容大小。我这里用了8G,
3.2 注意硬盘大小至少需要4G的预留
docker run -d -p 8080:8080 -p 1521:1521 docker.io/truevoly/oracle-12c
[root@k8s-client1 ~]# docker logs -f fafcbedc8b85
Database not initialized. Initializing database.
mv: cannot remove '/u01/app/oracle-product/12.1.0/xe/dbs/init.ora': No such file or directory
Starting tnslsnr
Copying database files
1% complete
3% complete
11% complete
18% complete
26% complete
37% complete
Creating and starting Oracle instance
40% complete
45% complete
50% complete
55% complete
56% complete
60% complete
62% complete
Completing Database Creation
66% complete
70% complete
73% complete
85% complete
96% complete
100% complete
Look at the log file "/u01/app/oracle/cfgtoollogs/dbca/xe/xe.log" for further details.
Configuring Apex console
Database initialized. Please visit http://#containeer:8080/em http://#containeer:8080/apex for extra configuration if needed
Starting web management console
PL/SQL procedure successfully completed.
Starting import from '/docker-entrypoint-initdb.d':
ls: cannot access /docker-entrypoint-initdb.d/*: No such file or directory
Import finished
Database ready to use. Enjoy! ;)
4、验证数据库可用性
查看容器的ID
[root@k8s-client1 ~]# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
fafcbedc8b85 docker.io/truevoly/oracle-12c "/entrypoint.sh " 20 minutes ago Up 20 minutes 0.0.0.0:1521->1521/tcp, 0.0.0.0:8080->8080/tcp gracious_newton
进入容器
[root@k8s-client1 ~]# docker exec -it fafcbedc8b85 /bin/bash
root@fafcbedc8b85:/#
切换数据库用户
root@fafcbedc8b85:/# su oracle
oracle@fafcbedc8b85:/$
进入数据库
oracle@fafcbedc8b85:/$ $ORACLE_HOME/bin/sqlplus / as sysdba
SQL*Plus: Release 12.1.0.2.0 Production on Mon Apr 13 12:38:44 2020
Copyright (c) 1982, 2014, Oracle. All rights reserved.
Connected to:
Oracle Database 12c Standard Edition Release 12.1.0.2.0 - 64bit Production
SQL>
查看数据库状态
SQL> select status from v$instance;
STATUS
------------
OPEN
更多推荐
已为社区贡献2条内容
所有评论(0)