docker安装oracle 并持久化
500 500 是容器内 oracle 组和用户的 id。服务名:helowin(一定要填写helowin)用户名:system 第10步设置的用户)密码:123456(第10步设置的密码)su root (密码:helowin)(镜像有点大,喝杯水等待一会)
1、拉取阿里镜像
(镜像有点大,喝杯水等待一会)
docker pull registry.cn-hangzhou.aliyuncs.com/helowin/oracle_11g
2、创建初始化数据
#容器启动
docker run -di --name test --restart=always \
-p 1521:1521 registry.cn-hangzhou.aliyuncs.com/helowin/oracle_11g
# 创建文件夹
mkdir -p /opt/oracle
#复制文件出来
docker cp test:/home/oracle/app/ /opt/oracledocker cp test:/etc/profile /opt/oracle/
cd /opt/oracle
# 500 500 是容器内 oracle 组和用户的 id
chown -R 500.500 app
# 删除容器
docker rm -f test
3、创建启动容器 数据持久化
docker run -d -p 1521:1521 -v /opt/oracle/app:/home/oracle/app \
-v /opt/oracle/profile:/etc/profile \
--restart=always --name oracle11g registry.cn-hangzhou.aliyuncs.com/helowin/oracle_11g
4、初始化数据库
docker exec -it oracle /bin/bash
5、切换到root用户下进行配置
su root (密码:helowin)
6、编辑profile文件配置ORACLE环境变量
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
7、创建软连接
ln -s $ORACLE_HOME/bin/sqlplus /usr/bin
8、切换到oracle 用户
su - oracle
9、登录sqlplus并修改sys、system用户密码
sqlplus /nolog conn /as sysdba
10、修改sys、system用户密码并刷新权限
alter user system identified by 123456; alter user sys identified by 123456; ALTER PROFILE DEFAULT LIMIT PASSWORD_LIFE_TIME UNLIMITED; exit 退出
11、查看一下oracle实例状态
12、用nacivat连接oracle数据库
服务名:helowin(一定要填写helowin)
用户名:system 第10步设置的用户)
密码:123456(第10步设置的密码)

魔乐社区(Modelers.cn) 是一个中立、公益的人工智能社区,提供人工智能工具、模型、数据的托管、展示与应用协同服务,为人工智能开发及爱好者搭建开放的学习交流平台。社区通过理事会方式运作,由全产业链共同建设、共同运营、共同享有,推动国产AI生态繁荣发展。
更多推荐
所有评论(0)