数据库
首页 > 数据库> > Docker-安装使用Oracle 11g

Docker-安装使用Oracle 11g

作者:互联网

1、安装Docker

2、Docker仓库搜索Oracle 11g镜像

look@lookdeMacBook-Pro ~ % docker search docker-oracle-xe-11g
NAME                                 DESCRIPTION                                     STARS     OFFICIAL   AUTOMATED
deepdiver/docker-oracle-xe-11g                                                       41                   [OK]
epiclabs/docker-oracle-xe-11g        Customized Oracle XE 11g build for CI and de…   22                   [OK]
pengbai/docker-oracle-xe-11g-r2      oracle xe 11g r2 with sql initdb and web con…   10                   [OK]
arahman/docker-oracle-xe-11g         phusion/baseimage based spin off of alexei-l…   9                    [OK]
konnecteam/docker-oracle-xe-11g      Fork of https://github.com/wnameless/docker-…   4                    [OK]
rafaelri/docker-oracle-xe-11g        Fork from wnameless/docker-oracle-xe-11g        3                    [OK]
ignatov/docker-oracle-xe-11g         Dockerfile of Oracle Database Express Editio…   3                    [OK]
gswteam/docker-oracle-xe-11g         Oracle XE 11g                                   0                    [OK]
nguoianphu/docker-oracle-xe-11g      Oracle Express Edition 11g Release 2 on Ubun…   0                    [OK]
jeromefromcn/docker-oracle-xe-11g    docker-oracle-xe-11g                            0                    [OK]
zzzfree/docker-oracle-xe-11g         docker-oracle-xe-11g                            0                    [OK]
lynxsolutions/docker-oracle-xe-11g   docker-oracle-xe-11g                            0                    [OK]
deadok22/docker-oracle-xe-11g        docker-oracle-xe-11g                            0                    
dbanttari/docker-oracle-xe-11g       Branch of wnameless/docker-oracle-xe-11g tha…   0                    [OK]
rdehuyss/docker-oracle-xe-11g        Oracle Express 11g R2 on Ubuntu 14.04.2 LTS     0                    [OK]
xtechnologies/docker-oracle-xe-11g   docker-oracle-xe-11g                            0                    [OK]
bizybot/docker-oracle-xe-11g         wnameless/docker-oracle-xe-11g                  0                    [OK]
cheyu0325/docker-oracle-xe-11g       docker-oracle-xe-11g                            0                    
kikicarbonell/docker-oracle-xe-11g   Docker image of Oracle Database Express Edit…   0                    [OK]
zigac/docker-oracle-xe-11g           Oracle xe 11g                                   0                    [OK]
ceagan/docker-oracle-xe-11g          Modified version of wnameless/docker-oracle-…   0                    [OK]
dockerbolcom/docker-oracle-xe-11g    Fork of https://github.com/wnameless/docker-…   0                    [OK]
demers/docker-oracle-xe-11g-spark    Oracle XE 11g with Spark                        0                    
gmartsenkov/docker-oracle-xe-11g     oracle                                          0                    [OK]
demers/docker-oracle-xe-11g          Docker Oracle 11g XE with Java 13 and Python…   0                    

3、选择一个想要的Oracle 11g版本拉取下来

docker pull deepdiver/docker-oracle-xe-11g

4、启动镜像

docker run -h "oracle" --name "oracle" -d -p 49160:22 -p 49161:1521 -p 49162:8080 deepdiver/docker-oracle-xe-11g

5、查看容器id并进入容器

look@lookdeMacBook-Pro ~ % docker ps -al
CONTAINER ID   IMAGE                            COMMAND                  CREATED         STATUS         PORTS                                                                     NAMES
35fd8ae5ce60   deepdiver/docker-oracle-xe-11g   "/bin/sh -c 'sed -i …"   2 minutes ago   Up 2 minutes   0.0.0.0:49160->22/tcp, 0.0.0.0:49161->1521/tcp, 0.0.0.0:49162->8080/tcp   oracle
look@lookdeMacBook-Pro ~ % docker exec -it 35fd8ae5ce60 /bin/bash

 6、通过sqlplu连接数据库。oracle的高级用户有两个 sys和system。在我pull的这个docker oracle 11g 的版本,密码都是oracle 

#用system用户登录数据库
sqlplus system/oracle
 

 7、创建一个用户并分配权限

-- 查看用户
select username,password from dba_users;

-- 创建用户
create user deque identified by 123;

-- 给新用户授权
grant connect,resource to deque; 

 8、用Navicat 连接 docker oracle 11g

    8.1 查看oracle 的映射端口。 0.0.0.0:49161-->1521 

    8.2 进入容器中查看oracle 的service_name

-- 查看容器ID
docker ps -l

CONTAINER ID   IMAGE                            COMMAND                  CREATED       STATUS       PORTS                                                                     NAMES
35fd8ae5ce60   deepdiver/docker-oracle-xe-11g   "/bin/sh -c 'sed -i …"   4 hours ago   Up 4 hours   0.0.0.0:49160->22/tcp, 0.0.0.0:49161->1521/tcp, 0.0.0.0:49162->8080/tcp   oracle

-- 进入容器
docker exec -it 35fd8ae5ce60 /bin/bash

-- sqlplus 登录 system用户
sqlplus system/oracle

-- 查看服务名
show parameter service

 

 9、其他:

-- 停止docker oracle服务
docker stop oracle

-- 启动docker oracle 服务
docker start oracle

 

 

 

 

参考:

  https://www.jianshu.com/p/b867263995b5

标签:11g,OK,0.0,xe,oracle,Oracle,Docker,docker
来源: https://www.cnblogs.com/happyflyingpig/p/15668607.html