docker部署oracle
1获取阿里云的oracle镜像
docker pull registry.cn-hangzhou.aliyuncs.com/helowin/oracle_11g
2查看获取的镜像
docker images
3默认启动容器方式,选择一种
docker run -d -it -p 1521:1521 --name oracle11g --restart=always registry.cn-hangzhou.aliyuncs.com/helowin/oracle_11g
持久化启动方式如下:
docker run -d -it -p 1521:1521 --name oracle --restart=always --mount source=oracle_vol,target=/home/oracle/app/oracle/oradata registry.cn-hangzhou.aliyuncs.com/helowin/oracle_11g
4查看容器,容器状态up表示在运行状态
docker ps
5进入容器
docker exec -it 【容器id或名称】 bash
6切换到root账户(默认进入之后是oracle账户)
su root
输入密码:helowin(密码都是一样的)
7编辑环境变量
vi /etc/profile 添加以下内容:
export ORACLE_HOME=/home/oracle/app/oracle/product/11.2.0/dbhome_2
export ORACLE_SID=helowin
export PATH=$ORACLE_HOME/bin:$PATH
source /etc/profile 使配置生效
8创建软链接
ln -s $ORACLE_HOME/bin/sqlplus /usr/bin
9切换到oracle用户,登录sqlplus
su - oracle
sqlplus /nolog
conn /as sysdba
修改sys、system用户密码:
10修改sys、system用户密码:
alter user system identified by YOUR_PASSWORD;
alter user sys identified by YOUR_PASSWORD;
alter profile default limit PASSWORD_LIFE_TIME UNLIMITED;
11用工具连接
docker pull registry.cn-hangzhou.aliyuncs.com/helowin/oracle_11g