一、下载安装
1.拉取oracle10g镜像文件
docker pull klwang/oracle10g
2.创建挂载目录
mkdir -p /data/oracle10g
zxf@localhost ~ % docker pull klwang/oracle10g
Using default tag: latest
latest: Pulling from klwang/oracle10g
5ca2aa5da8d0: Pull complete
81110e1397c3: Pull complete
4a552ea58738: Pull complete
5ecaf6bea0a0: Pull complete
554a510d8df2: Pull complete
e8c8de872efe: Pull complete
5034ae262ba7: Pull complete
059d412332e3: Pull complete
6d6db9548b56: Pull complete
8606ecb90028: Pull complete
2fff9f6a28f2: Pull complete
27cc13605f01: Pull complete
164f839d2487: Pull complete
d041766813d3: Pull complete
4d20517db246: Pull complete
39ac323009d8: Pull complete
0ee67c277538: Pull complete
cb15c4f2c120: Pull complete
170d8a9ed275: Pull complete
f2283460a1f5: Pull complete
29f60975837c: Pull complete
a533c931fcf4: Pull complete
272d6257cd65: Pull complete
8f727f91e5c0: Pull complete
5bad9864884a: Pull complete
ef3d9b37793a: Pull complete
a9ee3bef4cd1: Pull complete
209c10b13bcc: Pull complete
1ecd33015acc: Pull complete
1b4bab436b09: Pull complete
a52ec06155b6: Pull complete
4be8175a8276: Pull complete
53567594475a: Pull complete
bf2f860e7dbd: Pull complete
Digest: sha256:ad22acf62df91024a6920a2d94396835af3a93bb766bf1aaf638b1c5c7ed7bd2
Status: Downloaded newer image for klwang/oracle10g:latest
docker.io/klwang/oracle10g:latest
zxf@localhost ~ %
3.创建oracle容器
docker run -d -p 1521:1521 -v data/oracle10g:/data/oracle --name zxforacle10g klwang/oracle10g
4.进入容器
docker exec -it zxforacle10g bash
5.切换到oracle 用户
su - oracle
6.登录oracle
sqlplus / as sysdba
conn /as sysdba
7.查询
show parameter password
8.检查有哪些用户
select * from v$pwfile_users;
9.授权
grant sysdba to sys;
10.创建内部管理员账号,创建一个用户名为test的用户,密码为 J0W3gMbnk_F
create user test identified by J0W3gMbnk_F;
11.将dba权限授权给内部管理员账号
grant connect,resource,dba to test;
12.修改密码规则策略为密码永不过期
ALTER PROFILE DEFAULT LIMIT PASSWORD_LIFE_TIME UNLIMITED;
13.修改数据库最大连接数据;
alter system set processes=1000 scope=spfile;
14.关闭数据库
shutdown immediate;
15.启动数据库
startup;
二、连接
1.查看当前登录数据库的参数配置
SQL> show parameter name
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
db_file_name_convert string
db_name string orcl
db_unique_name string orcl
global_names boolean FALSE
instance_name string orcl
lock_name_space string
log_file_name_convert string
service_names string orcl
2.客户端链接(本地)
3.外部连接容器内的数据库
sqlplus test/J0W3gMbnk_F@IP:1521/orcl AS SYSDBA
注意:此处访问宿主机端口为1521,容器内部是1521,端口器映射,系统管理员密码为J0W3gMbnk_F