この記事は約16分45秒で読むことができます。

docker oracle 19cr3 imageファイル作成

バイトサイズ確認!!!

imageファイル作成準備


[oracle@centos ~]$ cd /home/oracle/docker-images/OracleDatabase/SingleInstance/dockerfiles/19.3.0
[oracle@centos 19.3.0]$ ll
合計 2988076
-rw-r--r--. 1 oracle docker         63  5月  1 20:17 Checksum.ee
-rw-r--r--. 1 oracle docker         63  5月  1 20:17 Checksum.se2
-rw-r--r--. 1 oracle docker       3357  5月  1 20:17 Dockerfile
-rw-r--r--. 1 oracle docker 3059705302  5月  1 20:01 LINUX.X64_193000_db_home.zip
-rwxr-xr-x. 1 oracle docker       1050  5月  1 20:17 checkDBStatus.sh
-rwxr-xr-x. 1 oracle docker        905  5月  1 20:17 checkSpace.sh
-rwxr-xr-x. 1 oracle docker       3088  5月  1 20:17 createDB.sh
-rw-r--r--. 1 oracle docker       6878  5月  1 20:17 db_inst.rsp
-rw-r--r--. 1 oracle docker       9204  5月  1 20:17 dbca.rsp.tmpl
-rwxr-xr-x. 1 oracle docker       2526  5月  1 20:17 installDBBinaries.sh
-rwxr-xr-x. 1 oracle docker       6526  5月  1 20:17 runOracle.sh
-rwxr-xr-x. 1 oracle docker       1015  5月  1 20:17 runUserScripts.sh
-rwxr-xr-x. 1 oracle docker        758  5月  1 20:17 setPassword.sh
-rwxr-xr-x. 1 oracle docker        932  5月  1 20:17 setupLinuxEnv.sh
-rwxr-xr-x. 1 oracle docker        678  5月  1 20:17 startDB.sh

imageファイル作成


