docker run -d -p 1521:1521 --name oracle11g registry.cn-hangzhou.aliyuncs.com/helowin/oracle_11g
启动容器
docker start oracle11g
进入容器进行配置(使用bash打开)
docker exec -it oracle11g bash
配置环境变量(否则无法使用sqlplus , 外部也无法连接上)
#切换到root用户
su root
#password: helowin
#> 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
#中间加-,则是切换到oracle的同时,将环境(当前目录、环境变量等也切换到oracle用户上,否则,找不到sqlplus)
连接数据库
sqlplus / as sysdba;
alter user system identified by system;
alter user sys identified by sys;
# 将 sys 和 system 用户授权为 sysdba
grant sysdba to sys,system;