Oracle 12c Release 2 の Docker を作成する

# 前置き

[SQL Server の Docker](https://qiita.com/manymanyuni/items/bb0feae228c57c599ccd) に続き Oracle の Docker を作成していきます。
intra-mart の検証用として利用したいので、Dockerfile の最後で検証用ユーザの作成も行います。
（[権限の付与や、intra-mart が要求するブロックサイズ(16KB), 自動セグメント領域管理の有効化も設定します](https://www.intra-mart.jp/download/product/iap/setup/iap_setup_guide/texts/install/common/database.html#oracle-database)）
これによって、Oracle 公式の Docker イメージと異なり、docker run 後何も考えずにすぐに検証用として利用できるような Oracle の環境が作れるようになります。

# Docker ベースイメージ(CentOS 6.9)

いつものようにベースイメージから作ります。
CentOS 6.9 を利用します。

```dockerfile:Dockerfile
FROM centos:centos6.9

EXPOSE 22

ENV DEBIAN_FRONTEND noninteractive

# yum
RUN yum -y update && yum clean all

# locale
RUN yum reinstall -y glibc-common
RUN localedef -i ja_JP -f UTF-8 ja_JP.utf8
RUN touch /etc/sysconfig/i18n
RUN echo 'LANG="ja_JP.UTF-8"' >> /etc/sysconfig/i18n
ENV LANG ja_JP.UTF-8
ENV LC_ALL ja_JP.UTF-8
ENV LANGUAGE ja_JP:ja

# timezone
RUN yum install -y tzdata
RUN echo 'ZONE="Asia/Tokyo"' > /etc/sysconfig/clock
RUN echo 'UTC=false' >> /etc/sysconfig/clock
RUN ln -sf /usr/share/zoneinfo/Asia/Tokyo /etc/localtime

# tools
RUN yum groupinstall -y 'Development Tools'
RUN yum install -y --enablerepo centosplus wget curl vim emacs tar unzip mlocate perl ssh openssh-server openssl-devel

# root passwd
RUN bash -c 'echo "root:password" | chpasswd'

# ssh
RUN sed -i -e "s/#PasswordAuthentication yes/PasswordAuthentication yes/g" /etc/ssh/sshd_config
RUN sed -i -e "s/#PermitRootLogin yes/PermitRootLogin yes/g" /etc/ssh/sshd_config
RUN sed -i -e "s/UsePAM yes/UsePAM no/g" /etc/ssh/sshd_config

RUN updatedb

CMD /etc/init.d/sshd restart && /bin/bash
```

locate コマンドが便利なので Dockerfile の最後に必ず入れるようにしてます。
やってるのはロケールとタイムゾーンと ssh を設定しているだけです。

# Docker Oracle 12c Release 2

さて次は Oracle 12c Release 2 の Docker です。
先ほどの CentOS 6.9 をベースイメージとして利用します。

Dockerfile 以外にも以下のファイルを用意します。

* create_user.sh
* create_user.sql
* db_install.rsp
* dbca.rsp
* Dockerfile
* drop_user.sh
* drop_user.sql
* netca.rsp
* run_server.sh
* setup_oracle.sh
* shutdown.sql
* shutdown_database.sh
* start_database.sh
* startup.sql

まずは Dockerfile から。

```dockerfile:Dockerfile
FROM mycentos:6.9

RUN yum -y update && yum clean all
RUN yum -y upgrade && yum -y update && yum clean all
RUN yum -y install elfutils-libelf-devel mksh unixODBC glibc.i686 libaio libaio-devel GeoIP bind-libs bind-license bind-utils compat-libcap1 compat-libstdc++-33 e2fsprogs-libs ethtool gssproxy hostname initscripts iproute iptables iputils keyutils ksh libICE libSM libX11 libX11-common libXau libXext libXi libXinerama libXmu libXrandr libXrender libXt libXtst libXv libXxf86dga libXxf86misc libXxf86vm libbasicobjects libcollection libdmx libevent libini_config libmnl libnetfilter_conntrack libnfnetlink libnfsidmap libpath_utils libref_array libtirpc libverto-libevent libxcb lm_sensors-libs mailx net-tools nfs-utils psmisc quota quota-nls rpcbind smartmontools sysstat sysvinit-tools tcp_wrappers xorg-x11-utils xorg-x11-xauth

ENV ORACLE_BASE /u01/app/oracle
ENV ORACLE_HOME ${ORACLE_BASE}/product/12.2.0/db_1
ENV PATH $ORACLE_HOME/bin:$PATH:$HOME/bin
ENV LD_LIBRARY_PATH $ORACLE_HOME/lib
ENV ORACLE_SID orcl
ENV NLS_LANG Japanese_Japan.UTF8

ADD startup.sql /startup.sql
ADD shutdown.sql /shutdown.sql
ADD create_user.sql /create_user.sql
ADD drop_user.sql /drop_user.sql

ADD start_database.sh /start_database.sh
ADD shutdown_database.sh /shutdown_database.sh
ADD create_user.sh /create_user.sh
ADD drop_user.sh /drop_user.sh
RUN chmod +x /start_database.sh
RUN chmod +x /shutdown_database.sh
RUN chmod +x /create_user.sh
RUN chmod +x /drop_user.sh
RUN ln -s /start_database.sh /root/start_database.sh
RUN ln -s /shutdown_database.sh /root/shutdown_database.sh
RUN ln -s /create_user.sh /root/create_user.sh
RUN ln -s /drop_user.sh /root/drop_user.sh

ADD run_server.sh /run_server.sh
RUN chmod +x /run_server.sh

# setup_oracle
ADD db_install.rsp /db_install.rsp
ADD dbca.rsp /dbca.rsp
ADD netca.rsp /netca.rsp
ADD setup_oracle.sh /setup_oracle.sh
RUN chmod +x /setup_oracle.sh
RUN /setup_oracle.sh
RUN rm -f /setup_oracle.sh
# RUN rm -f /netca.rsp
RUN rm -f /dbca.rsp
RUN rm -f /db_install.rsp

RUN ln -s /start_database.sh /home/oracle/start_database.sh
RUN ln -s /shutdown_database.sh /home/oracle/shutdown_database.sh

RUN updatedb

CMD ["/run_server.sh"]
```

Oracle のセットアップ等、複雑な物はシェルスクリプトに逃がし、Dockerfile からはそれを実行するようにします（Dockerfile がシンプルになる、かつイメージ容量の削減にもつながります）

続いて、Oracle のセットアップです。

```shell:setup_oracle.sh
#!/bin/sh

groupadd -g 54321 oinstall
groupadd -g 54322 dba
groupadd -g 54323 oper
groupadd -g 54324 backupdba
groupadd -g 54325 dgdba
groupadd -g 54326 kmdba
groupadd -g 54327 racdba
useradd -u 1200 -g oinstall -G dba,oper,backupdba,dgdba,kmdba,racdba -d /home/oracle oracle

# ulimit
ulimit -s 10240
ulimit -u unlimited
echo -e "*\tsoft\tstack\t10240" >> /etc/security/limits.conf
echo -e "*\tsoft\tnproc\tunlimited" >> /etc/security/limits.conf
echo "ulimit -s 10240" >> /root/.bashrc
echo "ulimit -u unlimited" >> /root/.bashrc
echo "ulimit -s 10240" >> /home/oracle/.bashrc
echo "ulimit -u unlimited" >> /home/oracle/.bashrc
echo "1048576" > /proc/sys/fs/aio-max-nr

mkdir -p /u01/app/oracle
chown oracle:oinstall /u01/app/oracle
mkdir -p /u01/app/oraInventory
chown oracle:oinstall /u01/app/oraInventory
chmod -R g+w /u01

cd /

ORACLE_URL="http://myserver/oracle"
curl -L -C - -o database.zip "${ORACLE_URL}/linuxx64_12201_database.zip"
unzip database.zip
rm -f database.zip

# http://www.torkwrench.com/2014/10/16/automating-oracle-11-2-installation-on-rhel-7/
sed -i -e 's/<RUNLEVEL>/<RUNLEVEL SEVERITY="IGNORABLE">/g' /database/stage/cvu/cvu_prereq.xml
# /database/response/db_install.rsp がオリジナルのレスポンスファイル
su oracle -c "/database/runInstaller -ignoreSysPrereqs -waitforcompletion -silent -responseFile /db_install.rsp"
# runInstaller 実行後に実行するように言われるシェルスクリプト
/u01/app/oraInventory/orainstRoot.sh
/u01/app/oracle/product/12.2.0/db_1/root.sh
# runInstaller 実行後に実行するように言われるコマンド（-waitforcompletion を追加）
# su oracle -c "echo '' | /database/runInstaller -waitforcompletion -executeConfigTools -responseFile /db_install.rsp -silent"
export DISPLAY=:0.0
su oracle -c "dbca -silent -createDatabase -responseFile /dbca.rsp"
rm -rf /database

# root user
echo "export ORACLE_BASE=${ORACLE_BASE}" >> /root/.bashrc
echo "export ORACLE_HOME=${ORACLE_HOME}" >> /root/.bashrc
echo "export PATH=${PATH}" >> /root/.bashrc
echo "export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}" >> /root/.bashrc
echo "export ORACLE_SID=${ORACLE_SID}" >> /root/.bashrc
echo "export NLS_LANG=${NLS_LANG}" >> /root/.bashrc

# oracle user
echo "export ORACLE_BASE=${ORACLE_BASE}" >> /home/oracle/.bashrc
echo "export ORACLE_HOME=${ORACLE_HOME}" >> /home/oracle/.bashrc
echo "export PATH=${PATH}" >> /home/oracle/.bashrc
echo "export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}" >> /home/oracle/.bashrc
echo "export ORACLE_SID=${ORACLE_SID}" >> /home/oracle/.bashrc
echo "export NLS_LANG=${NLS_LANG}" >> /home/oracle/.bashrc

source /root/.bashrc

/create_user.sh
/shutdown_database.sh

sed -i -e "s/BUILD_TIME_HOSTNAME_FIXME/`hostname`/g" /run_server.sh
```

linuxx64_12201_database.zip を Oracle のサーバからダウンロード後、どこか適当な場所に配置しそこからダウンロードするようにしています。
また、docker build 時のホスト名と docker run 時のホスト名が異なることが原因で Oracle が正常動作しないため、最後の行で docker build 時のホスト名を docker run 時のホスト名で置換する処理を加えています(sed)。

基本的には runInstaller で Oracle をインストールし dbca で DB を作成する通常の流れと同様です。
異なるのは rsp ファイルを指定して、サイレントインストールしている事です。

続いて、intra-mart 用ユーザの作成です。
これを docker build 時に行っておくことで、docker run 後にすぐ利用できるようになります。

以下のユーザを作成しています。

* IMART
* IAP_DB
* DEFAULT
* ACCELDOCUMENTS

https://www.intra-mart.jp/download/product/iad/im_acceldocuments_setup_guide/texts/setup_guide/database/index.html#iad-application-name に書かれているロールの付与も行います。

```shell:create_user.sh
#!/bin/sh

sqlplus sys/Password as sysdba @/create_user.sql
```
```sql:create_user.sql
-- IMART
CREATE USER IMART IDENTIFIED BY imart DEFAULT TABLESPACE "USERS";
GRANT RESOURCE TO IMART;
GRANT CONNECT TO IMART;
GRANT CREATE VIEW TO IMART;
GRANT UNLIMITED TABLESPACE TO IMART;
GRANT ALTER ANY INDEX TO IMART;
GRANT ALTER ANY SEQUENCE TO IMART;
GRANT ALTER ANY TABLE TO IMART;
GRANT CREATE ANY INDEX TO IMART;
GRANT CREATE ANY SEQUENCE TO IMART;
GRANT CREATE ANY TABLE TO IMART;
GRANT CREATE USER TO IMART;
GRANT DELETE ANY TABLE TO IMART;
GRANT DROP ANY INDEX TO IMART;
GRANT DROP ANY SEQUENCE TO IMART;
GRANT DROP ANY TABLE TO IMART;
GRANT DROP USER TO IMART;
GRANT INSERT ANY TABLE TO IMART;
GRANT LOCK ANY TABLE TO IMART;
GRANT SELECT ANY SEQUENCE TO IMART;
GRANT SELECT ANY TABLE TO IMART;
GRANT UPDATE ANY TABLE TO IMART;

-- IAP_DB
CREATE USER IAP_DB IDENTIFIED BY imart DEFAULT TABLESPACE "USERS";
GRANT RESOURCE TO IAP_DB;
GRANT CONNECT TO IAP_DB;
GRANT CREATE VIEW TO IAP_DB;
GRANT UNLIMITED TABLESPACE TO IAP_DB;
GRANT ALTER ANY INDEX TO IAP_DB;
GRANT ALTER ANY SEQUENCE TO IAP_DB;
GRANT ALTER ANY TABLE TO IAP_DB;
GRANT CREATE ANY INDEX TO IAP_DB;
GRANT CREATE ANY SEQUENCE TO IAP_DB;
GRANT CREATE ANY TABLE TO IAP_DB;
GRANT CREATE USER TO IAP_DB;
GRANT DELETE ANY TABLE TO IAP_DB;
GRANT DROP ANY INDEX TO IAP_DB;
GRANT DROP ANY SEQUENCE TO IAP_DB;
GRANT DROP ANY TABLE TO IAP_DB;
GRANT DROP USER TO IAP_DB;
GRANT INSERT ANY TABLE TO IAP_DB;
GRANT LOCK ANY TABLE TO IAP_DB;
GRANT SELECT ANY SEQUENCE TO IAP_DB;
GRANT SELECT ANY TABLE TO IAP_DB;
GRANT UPDATE ANY TABLE TO IAP_DB;

-- "DEFAULT"
CREATE USER "DEFAULT" IDENTIFIED BY imart DEFAULT TABLESPACE "USERS";
GRANT RESOURCE TO "DEFAULT";
GRANT CONNECT TO "DEFAULT";
GRANT CREATE VIEW TO "DEFAULT";
GRANT UNLIMITED TABLESPACE TO "DEFAULT";
GRANT ALTER ANY INDEX TO "DEFAULT";
GRANT ALTER ANY SEQUENCE TO "DEFAULT";
GRANT ALTER ANY TABLE TO "DEFAULT";
GRANT CREATE ANY INDEX TO "DEFAULT";
GRANT CREATE ANY SEQUENCE TO "DEFAULT";
GRANT CREATE ANY TABLE TO "DEFAULT";
GRANT CREATE USER TO "DEFAULT";
GRANT DELETE ANY TABLE TO "DEFAULT";
GRANT DROP ANY INDEX TO "DEFAULT";
GRANT DROP ANY SEQUENCE TO "DEFAULT";
GRANT DROP ANY TABLE TO "DEFAULT";
GRANT DROP USER TO "DEFAULT";
GRANT INSERT ANY TABLE TO "DEFAULT";
GRANT LOCK ANY TABLE TO "DEFAULT";
GRANT SELECT ANY SEQUENCE TO "DEFAULT";
GRANT SELECT ANY TABLE TO "DEFAULT";
GRANT UPDATE ANY TABLE TO "DEFAULT";

-- ACCELDOCUMENTS
CREATE USER ACCELDOCUMENTS IDENTIFIED BY imart DEFAULT TABLESPACE "USERS";
GRANT RESOURCE TO ACCELDOCUMENTS;
GRANT CONNECT TO ACCELDOCUMENTS;
GRANT CREATE VIEW TO ACCELDOCUMENTS;
GRANT UNLIMITED TABLESPACE TO ACCELDOCUMENTS;
GRANT ALTER ANY INDEX TO ACCELDOCUMENTS;
GRANT ALTER ANY SEQUENCE TO ACCELDOCUMENTS;
GRANT ALTER ANY TABLE TO ACCELDOCUMENTS;
GRANT CREATE ANY INDEX TO ACCELDOCUMENTS;
GRANT CREATE ANY SEQUENCE TO ACCELDOCUMENTS;
GRANT CREATE ANY TABLE TO ACCELDOCUMENTS;
GRANT CREATE USER TO ACCELDOCUMENTS;
GRANT DELETE ANY TABLE TO ACCELDOCUMENTS;
GRANT DROP ANY INDEX TO ACCELDOCUMENTS;
GRANT DROP ANY SEQUENCE TO ACCELDOCUMENTS;
GRANT DROP ANY TABLE TO ACCELDOCUMENTS;
GRANT DROP USER TO ACCELDOCUMENTS;
GRANT INSERT ANY TABLE TO ACCELDOCUMENTS;
GRANT LOCK ANY TABLE TO ACCELDOCUMENTS;
GRANT SELECT ANY SEQUENCE TO ACCELDOCUMENTS;
GRANT SELECT ANY TABLE TO ACCELDOCUMENTS;
GRANT UPDATE ANY TABLE TO ACCELDOCUMENTS;

EXIT;
```

続いて、ユーザの削除です。
再度 docker run し直せば、真っさらなデータの Oracle が立ちあがることになりますが、それはせずユーザのみ作り直したいという場合のために用意します。

```shell:drop_user.sh
#!/bin/sh

sqlplus sys/Password as sysdba @/drop_user.sql
```
```sql:drop_user.sql
DROP USER ACCELDOCUMENTS CASCADE;
DROP USER "DEFAULT" CASCADE;
DROP USER IAP_DB CASCADE;
DROP USER IMART CASCADE;

EXIT;
```

続いて、Oracle の起動スクリプトです。
docker run 時に内部でこれを実行しています。

```shell:start_database.sh
#!/bin/sh

sqlplus sys/Password as sysdba @/startup.sql
```
```sql:startup.sql
STARTUP;
EXIT;
```

続いて、Oracle の停止スクリプトです。

```shell:shutdown_database.sh
#!/bin/sh

sqlplus sys/Password as sysdba @/shutdown.sql
```
```sql:shutdown.sql
SHUTDOWN IMMEDIATE;
EXIT;
```

続いて、docker run 時に実行するスクリプトです。
docker build 時のホスト名と docker run 時のホスト名が異なることで Oracle が動作しないため、docker build 時のホスト名を、docker run 時のホスト名で置換する処理を実施しています(sed)。

```shell:run_server.sh
#!/bin/bash

/etc/init.d/sshd start

# DB作成時のホスト(BUILD_TIME_HOSTNAME_FIXME) がスクリプトや設定ファイルに書き込まれているため、Docker イメージ実行時のホストに書き換える
host=`hostname`
# mv ${ORACLE_BASE}/diag/tnslsnr/BUILD_TIME_HOSTNAME_FIXME ${ORACLE_BASE}/diag/tnslsnr/${host}
# sed -i -e "s/BUILD_TIME_HOSTNAME_FIXME/${host}/g" ${ORACLE_HOME}/network/admin/listener.ora
sed -i -e "s/BUILD_TIME_HOSTNAME_FIXME/${host}/g" ${ORACLE_HOME}/install/chainedInstall/globalcontext.xml
sed -i -e "s/BUILD_TIME_HOSTNAME_FIXME/${host}/g" ${ORACLE_HOME}/inventory/Clone/clone.xml
sed -i -e "s/BUILD_TIME_HOSTNAME_FIXME/${host}/g" ${ORACLE_HOME}/inventory/Components21/oracle.ldap.client/12.2.0.1.0/context.xml
sed -i -e "s/BUILD_TIME_HOSTNAME_FIXME/${host}/g" ${ORACLE_HOME}/inventory/Components21/oracle.rdbms.scheduler/12.2.0.1.0/context.xml
sed -i -e "s/BUILD_TIME_HOSTNAME_FIXME/${host}/g" ${ORACLE_HOME}/inventory/Components21/oracle.server/12.2.0.1.0/context.xml

/start_database.sh

if [ -r /netca.rsp ]; then
    # Listener はビルド時に作成すると docker run 時にホスト名が変わってしまって動かなくて面倒なのでここで作成する
    su oracle -c "netca -silent -responseFile /netca.rsp"
    rm -f /netca.rsp
fi

touch ${ORACLE_BASE}/diag/rdbms/orcl/orcl/trace/alert_orcl.log
tail -F ${ORACLE_BASE}/diag/rdbms/orcl/orcl/trace/alert_orcl.log
```

# レスポンスファイル

続いて Oracle インストールの肝となるレスポンスファイルです。
以下の設定を行います。

* SID: orcl
* characterSet：AL32UTF8
* nationalCharacterSet=AL16UTF16
* memoryLimit=2048MB
* DB_BLOCK_SIZE: 16KB 


```shell:db_install.rsp
####################################################################
## Copyright(c) Oracle Corporation 1998,2017. All rights reserved.##
##                                                                ##
## Specify values for the variables listed below to customize     ##
## your installation.                                             ##
##                                                                ##
## Each variable is associated with a comment. The comment        ##
## can help to populate the variables with the appropriate        ##
## values.                                                        ##
##                                                                ##
## IMPORTANT NOTE: This file contains plain text passwords and    ##
## should be secured to have read permission only by oracle user  ##
## or db administrator who owns this installation.                ##
##                                                                ##
####################################################################


#-------------------------------------------------------------------------------
# Do not change the following system generated value. 
#-------------------------------------------------------------------------------
oracle.install.responseFileVersion=/oracle/install/rspfmt_dbinstall_response_schema_v12.2.0

#-------------------------------------------------------------------------------
# Specify the installation option.
# It can be one of the following:
#   - INSTALL_DB_SWONLY
#   - INSTALL_DB_AND_CONFIG
#   - UPGRADE_DB
#-------------------------------------------------------------------------------
oracle.install.option=INSTALL_DB_SWONLY

#-------------------------------------------------------------------------------
# Specify the Unix group to be set for the inventory directory.  
#-------------------------------------------------------------------------------
UNIX_GROUP_NAME=oinstall

#-------------------------------------------------------------------------------
# Specify the location which holds the inventory files.
# This is an optional parameter if installing on
# Windows based Operating System.
#-------------------------------------------------------------------------------
INVENTORY_LOCATION=/u01/app/oraInventory

#-------------------------------------------------------------------------------
# Specify the complete path of the Oracle Home. 
#-------------------------------------------------------------------------------
ORACLE_HOME=/u01/app/oracle/product/12.2.0/db_1

#-------------------------------------------------------------------------------
# Specify the complete path of the Oracle Base. 
#-------------------------------------------------------------------------------
ORACLE_BASE=/u01/app/oracle

#-------------------------------------------------------------------------------
# Specify the installation edition of the component.                     
#                                                             
# The value should contain only one of these choices.  
#   - EE     : Enterprise Edition 
#   - SE2     : Standard Edition 2


#-------------------------------------------------------------------------------

oracle.install.db.InstallEdition=EE
###############################################################################
#                                                                             #
# PRIVILEGED OPERATING SYSTEM GROUPS                                          #
# ------------------------------------------                                  #
# Provide values for the OS groups to which SYSDBA and SYSOPER privileges     #
# needs to be granted. If the install is being performed as a member of the   #
# group "dba", then that will be used unless specified otherwise below.       #
#                                                                             #
# The value to be specified for OSDBA and OSOPER group is only for UNIX based #
# Operating System.                                                           #
#                                                                             #
###############################################################################

#------------------------------------------------------------------------------
# The OSDBA_GROUP is the OS group which is to be granted SYSDBA privileges.
#-------------------------------------------------------------------------------
oracle.install.db.OSDBA_GROUP=dba

#------------------------------------------------------------------------------
# The OSOPER_GROUP is the OS group which is to be granted SYSOPER privileges.
# The value to be specified for OSOPER group is optional.
#------------------------------------------------------------------------------
oracle.install.db.OSOPER_GROUP=dba

#------------------------------------------------------------------------------
# The OSBACKUPDBA_GROUP is the OS group which is to be granted SYSBACKUP privileges.
#------------------------------------------------------------------------------
oracle.install.db.OSBACKUPDBA_GROUP=dba

#------------------------------------------------------------------------------
# The OSDGDBA_GROUP is the OS group which is to be granted SYSDG privileges.
#------------------------------------------------------------------------------
oracle.install.db.OSDGDBA_GROUP=dba

#------------------------------------------------------------------------------
# The OSKMDBA_GROUP is the OS group which is to be granted SYSKM privileges.
#------------------------------------------------------------------------------
oracle.install.db.OSKMDBA_GROUP=dba

#------------------------------------------------------------------------------
# The OSRACDBA_GROUP is the OS group which is to be granted SYSRAC privileges.
#------------------------------------------------------------------------------
oracle.install.db.OSRACDBA_GROUP=dba

###############################################################################
#                                                                             #
#                               Grid Options                                  #
#                                                                             #
###############################################################################
#------------------------------------------------------------------------------
# Specify the type of Real Application Cluster Database
# 
#   - ADMIN_MANAGED: Admin-Managed
#   - POLICY_MANAGED: Policy-Managed
# 
# If left unspecified, default will be ADMIN_MANAGED 
#------------------------------------------------------------------------------
oracle.install.db.rac.configurationType=

#------------------------------------------------------------------------------
# Value is required only if RAC database type is ADMIN_MANAGED
# 
# Specify the cluster node names selected during the installation.
# Leaving it blank will result in install on local server only (Single Instance)
# 
# Example : oracle.install.db.CLUSTER_NODES=node1,node2
#------------------------------------------------------------------------------
oracle.install.db.CLUSTER_NODES=

#------------------------------------------------------------------------------
# This variable is used to enable or disable RAC One Node install.
#
#   - true  : Value of RAC One Node service name is used.
#   - false : Value of RAC One Node service name is not used.
#
# If left blank, it will be assumed to be false.
#------------------------------------------------------------------------------
oracle.install.db.isRACOneInstall=

#------------------------------------------------------------------------------
# Value is required only if oracle.install.db.isRACOneInstall is true.
# 
# Specify the name for RAC One Node Service
#------------------------------------------------------------------------------
oracle.install.db.racOneServiceName=

#------------------------------------------------------------------------------
# Value is required only if RAC database type is POLICY_MANAGED
# 
# Specify a name for the new Server pool that will be configured
# Example : oracle.install.db.rac.serverpoolName=pool1
#------------------------------------------------------------------------------
oracle.install.db.rac.serverpoolName=

#------------------------------------------------------------------------------
# Value is required only if RAC database type is POLICY_MANAGED
# 
# Specify a number as cardinality for the new Server pool that will be configured
# Example : oracle.install.db.rac.serverpoolCardinality=2
#------------------------------------------------------------------------------
oracle.install.db.rac.serverpoolCardinality=

###############################################################################
#                                                                             #
#                        Database Configuration Options                       #
#                                                                             #
###############################################################################

#-------------------------------------------------------------------------------
# Specify the type of database to create.
# It can be one of the following:
#   - GENERAL_PURPOSE                       
#   - DATA_WAREHOUSE 
# GENERAL_PURPOSE: A starter database designed for general purpose use or transaction-heavy applications.
# DATA_WAREHOUSE : A starter database optimized for data warehousing applications.
#-------------------------------------------------------------------------------
oracle.install.db.config.starterdb.type=

#-------------------------------------------------------------------------------
# Specify the Starter Database Global Database Name. 
#-------------------------------------------------------------------------------
oracle.install.db.config.starterdb.globalDBName=orcl

#-------------------------------------------------------------------------------
# Specify the Starter Database SID.
#-------------------------------------------------------------------------------
oracle.install.db.config.starterdb.SID=orcl

#-------------------------------------------------------------------------------
# Specify whether the database should be configured as a Container database.
# The value can be either "true" or "false". If left blank it will be assumed
# to be "false".
#-------------------------------------------------------------------------------
oracle.install.db.ConfigureAsContainerDB=

#-------------------------------------------------------------------------------
# Specify the  Pluggable Database name for the pluggable database in Container Database.
#-------------------------------------------------------------------------------
oracle.install.db.config.PDBName=pdb

#-------------------------------------------------------------------------------
# Specify the Starter Database character set.
#                                               
#  One of the following
#  AL32UTF8, WE8ISO8859P15, WE8MSWIN1252, EE8ISO8859P2,
#  EE8MSWIN1250, NE8ISO8859P10, NEE8ISO8859P4, BLT8MSWIN1257,
#  BLT8ISO8859P13, CL8ISO8859P5, CL8MSWIN1251, AR8ISO8859P6,
#  AR8MSWIN1256, EL8ISO8859P7, EL8MSWIN1253, IW8ISO8859P8,
#  IW8MSWIN1255, JA16EUC, JA16EUCTILDE, JA16SJIS, JA16SJISTILDE,
#  KO16MSWIN949, ZHS16GBK, TH8TISASCII, ZHT32EUC, ZHT16MSWIN950,
#  ZHT16HKSCS, WE8ISO8859P9, TR8MSWIN1254, VN8MSWIN1258
#-------------------------------------------------------------------------------
oracle.install.db.config.starterdb.characterSet=AL32UTF8

#------------------------------------------------------------------------------
# This variable should be set to true if Automatic Memory Management 
# in Database is desired.
# If Automatic Memory Management is not desired, and memory allocation
# is to be done manually, then set it to false.
#------------------------------------------------------------------------------
oracle.install.db.config.starterdb.memoryOption=

#-------------------------------------------------------------------------------
# Specify the total memory allocation for the database. Value(in MB) should be
# at least 256 MB, and should not exceed the total physical memory available 
# on the system.
# Example: oracle.install.db.config.starterdb.memoryLimit=512
#-------------------------------------------------------------------------------
oracle.install.db.config.starterdb.memoryLimit=2048

#-------------------------------------------------------------------------------
# This variable controls whether to load Example Schemas onto
# the starter database or not.
# The value can be either "true" or "false". If left blank it will be assumed
# to be "false".
#-------------------------------------------------------------------------------
oracle.install.db.config.starterdb.installExampleSchemas=

###############################################################################
#                                                                             #
# Passwords can be supplied for the following four schemas in the	      #
# starter database:      						      #
#   SYS                                                                       #
#   SYSTEM                                                                    #
#   DBSNMP (used by Enterprise Manager)                                       #
#                                                                             #
# Same password can be used for all accounts (not recommended) 		      #
# or different passwords for each account can be provided (recommended)       #
#                                                                             #
###############################################################################

#------------------------------------------------------------------------------
# This variable holds the password that is to be used for all schemas in the
# starter database.
#-------------------------------------------------------------------------------
oracle.install.db.config.starterdb.password.ALL=Password

#-------------------------------------------------------------------------------
# Specify the SYS password for the starter database.
#-------------------------------------------------------------------------------
oracle.install.db.config.starterdb.password.SYS=Password

#-------------------------------------------------------------------------------
# Specify the SYSTEM password for the starter database.
#-------------------------------------------------------------------------------
oracle.install.db.config.starterdb.password.SYSTEM=Password

#-------------------------------------------------------------------------------
# Specify the DBSNMP password for the starter database.
# Applicable only when oracle.install.db.config.starterdb.managementOption=CLOUD_CONTROL
#-------------------------------------------------------------------------------
oracle.install.db.config.starterdb.password.DBSNMP=Password

#-------------------------------------------------------------------------------
# Specify the PDBADMIN password required for creation of Pluggable Database in the Container Database.
#-------------------------------------------------------------------------------
oracle.install.db.config.starterdb.password.PDBADMIN=Password

#-------------------------------------------------------------------------------
# Specify the management option to use for managing the database.
# Options are:
# 1. CLOUD_CONTROL - If you want to manage your database with Enterprise Manager Cloud Control along with Database Express.
# 2. DEFAULT   -If you want to manage your database using the default Database Express option.
#-------------------------------------------------------------------------------
oracle.install.db.config.starterdb.managementOption=DEFAULT

#-------------------------------------------------------------------------------
# Specify the OMS host to connect to Cloud Control.
# Applicable only when oracle.install.db.config.starterdb.managementOption=CLOUD_CONTROL
#-------------------------------------------------------------------------------
oracle.install.db.config.starterdb.omsHost=

#-------------------------------------------------------------------------------
# Specify the OMS port to connect to Cloud Control.
# Applicable only when oracle.install.db.config.starterdb.managementOption=CLOUD_CONTROL
#-------------------------------------------------------------------------------
oracle.install.db.config.starterdb.omsPort=

#-------------------------------------------------------------------------------
# Specify the EM Admin user name to use to connect to Cloud Control.
# Applicable only when oracle.install.db.config.starterdb.managementOption=CLOUD_CONTROL
#-------------------------------------------------------------------------------
oracle.install.db.config.starterdb.emAdminUser=system

#-------------------------------------------------------------------------------
# Specify the EM Admin password to use to connect to Cloud Control.
# Applicable only when oracle.install.db.config.starterdb.managementOption=CLOUD_CONTROL
#-------------------------------------------------------------------------------
oracle.install.db.config.starterdb.emAdminPassword=Password

###############################################################################
#                                                                             #
# SPECIFY RECOVERY OPTIONS                                 	              #
# ------------------------------------		                              #
# Recovery options for the database can be mentioned using the entries below  #
#                                                                             #
###############################################################################

#------------------------------------------------------------------------------
# This variable is to be set to false if database recovery is not required. Else 
# this can be set to true.
#-------------------------------------------------------------------------------
oracle.install.db.config.starterdb.enableRecovery=false

#-------------------------------------------------------------------------------
# Specify the type of storage to use for the database.
# It can be one of the following:
#   - FILE_SYSTEM_STORAGE
#   - ASM_STORAGE
#-------------------------------------------------------------------------------
oracle.install.db.config.starterdb.storageType=FILE_SYSTEM_STORAGE

#-------------------------------------------------------------------------------
# Specify the database file location which is a directory for datafiles, control
# files, redo logs.         
#
# Applicable only when oracle.install.db.config.starterdb.storage=FILE_SYSTEM_STORAGE 
#-------------------------------------------------------------------------------
oracle.install.db.config.starterdb.fileSystemStorage.dataLocation=/u01/app/oracle/oradata

#-------------------------------------------------------------------------------
# Specify the recovery location.
#
# Applicable only when oracle.install.db.config.starterdb.storage=FILE_SYSTEM_STORAGE 
#-------------------------------------------------------------------------------
oracle.install.db.config.starterdb.fileSystemStorage.recoveryLocation=

#-------------------------------------------------------------------------------
# Specify the existing ASM disk groups to be used for storage.
#
# Applicable only when oracle.install.db.config.starterdb.storageType=ASM_STORAGE
#-------------------------------------------------------------------------------
oracle.install.db.config.asm.diskGroup=

#-------------------------------------------------------------------------------
# Specify the password for ASMSNMP user of the ASM instance.                 
#
# Applicable only when oracle.install.db.config.starterdb.storage=ASM_STORAGE 
#-------------------------------------------------------------------------------
oracle.install.db.config.asm.ASMSNMPPassword=

#------------------------------------------------------------------------------
# Specify the My Oracle Support Account Username.
#
#  Example   : MYORACLESUPPORT_USERNAME=abc@oracle.com
#------------------------------------------------------------------------------
MYORACLESUPPORT_USERNAME=

#------------------------------------------------------------------------------
# Specify the My Oracle Support Account Username password.
#
# Example    : MYORACLESUPPORT_PASSWORD=password
#------------------------------------------------------------------------------
MYORACLESUPPORT_PASSWORD=

#------------------------------------------------------------------------------
# Specify whether to enable the user to set the password for
# My Oracle Support credentials. The value can be either true or false.
# If left blank it will be assumed to be false.
#
# Example    : SECURITY_UPDATES_VIA_MYORACLESUPPORT=true
#------------------------------------------------------------------------------
SECURITY_UPDATES_VIA_MYORACLESUPPORT=

#------------------------------------------------------------------------------
# Specify whether user doesn't want to configure Security Updates.
# The value for this variable should be true if you don't want to configure
# Security Updates, false otherwise.
#
# The value can be either true or false. If left blank it will be assumed
# to be true.
#
# Example    : DECLINE_SECURITY_UPDATES=false
#------------------------------------------------------------------------------
DECLINE_SECURITY_UPDATES=true

#------------------------------------------------------------------------------
# Specify the Proxy server name. Length should be greater than zero.
#
# Example    : PROXY_HOST=proxy.domain.com 
#------------------------------------------------------------------------------
PROXY_HOST=

#------------------------------------------------------------------------------
# Specify the proxy port number. Should be Numeric and at least 2 chars.
#
# Example    : PROXY_PORT=25
#------------------------------------------------------------------------------
PROXY_PORT=

#------------------------------------------------------------------------------
# Specify the proxy user name. Leave PROXY_USER and PROXY_PWD
# blank if your proxy server requires no authentication.
#
# Example    : PROXY_USER=username
#------------------------------------------------------------------------------
PROXY_USER=

#------------------------------------------------------------------------------
# Specify the proxy password. Leave PROXY_USER and PROXY_PWD  
# blank if your proxy server requires no authentication.
#
# Example    : PROXY_PWD=password
#------------------------------------------------------------------------------
PROXY_PWD=

#------------------------------------------------------------------------------
# Specify the Oracle Support Hub URL. 
# 
# Example    : COLLECTOR_SUPPORTHUB_URL=https://orasupporthub.company.com:8080/
#------------------------------------------------------------------------------
COLLECTOR_SUPPORTHUB_URL=
```
```shell:dbca.rsp
##############################################################################
##                                                                          ##
##                            DBCA response file                            ##
##                            ------------------                            ##
## Copyright(c) Oracle Corporation 1998,2017. All rights reserved.         ##
##                                                                          ##
## Specify values for the variables listed below to customize 			    ##
## your installation.                                         			    ##
##                                                            			    ##
## Each variable is associated with a comment. The comment    			    ##
## can help to populate the variables with the appropriate   			    ##
## values.                                                  			    ##
##                                                               			##
## IMPORTANT NOTE: This file contains plain text passwords and   			##
## should be secured to have read permission only by oracle user 			##
## or db administrator who owns this installation.               			##
##############################################################################
#-------------------------------------------------------------------------------
# Do not change the following system generated value. 
#-------------------------------------------------------------------------------
responseFileVersion=/oracle/assistants/rspfmt_dbca_response_schema_v12.2.0

#-----------------------------------------------------------------------------
# Name          : gdbName
# Datatype      : String
# Description   : Global database name of the database
# Valid values  : <db_name>.<db_domain> - when database domain isn't NULL
#                 <db_name>             - when database domain is NULL
# Default value : None
# Mandatory     : Yes
#-----------------------------------------------------------------------------
gdbName=orcl

#-----------------------------------------------------------------------------
# Name          : sid
# Datatype      : String
# Description   : System identifier (SID) of the database
# Valid values  : Check Oracle12c Administrator's Guide
# Default value : <db_name> specified in GDBNAME
# Mandatory     : No
#-----------------------------------------------------------------------------
sid=orcl

#-----------------------------------------------------------------------------
# Name          : databaseConfigType
# Datatype      : String
# Description   : database conf type as Single Instance, Real Application Cluster or Real Application Cluster One Nodes database
# Valid values  : SI\RAC\RACONENODE
# Default value : SI
# Mandatory     : No
#-----------------------------------------------------------------------------
databaseConfigType=

#-----------------------------------------------------------------------------
# Name          : RACOneNodeServiceName
# Datatype      : String
# Description   : Service is required by application to connect to RAC One 
#		  Node Database
# Valid values  : Service Name
# Default value : None
# Mandatory     : No [required in case DATABASECONFTYPE is set to RACONENODE ]
#-----------------------------------------------------------------------------
RACOneNodeServiceName=

#-----------------------------------------------------------------------------
# Name          : policyManaged
# Datatype      : Boolean
# Description   : Set to true if Database is policy managed and 
#		  set to false if  Database is admin managed
# Valid values  : TRUE\FALSE
# Default value : FALSE
# Mandatory     : No
#-----------------------------------------------------------------------------
policyManaged=


#-----------------------------------------------------------------------------
# Name          : createServerPool
# Datatype      : Boolean
# Description   : Set to true if new server pool need to be created for database 
#		  if this option is specified then the newly created database 
#		  will use this newly created serverpool. 
#		  Multiple serverpoolname can not be specified for database
# Valid values  : TRUE\FALSE
# Default value : FALSE
# Mandatory     : No
#-----------------------------------------------------------------------------
createServerPool=

#-----------------------------------------------------------------------------
# Name          : serverPoolName
# Datatype      : String
# Description   : Only one serverpool name need to be specified 
#		   if Create Server Pool option is specified. 
#		   Comma-separated list of Serverpool names if db need to use
#		   multiple Server pool
# Valid values  : ServerPool name

# Default value : None
# Mandatory     : No [required in case of RAC service centric database]
#-----------------------------------------------------------------------------
serverPoolName=

#-----------------------------------------------------------------------------
# Name          : cardinality
# Datatype      : Number
# Description   : Specify Cardinality for create server pool operation

# Valid values  : any positive Integer value
# Default value : Number of qualified nodes on cluster
# Mandatory     : No [Required when a new serverpool need to be created]
#-----------------------------------------------------------------------------
cardinality=

#-----------------------------------------------------------------------------
# Name          : force
# Datatype      : Boolean
# Description   : Set to true if new server pool need to be created by force 
#		  if this option is specified then the newly created serverpool
#		  will be assigned server even if no free servers are available.
#		  This may affect already running database.
#		  This flag can be specified for Admin managed as well as policy managed db.
# Valid values  : TRUE\FALSE
# Default value : FALSE
# Mandatory     : No
#-----------------------------------------------------------------------------
force=

#-----------------------------------------------------------------------------
# Name          : pqPoolName
# Datatype      : String
# Description   : Only one serverpool name needs to be specified 
#		   if create server pool option is specified. 
#		   Comma-separated list of serverpool names if use
#		   server pool. This is required to 
#                  create Parallel Query (PQ) database. Applicable to Big Cluster
# Valid values  :  Parallel Query (PQ) pool name
# Default value : None
# Mandatory     : No [required in case of RAC service centric database]
#-----------------------------------------------------------------------------
pqPoolName=

#-----------------------------------------------------------------------------
# Name          : pqCardinality
# Datatype      : Number
# Description   : Specify Cardinality for create server pool operation.
#                 Applicable to Big Cluster 
# Valid values  : any positive Integer value
# Default value : Number of qualified nodes on cluster
# Mandatory     : No [Required when a new serverpool need to be created]
#-----------------------------------------------------------------------------
pqCardinality=

#-----------------------------------------------------------------------------
# Name          : createAsContainerDatabase 
# Datatype      : boolean
# Description   : flag to create database as container database 
# Valid values  : Check Oracle12c Administrator's Guide
# Default value : false
# Mandatory     : No
#-----------------------------------------------------------------------------
createAsContainerDatabase=

#-----------------------------------------------------------------------------
# Name          : numberOfPDBs
# Datatype      : Number
# Description   : Specify the number of pdb to be created
# Valid values  : 0 to 4094
# Default value : 0
# Mandatory     : No
#-----------------------------------------------------------------------------
numberOfPDBs=1

#-----------------------------------------------------------------------------
# Name          : pdbName 
# Datatype      : String
# Description   : Specify the pdbname/pdbanme prefix if one or more pdb need to be created
# Valid values  : Check Oracle12c Administrator's Guide
# Default value : None
# Mandatory     : No
#-----------------------------------------------------------------------------
pdbName=pdb

#-----------------------------------------------------------------------------
# Name          : useLocalUndoForPDBs 
# Datatype      : boolean
# Description   : Flag to create local undo tablespace for all PDB's.
# Valid values  : TRUE\FALSE
# Default value : TRUE
# Mandatory     : No
#-----------------------------------------------------------------------------
useLocalUndoForPDBs=

#-----------------------------------------------------------------------------
# Name          : pdbAdminPassword
# Datatype      : String
# Description   : PDB Administrator user password
# Valid values  : Check Oracle12c Administrator's Guide
# Default value : None
# Mandatory     : No
#-----------------------------------------------------------------------------

pdbAdminPassword=Password

#-----------------------------------------------------------------------------
# Name          : nodelist
# Datatype      : String
# Description   : Comma-separated list of cluster nodes
# Valid values  : Cluster node names
# Default value : None
# Mandatory     : No (Yes for RAC database-centric database )
#-----------------------------------------------------------------------------
nodelist=

#-----------------------------------------------------------------------------
# Name          : templateName
# Datatype      : String
# Description   : Name of the template
# Valid values  : Template file name
# Default value : None
# Mandatory     : Yes
#-----------------------------------------------------------------------------
templateName=New_Database.dbt

#-----------------------------------------------------------------------------
# Name          : sysPassword
# Datatype      : String
# Description   : Password for SYS user
# Valid values  : Check Oracle12c Administrator's Guide
# Default value : None
# Mandatory     : Yes
#-----------------------------------------------------------------------------
sysPassword=Password

#-----------------------------------------------------------------------------
# Name          : systemPassword
# Datatype      : String
# Description   : Password for SYSTEM user
# Valid values  : Check Oracle12c Administrator's Guide
# Default value : None
# Mandatory     : Yes
#-----------------------------------------------------------------------------
systemPassword=Password

#-----------------------------------------------------------------------------
# Name          : oracleHomeUserPassword
# Datatype      : String
# Description   : Password for Windows Service user
# Default value : None
# Mandatory     : If Oracle home is installed with windows service user
#-----------------------------------------------------------------------------
oracleHomeUserPassword=Password

#-----------------------------------------------------------------------------
# Name          : emConfiguration
# Datatype      : String
# Description   : Enterprise Manager Configuration Type
# Valid values  : CENTRAL|DBEXPRESS|BOTH|NONE
# Default value : NONE
# Mandatory     : No
#-----------------------------------------------------------------------------
emConfiguration=DBEXPRESS

#-----------------------------------------------------------------------------
# Name          : emExpressPort
# Datatype      : Number
# Description   : Enterprise Manager Configuration Type
# Valid values  : Check Oracle12c Administrator's Guide
# Default value : NONE
# Mandatory     : No, will be picked up from DBEXPRESS_HTTPS_PORT env variable
#                 or auto generates a free port between 5500 and 5599
#-----------------------------------------------------------------------------
emExpressPort=5500

#-----------------------------------------------------------------------------
# Name          : runCVUChecks
# Datatype      : Boolean
# Description   : Specify whether to run Cluster Verification Utility checks
#                 periodically in Cluster environment
# Valid values  : TRUE\FALSE
# Default value : FALSE
# Mandatory     : No
#-----------------------------------------------------------------------------
runCVUChecks=

#-----------------------------------------------------------------------------
# Name          : dbsnmpPassword
# Datatype      : String
# Description   : Password for DBSNMP user
# Valid values  : Check Oracle12c Administrator's Guide
# Default value : None
# Mandatory     : Yes, if emConfiguration is specified or
#                 the value of runCVUChecks is TRUE
#-----------------------------------------------------------------------------
dbsnmpPassword=Password

#-----------------------------------------------------------------------------
# Name          : omsHost
# Datatype      : String
# Description   : EM management server host name
# Default value : None
# Mandatory     : Yes, if CENTRAL is specified for emConfiguration
#-----------------------------------------------------------------------------
omsHost=

#-----------------------------------------------------------------------------
# Name          : omsPort
# Datatype      : Number
# Description   : EM management server port number
# Default value : None
# Mandatory     : Yes, if CENTRAL is specified for emConfiguration
#-----------------------------------------------------------------------------
omsPort=

#-----------------------------------------------------------------------------
# Name          : emUser
# Datatype      : String
# Description   : EM Admin username to add or modify targets
# Default value : None
# Mandatory     : Yes, if CENTRAL is specified for emConfiguration
#-----------------------------------------------------------------------------
emUser=system

#-----------------------------------------------------------------------------
# Name          : emPassword
# Datatype      : String
# Description   : EM Admin user password
# Default value : None
# Mandatory     : Yes, if CENTRAL is specified for emConfiguration
#-----------------------------------------------------------------------------
emPassword=Password

#-----------------------------------------------------------------------------
# Name          : dvConfiguration
# Datatype      : Boolean
# Description   : Specify "True" to configure and enable Oracle Database vault
# Valid values  : True/False
# Default value : False
# Mandatory     : No
#-----------------------------------------------------------------------------
dvConfiguration=

#-----------------------------------------------------------------------------
# Name          : dvUserName
# Datatype      : String
# Description   : DataVault Owner
# Valid values  : Check Oracle12c Administrator's Guide
# Default value : None
# Mandatory     : Yes, if DataVault option is chosen
#-----------------------------------------------------------------------------
dvUserName=

#-----------------------------------------------------------------------------
# Name          : dvUserPassword
# Datatype      : String
# Description   : Password for DataVault Owner
# Valid values  : Check Oracle12c Administrator's Guide
# Default value : None
# Mandatory     : Yes, if DataVault option is chosen
#-----------------------------------------------------------------------------
dvUserPassword=Password

#-----------------------------------------------------------------------------
# Name          : dvAccountManagerName
# Datatype      : String
# Description   : DataVault Account Manager
# Valid values  : Check Oracle12c Administrator's Guide
# Default value : None
# Mandatory     : No
#-----------------------------------------------------------------------------
dvAccountManagerName=

#-----------------------------------------------------------------------------
# Name          : dvAccountManagerPassword
# Datatype      : String
# Description   : Password for  DataVault Account Manager
# Valid values  : Check Oracle12c Administrator's Guide
# Default value : None
# Mandatory     : No
#-----------------------------------------------------------------------------
dvAccountManagerPassword=Password

#-----------------------------------------------------------------------------
# Name          : olsConfiguration
# Datatype      : Boolean
# Description   : Specify "True" to configure and enable Oracle Label Security
# Valid values  : True/False
# Default value : False
# Mandatory     : No
#-----------------------------------------------------------------------------
olsConfiguration=

#-----------------------------------------------------------------------------
# Name          : datafileJarLocation 
# Datatype      : String
# Description   : Location of the data file jar 
# Valid values  : Directory containing compressed datafile jar
# Default value : None
# Mandatory     : No
#-----------------------------------------------------------------------------
datafileJarLocation=

#-----------------------------------------------------------------------------
# Name          : datafileDestination 
# Datatype      : String
# Description   : Location of the data file's
# Valid values  : Directory for all the database files
# Default value : $ORACLE_BASE/oradata
# Mandatory     : No
#-----------------------------------------------------------------------------
datafileDestination=

#-----------------------------------------------------------------------------
# Name          : recoveryAreaDestination
# Datatype      : String
# Description   : Location of the data file's
# Valid values  : Recovery Area location
# Default value : $ORACLE_BASE/flash_recovery_area
# Mandatory     : No
#-----------------------------------------------------------------------------
recoveryAreaDestination=

#-----------------------------------------------------------------------------
# Name          : storageType
# Datatype      : String
# Description   : Specifies the storage on which the database is to be created
# Valid values  : FS (CFS for RAC), ASM
# Default value : FS
# Mandatory     : No
#-----------------------------------------------------------------------------
storageType=

#-----------------------------------------------------------------------------
# Name          : diskGroupName
# Datatype      : String
# Description   : Specifies the disk group name for the storage
# Default value : DATA
# Mandatory     : No
#-----------------------------------------------------------------------------
diskGroupName=

#-----------------------------------------------------------------------------
# Name          : asmsnmpPassword
# Datatype      : String
# Description   : Password for ASM Monitoring
# Default value : None
# Mandatory     : No
#-----------------------------------------------------------------------------
asmsnmpPassword=Password

#-----------------------------------------------------------------------------
# Name          : recoveryGroupName
# Datatype      : String
# Description   : Specifies the disk group name for the recovery area
# Default value : RECOVERY
# Mandatory     : No
#-----------------------------------------------------------------------------
recoveryGroupName=

#-----------------------------------------------------------------------------
# Name          : characterSet
# Datatype      : String
# Description   : Character set of the database
# Valid values  : Check Oracle12c National Language Support Guide
# Default value : "US7ASCII"
# Mandatory     : NO
#-----------------------------------------------------------------------------
characterSet=AL32UTF8

#-----------------------------------------------------------------------------
# Name          : nationalCharacterSet
# Datatype      : String
# Description   : National Character set of the database
# Valid values  : "UTF8" or "AL16UTF16". For details, check Oracle12c National Language Support Guide
# Default value : "AL16UTF16"
# Mandatory     : No
#-----------------------------------------------------------------------------
nationalCharacterSet=AL16UTF16

#-----------------------------------------------------------------------------
# Name          : registerWithDirService
# Datatype      : Boolean
# Description   : Specifies whether to register with Directory Service.
# Valid values  : TRUE \ FALSE
# Default value : FALSE
# Mandatory     : No
#-----------------------------------------------------------------------------
registerWithDirService=


#-----------------------------------------------------------------------------
# Name          : dirServiceUserName
# Datatype      : String
# Description   : Specifies the name of the directory service user
# Mandatory     : YES, if the value of registerWithDirService is TRUE
#-----------------------------------------------------------------------------
dirServiceUserName=

#-----------------------------------------------------------------------------
# Name          : dirServicePassword
# Datatype      : String
# Description   : The password of the directory service user.
#		  You can also specify the password at the command prompt instead of here.
# Mandatory     : YES, if the value of registerWithDirService is TRUE
#-----------------------------------------------------------------------------
dirServicePassword=Password

#-----------------------------------------------------------------------------
# Name          : walletPassword
# Datatype      : String
# Description   : The password for wallet to created or modified.
#		  You can also specify the password at the command prompt instead of here.
# Mandatory     : YES, if the value of registerWithDirService is TRUE
#-----------------------------------------------------------------------------
walletPassword=Password

#-----------------------------------------------------------------------------
# Name          : listeners
# Datatype      : String
# Description   : Specifies list of listeners to register the database with.
#		  By default the database is configured for all the listeners specified in the 
#		  $ORACLE_HOME/network/admin/listener.ora 	
# Valid values  : The list should be comma separated like "listener1,listener2".
# Mandatory     : NO
#-----------------------------------------------------------------------------
listeners=

#-----------------------------------------------------------------------------
# Name          : variablesFile 
# Datatype      : String
# Description   : Location of the file containing variable value pair
# Valid values  : A valid file-system file. The variable value pair format in this file 
#		  is <variable>=<value>. Each pair should be in a new line.
# Default value : None
# Mandatory     : NO
#-----------------------------------------------------------------------------
variablesFile=

#-----------------------------------------------------------------------------
# Name          : variables
# Datatype      : String
# Description   : comma separated list of name=value pairs. Overrides variables defined in variablefile and templates
# Default value : None
# Mandatory     : NO
#-----------------------------------------------------------------------------
variables=

#-----------------------------------------------------------------------------
# Name          : initParams
# Datatype      : String
# Description   : comma separated list of name=value pairs. Overrides initialization parameters defined in templates
# Default value : None
# Mandatory     : NO
#-----------------------------------------------------------------------------
initParams=db_block_size=16384

#-----------------------------------------------------------------------------
# Name          : sampleSchema
# Datatype      : Boolean
# Description   : Specifies whether or not to add the Sample Schemas to your database
# Valid values  : TRUE \ FALSE
# Default value : FASLE
# Mandatory     : No
#-----------------------------------------------------------------------------
sampleSchema=

#-----------------------------------------------------------------------------
# Name          : memoryPercentage
# Datatype      : String
# Description   : percentage of physical memory for Oracle
# Default value : None
# Mandatory     : NO
#-----------------------------------------------------------------------------
memoryPercentage=

#-----------------------------------------------------------------------------
# Name          : databaseType
# Datatype      : String
# Description   : used for memory distribution when memoryPercentage specified
# Valid values  : MULTIPURPOSE|DATA_WAREHOUSING|OLTP
# Default value : MULTIPURPOSE
# Mandatory     : NO
#-----------------------------------------------------------------------------
databaseType=

#-----------------------------------------------------------------------------
# Name          : automaticMemoryManagement
# Datatype      : Boolean
# Description   : flag to indicate Automatic Memory Management is used
# Valid values  : TRUE/FALSE
# Default value : TRUE
# Mandatory     : NO
#-----------------------------------------------------------------------------
automaticMemoryManagement=

#-----------------------------------------------------------------------------
# Name          : totalMemory
# Datatype      : String
# Description   : total memory in MB to allocate to Oracle
# Valid values  : 
# Default value : 
# Mandatory     : NO
#-----------------------------------------------------------------------------
totalMemory=
```
```shell:netca.rsp
###################################################################### 
## Copyright(c) 1998, 2016 Oracle Corporation. All rights reserved. ## 
##                                                                  ## 
## Specify values for the variables listed below to customize your  ## 
## installation.                                                    ## 
##                                                                  ## 
## Each variable is associated with a comment. The comment          ## 
## identifies the variable type.                                    ## 
##                                                                  ## 
## Please specify the values in the following format:               ## 
##                                                                  ## 
##         Type         Example                                     ## 
##         String       "Sample Value"                              ## 
##         Boolean      True or False                               ## 
##         Number       1000                                        ## 
##         StringList   {"String value 1","String Value 2"}         ## 
##                                                                  ## 
######################################################################
##                                                                  ## 
## This sample response file causes the Oracle Net Configuration    ##
## Assistant (NetCA) to complete an Oracle Net configuration during ##
## a custom install of the Oracle12c server which is similar to     ##
## what would be created by the NetCA during typical Oracle12c      ##
## install. It also documents all of the NetCA response file        ##
## variables so you can create your own response file to configure  ##
## Oracle Net during an install the way you wish.                   ##
##                                                                  ## 
###################################################################### 

[GENERAL]
RESPONSEFILE_VERSION="12.2"
CREATE_TYPE="CUSTOM"

#-------------------------------------------------------------------------------
# Name       : SHOW_GUI
# Datatype   : Boolean
# Description: This variable controls appearance/suppression of the NetCA GUI,
# Pre-req    : N/A
# Default    : TRUE
# Note:
# This must be set to false in order to run NetCA in silent mode. 
# This is a substitute of "/silent" flag in the NetCA command line.
# The command line flag has precedence over the one in this response file.
# This feature is present since 10.1.0.3.
#-------------------------------------------------------------------------------
SHOW_GUI=false

#-------------------------------------------------------------------------------
# Name       : LOG_FILE
# Datatype   : String
# Description: If present, NetCA will log output to this file in addition to the
#	       standard out.
# Pre-req    : N/A
# Default    : NONE
# Note:
# 	This is a substitute of "/log" in the NetCA command line.
# The command line argument has precedence over the one in this response file.
# This feature is present since 10.1.0.3.
#-------------------------------------------------------------------------------
#LOG_FILE=""/oracle12cHome/network/tools/log/netca.log""

[oracle.net.ca]
#INSTALLED_COMPONENTS;StringList;list of installed components
# The possible values for installed components are:
# "net8","server","client","aso", "cman", "javavm" 
INSTALLED_COMPONENTS={"server","net8","javavm"}

#INSTALL_TYPE;String;type of install
# The possible values for install type are:
# "typical","minimal" or "custom"
INSTALL_TYPE=""typical""

#LISTENER_NUMBER;Number;Number of Listeners
# A typical install sets one listener 
LISTENER_NUMBER=1

#LISTENER_NAMES;StringList;list of listener names
# The values for listener are:
# "LISTENER","LISTENER1","LISTENER2","LISTENER3", ...
# A typical install sets only "LISTENER" 
LISTENER_NAMES={"LISTENER"}

#LISTENER_PROTOCOLS;StringList;list of listener addresses (protocols and parameters separated by semicolons)
# The possible values for listener protocols are:
# "TCP;1521","TCPS;2484","NMP;ORAPIPE","IPC;IPCKEY","VI;1521" 
# For multiple listeners, separate them with commas ex "TCP;1521","TCPS;2484"
# For multiple protocols in single listener, separate them with "&" ex  "TCP;1521&TCPS;2484"
# A typical install sets only "TCP;1521" 
LISTENER_PROTOCOLS={"TCP;1521"}

#LISTENER_START;String;name of the listener to start, in double quotes
LISTENER_START=""LISTENER""

#NAMING_METHODS;StringList;list of naming methods
# The possible values for naming methods are: 
# LDAP, TNSNAMES, ONAMES, HOSTNAME, NOVELL, NIS, DCE
# A typical install sets only: "TNSNAMES","ONAMES","HOSTNAMES" 
# or "LDAP","TNSNAMES","ONAMES","HOSTNAMES" for LDAP
NAMING_METHODS={"TNSNAMES","ONAMES","HOSTNAME"}

#NOVELL_NAMECONTEXT;String;Novell Directory Service name context, in double quotes
# A typical install does not use this variable. 
#NOVELL_NAMECONTEXT = ""NAMCONTEXT""

#SUN_METAMAP;String; SUN meta map, in double quotes
# A typical install does not use this variable. 
#SUN_METAMAP = ""MAP""

#DCE_CELLNAME;String;DCE cell name, in double quotes
# A typical install does not use this variable. 
#DCE_CELLNAME = ""CELL""

#NSN_NUMBER;Number;Number of NetService Names
# A typical install sets one net service name
NSN_NUMBER=1

#NSN_NAMES;StringList;list of Net Service names
# A typical install sets net service name to "EXTPROC_CONNECTION_DATA"
NSN_NAMES={"EXTPROC_CONNECTION_DATA"}

#NSN_SERVICE;StringList;Oracle12c database's service name
# A typical install sets Oracle12c database's service name to "PLSExtProc"
NSN_SERVICE={"PLSExtProc"}

#NSN_PROTOCOLS;StringList;list of coma separated strings of Net Service Name protocol parameters
# The possible values for net service name protocol parameters are:
# "TCP;HOSTNAME;1521","TCPS;HOSTNAME;2484","NMP;COMPUTERNAME;ORAPIPE","VI;HOSTNAME;1521","IPC;IPCKEY"  
# A typical install sets parameters to "IPC;EXTPROC"
NSN_PROTOCOLS={"TCP;HOSTNAME;1521"}

#SERVICEUSERPASSWORD;String;Windows service user password
# If the oracle home is installed as secure user, supply the password
#SERVICEUSERPASSWORD=""svcpassword""
```

# 起動

docker run -it -p 0.0.0.0:1521:1521 -p 0.0.0.0:5500:5500 -p 0.0.0.0:2222:22 myoracle_12c_r2

DB が使えるようになるのは、docker run 後 1 分くらいかかります（マシンスペック次第）
Enterprise Manager が使えるようになるのは、docker run 後 2 分くらいかかります（マシンスペック次第）

# データ永続化

データを永続化したい場合、docker volume を使えば OK です。
named volume であれば docker run 時に docker コンテナ内のデータが docker volume にコピーされてマウントされるため、次のように起動することで永続化が可能です。

docker run -v oradata:/u01/app/oracle/oradata -it -p 0.0.0.0:1521:1521 -p 0.0.0.0:5500:5500 -p 0.0.0.0:2222:22 myoracle_12c_r2

# sqlplus

ssh でログイン後、
sqlplus sys/Password as sysdba
で使えます。

# Enterprise Manager

ユーザ sys/Password で接続可能です。
URL は https://localhost:5500/em です。
localhost の部分は、docker run しているマシンの IP アドレスに置き換えてください。

# resin-web.xml

Resin で接続する場合次のように設定します。
localhost の部分は、docker run しているマシンの IP アドレスに置き換えてください。

```xml:resin-web.xml
    <!-- IMART ユーザ -->
    <database jndi-name="jdbc/oracle">
        <driver>
            <type>oracle.jdbc.driver.OracleDriver</type>
            <url>jdbc:oracle:thin:@localhost:1521:orcl</url>
            <user>IMART</user>
            <password>imart</password>
        </driver>
        <max-connections>20</max-connections>
        <prepared-statement-cache-size>0</prepared-statement-cache-size>
    </database>

    <!-- IAP_DB ユーザ -->
    <database jndi-name="jdbc/oracle">
        <driver>
            <type>oracle.jdbc.driver.OracleDriver</type>
            <url>jdbc:oracle:thin:@localhost:1521:orcl</url>
            <user>IAP_DB</user>
            <password>imart</password>
        </driver>
        <max-connections>20</max-connections>
        <prepared-statement-cache-size>0</prepared-statement-cache-size>
    </database>

    <!-- DEFAULT ユーザ -->
    <database jndi-name="jdbc/oracle">
        <driver>
            <type>oracle.jdbc.driver.OracleDriver</type>
            <url>jdbc:oracle:thin:@localhost:1521:orcl</url>
            <user>DEFAULT</user>
            <password>imart</password>
        </driver>
        <max-connections>20</max-connections>
        <prepared-statement-cache-size>0</prepared-statement-cache-size>
    </database>
```

というわけで簡単にですが Oracle 12cR2 intra-mart 用構成済みの Docker についての紹介でした。