1.安装oracle
1 2 3
| docker pull registry.cn-hangzhou.aliyuncs.com/helowin/oracle_11g --pull 镜像(6个多G)
docker run -d --restart=always -p 1521:1521 -v /data/oracle:/data/oracle --name oracle11 registry.cn-hangzhou.aliyuncs.com/helowin/oracle_11g --运行oracle镜像并映射本地1521端口;
|
2.配置oracle
docker exec -it oracle11 /bin/bash --进入容器;
配置环境变量,使用root 用户(密码:helowin)登录su root
,配置vi /etc/profile
,增加以下内容:
1 2 3
| 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 加载环境变量;
su - oracle 切换到oracle用户下执行数据库相关用户的修改与配置信息的修改;
1 2
| sqlplus /nolog conn /as sysdba
|
1 2 3 4 5 6 7 8
| alter user system identified by system_password; alter user sys identified by sys_password;
create user yan_test identified by yan_test; grant connect,resource,dba to yan_test;
ALTER PROFILE DEFAULT LIMIT PASSWORD_LIFE_TIME UNLIMITED; alter system set processes=1000 scope=spfile;
|
3.修改以上信息后,需要重新启动数据库;
1 2
| shutdown immediate; startup;
|
退出docker后可使用pl/sql等客户端工具进行测试。