[oracle@centos 19.3.0]$ cd ..
[oracle@centos dockerfiles]$ ll
合計 32
drwxr-xr-x. 2 oracle docker 4096  5月  1 20:17 11.2.0.2
drwxr-xr-x. 2 oracle docker 4096  5月  1 20:17 12.1.0.2
drwxr-xr-x. 2 oracle docker 4096  5月  1 20:17 12.2.0.1
drwxr-xr-x. 2 oracle docker 4096  5月  1 20:17 18.3.0
drwxr-xr-x. 2 oracle docker 4096  5月  1 20:17 18.4.0
drwxr-xr-x. 2 oracle docker 4096  5月  1 20:20 19.3.0
-rwxr-xr-x. 1 oracle docker 5103  5月  1 20:17 buildDockerImage.sh
[oracle@centos dockerfiles]$ ./*sh -h

Usage: buildDockerImage.sh -v [version] [-e | -s | -x] [-i] [-o] [Docker build option]
Builds a Docker Image for Oracle Database.
  
Parameters:
   -v: version to build
       Choose one of: 11.2.0.2  12.1.0.2  12.2.0.1  18.3.0  18.4.0  19.3.0  
   -e: creates image based on 'Enterprise Edition'
   -s: creates image based on 'Standard Edition 2'
   -x: creates image based on 'Express Edition'
   -i: ignores the MD5 checksums
   -o: passes on Docker build option

* select one edition only: -e, -s, or -x

LICENSE UPL 1.0

Copyright (c) 2014-2019 Oracle and/or its affiliates. All rights reserved.
[oracle@centos dockerfiles]$ ./buildDockerImage.sh -i -v 19.3.0 -e
Successfully built 3c941f34e1d3
Successfully tagged oracle/database:19.3.0-ee


  Oracle Database Docker Image for 'ee' version 19.3.0 is ready to be extended: 
    
    --> oracle/database:19.3.0-ee

  Build completed in 346 seconds.
  

imageファイル作成結果

5分ぐらいかーはやい。。


[oracle@centos dockerfiles]$ docker images
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
oracle/database     19.3.0-ee           3c941f34e1d3        2 minutes ago       6.64GB
oraclelinux         7-slim              f7512ac13c1b        2 weeks ago         118MB

どうさ確認

sqlplusつなぐまで


[oracle@centos doclan]$ docker run -v /home/oracle/doclan:/mnt -v /home/oracle/doclan/19cr3/init:/docker-entrypoint-initdb.d/startup -d --name orcl_19cr3 --shm-size=4g -p 1521:1521 -p 5500:5500 -e TZ=Asia/Tokyo -e ORACLE_PWD=ORACLE_PWD -e ORACLE_SID=ORCL -e ORACLE_PDB=pdb1 oracle/database:19.3.0-ee
7347fe12d03f3a191c114d01043d3f72e473552f6f18df1d099f6117beb1c0a9
[oracle@centos doclan]$ docker ps -a
CONTAINER ID        IMAGE                       COMMAND                  CREATED             STATUS                    PORTS                                            NAMES
7347fe12d03f        oracle/database:19.3.0-ee   "/bin/sh -c 'exec $O…"   37 minutes ago      Up 37 minutes (healthy)   0.0.0.0:1521->1521/tcp, 0.0.0.0:5500->5500/tcp   orcl_19cr3
[oracle@centos doclan]$ docker exec -it orcl_19cr3 /bin/bash
[oracle@7347fe12d03f ~]$ sqlplus sys/ORACLE_PWD as sysdba

SQL*Plus: Release 19.0.0.0.0 - Production on Wed May 1 21:47:46 2019
Version 19.3.0.0.0

Copyright (c) 1982, 2019, Oracle.  All rights reserved.


Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.3.0.0.0

SQL> show pdbs

    CON_ID CON_NAME			  OPEN MODE  RESTRICTED
---------- ------------------------------ ---------- ----------
	 2 PDB$SEED			  READ ONLY  NO
	 3 PDB1 			  READ WRITE NO
SQL> select BANNER_FULL from v$version;

BANNER_FULL
--------------------------------------------------------------------------------
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.3.0.0.0

[oracle@7347fe12d03f ~]$ sqlplus sys/ORACLE_PWD@pdb1 as sysdba

SQL*Plus: Release 19.0.0.0.0 - Production on Wed May 1 21:52:12 2019
Version 19.3.0.0.0

Copyright (c) 1982, 2019, Oracle.  All rights reserved.


Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.3.0.0.0

SQL> show pdbs

    CON_ID CON_NAME			  OPEN MODE  RESTRICTED
---------- ------------------------------ ---------- ----------
	 3 PDB1 			  READ WRITE NO
SQL> select BANNER_FULL from v$version;

BANNER_FULL
--------------------------------------------------------------------------------
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.3.0.0.0

SQL> CREATE USER aine IDENTIFIED BY "ORACLE_PWD" DEFAULT TABLESPACE USERS TEMPORARY TABLESPACE temp;

User created.

SQL> GRANT dba TO aine;

Grant succeeded.

SQL> GRANT UNLIMITED TABLESPACE TO aine;

Grant succeeded.

[oracle@7347fe12d03f ~]$ sqlplus aine/ORACLE_PWD@pdb1

SQL*Plus: Release 19.0.0.0.0 - Production on Wed May 1 21:56:10 2019
Version 19.3.0.0.0

Copyright (c) 1982, 2019, Oracle.  All rights reserved.

Last Successful login time: Wed May 01 2019 21:55:13 +09:00

Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.3.0.0.0

SQL> DROP TABLE warehouse_mst PURGE;
CREATE TABLE warehouse_mst (
        warehouse_code                  VARCHAR2(24 BYTE)
        , shipping_permission_over_days   NUMBER
        , CONSTRAINT warehouse_mst_pk PRIMARY KEY ( warehouse_code )
);

INSERT INTO warehouse_mst (warehouse_code,shipping_permission_over_days) VALUES ('w_BS98',25);
INSERT INTO warehouse_mst (warehouse_code,shipping_permission_over_days) VALUES ('w_DIX4',28);
INSERT INTO warehouse_mst (warehouse_code,shipping_permission_over_days) VALUES ('w_C5MN',29);
COMMIT;
Table dropped.

SQL>   2    3    4    5  
Table created.

SQL> SQL> 
1 row created.

SQL> 
1 row created.

SQL> 
1 row created.

SQL> 

Commit complete.

SQL> select * from warehouse_mst;

WAREHOUSE_CODE		 SHIPPING_PERMISSION_OVER_DAYS
------------------------ -----------------------------
w_BS98						    25
w_DIX4						    28
w_C5MN						    29


Leave a Reply

Your email address will not be published. Required fields are marked *