侧边栏壁纸
  • 累计撰写 73 篇文章
  • 累计创建 30 个标签
  • 累计收到 0 条评论

目 录CONTENT

文章目录

Docker安装Oracle数据库

欧泡果奶
2022-03-19 / 0 评论 / 0 点赞 / 295 阅读 / 0 字

安装Oracle

1. 下载镜像

docker pull registry.cn-hangzhou.aliyuncs.com/helowin/oracle_11g

2. 创建相关文件夹

mkdir -p /opt/oracle

3. 运行oracle容器

docker run -d --restart=always -p 1521:1521 -v /opt/oracle:/data/oracle --name oracle registry.cn-hangzhou.aliyuncs.com/helowin/oracle_11g

默认实例名helowin,管理员默认密码helowin

配置Oracle

1. 进入容器

docker exec -it oracle /bin/bash

2. 进行软连接

2.1 切换到root用户

su root

密码helowin

2.2 配置环境变量

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

2.3 加载环境变量

source /etc/profile

2.4 创建软连接

ln -s $ORACLE_HOME/bin/sqlplus /usr/bin

2.5 切换到oracle 用户

su - oracle

注意:一定要写中间的那个 - 必须要,否则软连接无效

3. 登录sqlplus

sqlplus /nolog

conn /as sysdba

4. 修改sys、system用户密码

-- 修改system用户账号密码;
alter user system identified by system;
-- 修改sys用户账号密码;
alter user sys identified by system;
-- 创建用户账号密码
create user test identified by test;
-- 将dba权限授权给用户
grant connect,resource,dba to test;
-- 修改密码规则策略为密码永不过期;(会出现坑,后面讲解)
ALTER PROFILE DEFAULT LIMIT PASSWORD_LIFE_TIME UNLIMITED;
-- 修改数据库最大连接数据
alter system set processes=1000 scope=spfile;

5. 重启数据库

-- 关闭数据库
shutdown immediate;
-- 启动数据库
startup;
-- 退出
exit;
0

评论区