Docker安装Oracle11g

785 阅读1分钟

本文已参与「新人创作礼」活动,一起开启掘金创作之路。

一、拉取oracle_11g镜像

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

二、创建oracle容器

docker run -d -p 1521:1521 --name oracle11g registry.cn-hangzhou.aliyuncs.com/helowin/oracle_11g

三、查看容器是否启动成功

docker ps -s

四、容器配置

1、进入容器

docker exec -it oracle11g bash

2、切换到root用户,输入密码 helowin

su root

3、编辑profile文件配置ORACLE环境变量

vi /etc/profile

4、profile文件最后添加以下3行配置

export ORACLE_HOME=/home/oracle/app/oracle/product/11.2.0/dbhome_2
export ORACLE_SID=helowin
export PATH=$ORACLE_HOME/bin:$PATH

保存 ::wq 让配置生效:

source /etc/profile

5、创建软连接

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

6、切换到oracle 用户

su - oracle

7、登录sqlplus并修改sys、system用户密码

登录oracle数据库

sqlplus /nolog

切换管理用户

conn /as sysdba

修改system用户账号密码为system

alter user system identified by system;

修改sys用户账号密码为system

alter user sys identified by system;

创建新用户 test

create user test identified by test;

将dba权限授权给test账号

grant connect,resource,dba to test;

修改密码规则策略为密码永不过期

ALTER PROFILE DEFAULT LIMIT PASSWORD_LIFE_TIME UNLIMITED;

修改数据库最大连接数据

alter system set processes=2000 scope=spfile;

五、连接信息

连接类型: Basic 主机:你的ip 端口: 1521 服务名: helowin SID 用户名:test 密码:test