BlueXIII's Blog

热爱技术,持续学习

0%

Docker安装OracleExpress

GitHub地址

https://github.com/wnameless/docker-oracle-xe-11g

安装

Ubuntu 16.04环境:

1
docker pull wnameless/oracle-xe-11g:16.04

Ubuntu 18.04环境:

1
docker pull wnameless/oracle-xe-11g

启动

1
2
docker run -d -p 10022:22 -p 1521:1521 -e ORACLE_ALLOW_REMOTE=true wnameless/oracle-xe-11g:16.04
docker run -d -p 10022:22 -p 1521:1521 -e ORACLE_ALLOW_REMOTE=true myoracle

开放22和1521端口

查看启动日志

1
docker logs -f c154cf832b7a1c77092b2cbe47457153bf853d223d861d0f1cac6af4f73e3ea1

sqlplus测试

Oracle默认连接参数:

1
2
3
4
5
hostname: localhost
port: 1521
sid: xe
username: system
password: oracle
1
2
3
4
5
6
7
本地连接
su - oracle
cd $ORACLE_HOME
bin/sqlplus / as sysdba

或远程连接
sqlplus system/oracle@127.0.0.1:1521/xe

SSH连接

1
2
ssh-copy-id -i -p10022 root@127.0.0.1   #admin
ssh root@127.0.0.1 -p 10022

docker exec连接

1
docker exec -it 5d9430198388 bash

挂载宿主磁盘

1
2
3
4
docker run -d -v /Users/bluexiii/extra/dump:/dump -p 10022:22 -p 1521:1521 -e ORACLE_ALLOW_REMOTE=true wnameless/oracle-xe-11g:16.04

docker run -d -v /Users/bluexiii/extra/dump:/dump -p 10022:22 -p 1521:1521 -e ORACLE_ALLOW_REMOTE=true myoracle

之后就可以impdp了

保存变更

1
2
docker diff 5d9430198388
docker commit 5d9430198388 myoracle

参考文档

https://my.oschina.net/Cleverdada/blog/801124
https://hacpai.com/article/1492914187689