docker搭建oracle服务以及配置

140 阅读1分钟
#镜像下载
docker pull registry.cn-hangzhou.aliyuncs.com/helowin/oracle_11g
#创建容器
docker run -d -p 1521:1521 --name oracle11g registry.cn-hangzhou.aliyuncs.com/helowin/oracle_11g
#启动容器 
docker start oracle11g
#进入镜像进行配置
docker exec -it oracle11g bash

#发现没有这个命令,用不了、切换到root 用户下
su root
#密码
helowin

#编辑profile
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
保存退出

#创建软连接
ln -s $ORACLE_HOME/bin/sqlplus /usr/bin
#切换到oracle 用户  	一定要写中间的内条 -   必须要,否则软连接无效
su - oracle
#登录sqlplus并修改sys、system用户密码
sqlplus /nolog
conn /as sysdba
#创建用户
create user test identified by test;
#给用户赋予权限
grant connect,resource,dba to test;
#退出oracle
exit
#看oracle 的 lsnrctl 服务
lsnrctl status
之后就是连接数据库了