1-1、docker run -d -p 11521:1521 --name sf2_oracle11g 镜像ID
# -p:端口映射,此处映射主机11521端口到容器sf2_oracle11g的1521端口
1-2、查看启动 docker logs -f 容器名
1-3、获取root用户权限,进入的CONTAINER name:sf2_oracle11
docker exec -it -u root sf2_oracle11g bash
1-4、切换到oracle用户权限,进入的CONTAINER name:sf2_oracle11
su – oracle
1-5、连接数据库
#进入sqlplus命令
#或$ORACLE_HOME/bin/sqlplus / as sysdba进入sqlplus命令
sqlplus /nolog
SQL> conn / as sysdba
Connected.
#当前用户
SQL> show user
USER 为 "SYS"
#当前数据库实例
SQL> show parameter instance_name
XE
#system identified by system
#system密码修改为system
SQL> alter user system identified by system;
User altered.
#sys密码修改为sys
SQL> alter user sys identified by sys;
User altered.
#新增用户ETS密码修改为ETS
SQL> create user ETS identified by ETS ;
User created.
SQL> grant connect,resource,dba to ETS ;
Grant succeeded.
1-6.配置本地tnsnames.ora文件
复制代码
LS =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST =192.168.131.131)(PORT = 11521))
)
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME =XE)
)
)
#PORT = 11521参考 1-1、
#SERVICE_NAME =XE 实例ID 参考 1-5 show parameter instance_name
参考https://www.cnblogs.com/OliverQin/p/9765808.html