Docker Oracle11g

Docker Oracle11g

安装 Docker

  1. docker pull wnameless/oracle-xe-11g

下载镜像

docker pull wnameless/oracle-xe-11g
Using default tag: latest
latest: Pulling from wnameless/oracle-xe-11g
a48c500ed24e: Pull complete
1e1de00ff7e1: Pull complete
0330ca45a200: Pull complete
471db38bcfbf: Pull complete
0b4aba487617: Pull complete
ae2e6e303543: Pull complete
e860d792de52: Pull complete
Digest: sha256:806c005a3d6af211e92b96015daaeefdcde53b7b6434d34353e620fb46ea7dad
Status: Downloaded newer image for wnameless/oracle-xe-11g:latest

查看当前镜像

root@debian:~# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
centos6/fake latest d9791d553a78 21 hours ago 1.33GB
wnameless/oracle-xe-11g latest 698cc7361de4 7 months ago 2.13GB
alexeiled/docker-oracle-xe-11g latest f7304758169d 2 years ago 2.39GB

以镜像wnameless/oracle-xe-11g 启动容器

docker run -d -p 9090:8080 -p 1521:1521 -3222:22 –name Oracle11g wnameless/oracle-xe-11g

查看容器是否运行

root@debian:~# docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
c9a88cc47e3b wnameless/oracle-xe-11g “/bin/sh -c ‘/usr/sb…” 3 seconds ago Up 3 seconds 0.0.0.0:1521->1521/tcp, 0.0.0.0:3122->22/tcp, 0.0.0.0:9090->8080/tcp Oracle11g
9fb4edcca9f2 centos6/fake “/bin/bash” 21 hours ago Up 21 hours 0.0.0.0:2233->22/tcp, 0.0.0.0:8080->80/tcp, 0.0.0.0:3388->3306/tcp CentOS6-LAMP-WEB

可以看到容器已成功运行 接下来连接容器:

root@debian:~# docker exec -ti c9a88cc47e3b bash

Oracle XE 使用

http://192.168.5.159:9090
username: ADMIN
password: Oracle_11g
or
username: system
password: oracle

条件环境变量:

  1. vim /root/.profile
  2. export ORACLE_HOME=/u01/app/oracle/product/11.2.0/xe
  3. export ORACLE_SID=hellooracle
  4. export PATH=$PATH:$ORACLE_HOME/bin
  5. source /root/.profile

进入 Oracle 用户 登陆数据库

su – oracle
sqlplus /nolog
SQL*Plus: Release 11.2.0.2.0 Production on Fri Dec 28 08:07:40 2018Copyright (c) 1982, 2011, Oracle. All rights reserved.

SQL> conn sys/sys as sysdba
Connected.

创建表空间

1 创建临时表

CREATE SMALLFILE TEMPORARY TABLESPACE “TS_MSG_TEMP” TEMPFILE ‘/u01/app/oracle/oradata/XE/TS_MSG_TEMP.dbf’ SIZE 1024M AUTOEXTEND ON NEXT 100M TABLESPACE GROUP “TS_MSG” EXTENT MANAGEMENT LOCAL UNIFORM;

2 创建永久表

CREATE SMALLFILE TABLESPACE “TS_MSG_D” DATAFILE ‘/u01/app/oracle/oradata/XE/TS_MSG_D.dbf’ SIZE 2048M AUTOEXTEND ON NEXT 100M LOGGING DEFAULT NOCOMPRESS ONLINE EXTENT MANAGEMENT LOCAL AUTOALLOCATE SEGMENT SPACE MANAGEMENT AUTO;

3 创建用户

create user USR_MSG IDENTIFIED BY asdf123123 default tablespace TS_MSG_D temporary tablespace TS_MSG_TEMP profile DEFAULT;

4 授权

  1. grant connect to USR_MSG;
  2. grant dba to USR_MSG;
  3. grant exp_full_database to USR_MSG;
  4. grant imp_full_database to USR_MSG;
  5. grant resource to USR_MSG;
  6. — Grant/Revoke system privileges
  7. grant select any table to USR_MSG;
  8. grant unlimited tablespace to USR_MSG;
  9. grant update any table to USR_MSG;

查询 oracle 服务名称

SQL> select instance_name from v$instance;

INSTANCE_NAME
—————-
XE

本地连接 Oracle
我是用的 Nacicat Premium

参考:https://github.com/wnameless/docker-oracle-xe-11g
https://blog.csdn.net/zhichunqi/article/details/80656780

发表回复

*您的电子邮件地址不会被公开。必填项已标记为 。

*
*