본문 바로가기

개발도구/Docker

Docker Installation of Oracle Database 12c

$ docker pull absolutapps/oracle-12c-ee

$ docker run -d --name oracle-12cR1-ee --privileged absolutapps/oracle-12c-ee

$ docker logs -f oracle-12cR1-ee

ls: cannot access /u01/app/oracle/oradata/orcl: No such file or directory
No databases found in /u01/app/oracle/oradata/orcl. About to create a new database instance
Starting database listener

LSNRCTL for Linux: Version 12.1.0.2.0 - Production on 30-MAR-2018 16:34:46

Copyright (c) 1991, 2014, Oracle.  All rights reserved.

Starting /u01/app/oracle/product/12.1.0.2/dbhome_1/bin/tnslsnr: please wait...

TNSLSNR for Linux: Version 12.1.0.2.0 - Production
System parameter file is /u01/app/oracle/product/12.1.0.2/dbhome_1/network/admin/listener.ora
Log messages written to /u01/app/oracle/diag/tnslsnr/f4a900e3f987/listener/alert/log.xml
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=f4a900e3f987)(PORT=1521)))

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=f4a900e3f987)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 12.1.0.2.0 - Production
Start Date                30-MAR-2018 16:34:46
Uptime                    0 days 0 hr. 0 min. 0 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /u01/app/oracle/product/12.1.0.2/dbhome_1/network/admin/listener.ora
Listener Log File         /u01/app/oracle/diag/tnslsnr/f4a900e3f987/listener/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=f4a900e3f987)(PORT=1521)))
The listener supports no services
The command completed successfully
Copying database files
1% complete
3% complete
11% complete
18% complete
37% complete
Creating and starting Oracle instance
40% complete
45% complete
50% complete
55% complete
56% complete
60% complete
62% complete
Completing Database Creation
66% complete
70% complete
73% complete
85% complete
96% complete
100% complete
Look at the log file "/u01/app/oracle/cfgtoollogs/dbca/orcl/orcl.log" for further details.

LSNRCTL for Linux: Version 12.1.0.2.0 - Production on 30-MAR-2018 16:39:57

Copyright (c) 1991, 2014, Oracle.  All rights reserved.

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=f4a900e3f987)(PORT=1521)))
The command completed successfully
Database has been created in /u01/app/oracle/oradata/orcl
SYS and SYSTEM passwords are set to [oracle]
Setting HTTP port to 8080

PL/SQL procedure successfully completed.

Please login to http://:8080/em to use enterprise manager
User: sys; Password oracle; Sysdba: true
Fixing permissions...
Running init scripts...
Init scripts in /oracle.init.d/: Ignoring /oracle.init.d/*

Done with scripts we are ready to go

$ docker exec -it oracle-12cR1-ee /bin/bash

 

[root@f4a900e3f987 /]# echo $ORACLE_SID
orcl
[root@f4a900e3f987 /]# sqlplus system/oracle@//localhost:1521/orcl

SQL*Plus: Release 12.1.0.2.0 Production on Fri Mar 30 16:42:16 2018

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


Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options

SQL> desc v$instance
 Name					   Null?    Type
 ----------------------------------------- -------- ----------------------------
 INSTANCE_NUMBER				    NUMBER
 INSTANCE_NAME					    VARCHAR2(16)
 HOST_NAME					    VARCHAR2(64)
 VERSION					    VARCHAR2(17)
 STARTUP_TIME					    DATE
 STATUS 					    VARCHAR2(12)
 PARALLEL					    VARCHAR2(3)
 THREAD#					    NUMBER
 ARCHIVER					    VARCHAR2(7)
 LOG_SWITCH_WAIT				    VARCHAR2(15)
 LOGINS 					    VARCHAR2(10)
 SHUTDOWN_PENDING				    VARCHAR2(3)
 DATABASE_STATUS				    VARCHAR2(17)
 INSTANCE_ROLE					    VARCHAR2(18)
 ACTIVE_STATE					    VARCHAR2(9)
 BLOCKED					    VARCHAR2(3)
 CON_ID 					    NUMBER
 INSTANCE_MODE					    VARCHAR2(11)
 EDITION					    VARCHAR2(7)
 FAMILY 					    VARCHAR2(80)

SQL> select INSTANCE_NAME,HOST_NAME from v$instance;

INSTANCE_NAME
----------------
HOST_NAME
----------------------------------------------------------------
orcl
f4a900e3f987
SQL> select tablespace_name, file_name from dba_data_files;

TABLESPACE_NAME
------------------------------
FILE_NAME
--------------------------------------------------------------------------------
USERS
/u01/app/oracle/oradata/orcl/users01.dbf

UNDOTBS1
/u01/app/oracle/oradata/orcl/undotbs01.dbf

SYSTEM
/u01/app/oracle/oradata/orcl/system01.dbf


TABLESPACE_NAME
------------------------------
FILE_NAME
--------------------------------------------------------------------------------
SYSAUX
/u01/app/oracle/oradata/orcl/sysaux01.dbf

SQL> exit
Disconnected from Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options
[root@f4a900e3f987 /]# exit
exit
Alexs-MBP:~ alexlima$ docker container ls
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
f4a900e3f987 absolutapps/oracle-12c-ee "/entrypoint.sh" 12 minutes ago Up 12 minutes 1521/tcp, 5500/tcp, 8080/tcp oracle-12cR1-ee
Alexs-MBP:~ alexlima$ docker stop oracle-12cR1-ee
oracle-12cR1-ee
Alexs-MBP:~ alexlima$ docker container ls
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
Alexs-MBP:~ alexlima$ docker image ls
REPOSITORY TAG IMAGE ID CREATED SIZE
hello-world latest f2a91732366c 4 months ago 1.85kB
absolutapps/oracle-12c-ee latest ad9bdfc002e7 23 months ago 6.12GB

Alexs-MBP:~ alexlima$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
Alexs-MBP:~ alexlima$ docker start oracle-12cR1-ee
oracle-12cR1-ee
Alexs-MBP:~ alexlima$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
f4a900e3f987 absolutapps/oracle-12c-ee "/entrypoint.sh" 2 hours ago Up 7 seconds 1521/tcp, 5500/tcp, 8080/tcp oracle-12cR1-ee