Code development platform for open source projects from the European Union institutions

Skip to content
Snippets Groups Projects
Commit a697186d authored by Joze RIHTARSIC's avatar Joze RIHTARSIC
Browse files

Merge pull request #164 in EDELIVERY/smp from...

Merge pull request #164 in EDELIVERY/smp from feature/EDELIVERY-7951-smp-test-plans-with-option-to-use-oracle-docker-19c to development

* commit 'b7e02f7949ea4e5eb44cce1d967f508f0c901e26':
  Docker tests with database 19c
  Docker tests with database 19c
parents 40805640 d4acbc38
No related branches found
No related tags found
No related merge requests found
Showing
with 1166 additions and 138 deletions
version: "3.0"
services:
database:
image: oracle/database:11.2.0.2-xe
image: smp-oradb-19.3.0-se2:${SMP_VERSION}
container_name: smp_oracle_db
environment:
- ORACLE_CHARACTERSET=AL32UTF8 # set database encoding
- NLS_LANG=.AL32UTF8 # set sqlplus encoding for stating up scripts
volumes:
- ./properties/db-scripts:/u01/app/oracle/scripts/setup # init script.
- shared-status-folder:/u01/status/
- ./properties/db-scripts:/docker-entrypoint-initdb.d/startup # init script.
- ./status-folder:/u01/status/
ports:
- 1921:1521
shm_size: '1gb'
......@@ -13,7 +16,7 @@ services:
depends_on:
- database
# command: [bash, -c, "for i in `seq 10`; do timeout 1 bash -c '</dev/tcp/database/1521'; if [ $$? -eq 0 ] ; then break;fi;sleep 1; done;"]
command: [bash, -c, "for i in `seq 150`; do timeout 1 bash -c 'echo \" $$(ls /u01/status/)\"'; if [ -f '/u01/status/database.log' ] && [ \"$$( cat /u01/status/database.log )\" == 'DATABASE IS READY TO USE!' ] ; then break;fi; echo \"$$i. Wait for database!\"; sleep 2; done; /u01/oracle/startAdminServer.sh"]
command: [bash, -c, "for i in `seq 180`; do timeout 1 bash -c 'echo \" $$(ls /u01/status/)\"'; if [ -f '/u01/status/database.status' ] && [ \"$$( cat /u01/status/database.status )\" == 'DATABASE IS READY TO USE!' ] ; then break;fi; echo \"$$i. Wait for database!\"; sleep 10; done; /u01/oracle/startAdminServer.sh"]
image: smp-weblogic-122:${SMP_VERSION}
container_name: wls-smp
hostname: wlsadmin
......@@ -21,7 +24,7 @@ services:
JAVA_OPTIONS: "-Dweblogic.webservice.i18n.charset=utf-8"
volumes:
- ./properties/weblogic:/u01/oracle/properties
- shared-status-folder:/u01/status/
- ./status-folder:/u01/status/
ports:
- 7901:7001
volumes:
......
create tablespace smp_tblspace datafile 'smp_tblspace.dat' size 10M autoextend on;
create temporary tablespace smp_tblspace_temp tempfile 'smp_tblspace_temp.dat' size 5M autoextend on;
create user smp identified by test default tablespace smp_tblspace temporary tablespace smp_tblspace_temp;
ALTER SESSION SET CONTAINER=ORCLPDB1;
CREATE USER smp IDENTIFIED BY "test" DEFAULT TABLESPACE users QUOTA UNLIMITED ON users;
GRANT CREATE SESSION TO smp;
GRANT CREATE TABLE TO smp;
GRANT CREATE VIEW TO smp;
GRANT CREATE SEQUENCE TO smp;
GRANT SELECT ON PENDING_TRANS$ TO smp;
grant create session to smp;
grant create sequence to smp;
grant create table to smp;
grant unlimited tablespace to smp;
exit;
......@@ -8,12 +8,18 @@ PREFIX="smp-wls-orcl"
SMP_VERSION=
ORA_VERSION="19.3.0"
ORA_EDITION="se2"
ORA_SERVICE="ORCLPDB1"
ORACLE_PDB="ORCLPDB1"
SMP_DB_USERNAME=smp;
SMP_DB_PASSWORD=test;
# clear volume and containers - to run restart from strach
# READ argumnets
# READ arguments
while getopts i:v: option
do
case "${option}"
......@@ -37,8 +43,43 @@ echo "Working Directory: ${WORKING_DIR}"
echo "*************************************************************************"
cd "$WORKING_DIR"
function createDatabaseSchemaForUser() {
echo "Clear file [$3] to recreate schema for user creation!"
echo "" > "$3"
echo "Create database schema/user: $1"
if [ -n "$ORACLE_PDB" ]; then
echo "ALTER SESSION SET CONTAINER=$ORACLE_PDB;" >>"$3"
fi
{
# magic with double quotes - first end " then put '"' and then add variable to "$Var" and repeat the stuff :)
echo "CREATE USER $1 IDENTIFIED BY "'"'"$2"'"'" DEFAULT TABLESPACE users QUOTA UNLIMITED ON users; "
echo "GRANT CREATE SESSION TO $1;"
echo "GRANT CREATE TABLE TO $1;"
echo "GRANT CREATE VIEW TO $1;"
echo "GRANT CREATE SEQUENCE TO $1;"
echo "GRANT SELECT ON PENDING_TRANS$ TO $1;"
echo ""
} >>"$3"
}
function clearOldContainers {
echo "Clear containers and volumes"
docker-compose -p "${PREFIX}" rm -s -f -v
docker volume rm "${PREFIX}_shared-status-folder"
}
createDatabaseSchemaForUser $SMP_DB_USERNAME $SMP_DB_PASSWORD ./properties/db-scripts/01_create_user.sql
# create database init script from
echo "CONNECT smp/test@//localhost:1521/xe;" > ./properties/db-scripts/02_oracle10g.sql
echo "CONNECT smp/test@//localhost:1521/${ORA_SERVICE};" > ./properties/db-scripts/02_oracle10g.sql
cat "${SMP_INIT_DATABASE}" >> ./properties/db-scripts/02_oracle10g.sql
......@@ -50,29 +91,20 @@ if [ ! -f "${SMP_INIT_DATABASE_DATA}" ]
exit 1;
else
# copy artefact to docker build folder
echo "CONNECT smp/test@//localhost:1521/xe;" > ./properties/db-scripts/03_oracle10g-data.sql
echo "CONNECT smp/test@//localhost:1521/${ORA_SERVICE};" > ./properties/db-scripts/03_oracle10g-data.sql
cat "${SMP_INIT_DATABASE_DATA}" >> ./properties/db-scripts/03_oracle10g-data.sql
fi
function clearOldContainers {
echo "Clear containers and volumes"
docker-compose -p "${PREFIX}" rm -s -f -v
docker volume rm "${PREFIX}_shared-status-folder"
}
#
# Always delete shared-status-folder else weblogic will start to quick!
# because statuses are sync over shared-status-folder folders and it could contain status from previous run.
# Because statuses are synchronized through folder: ./status-folder it could contain a state from a previous start.
# Set content of the file database.status to "Database starting"!
echo "Database starting" > ./status-folder/database.status
clearOldContainers
# start
export SMP_VERSION="${SMP_VERSION}"
docker-compose -p ${PREFIX} up -d --force-recreate
# wait until service is up
for i in `seq 100`; do timeout 1 bash -c ' curl --head --silent --fail http://localhost:7901/smp/'; if [ $? -eq 0 ] ; then break;fi; echo "$i. Wait for weblogic to start!"; sleep 5; done;
for i in `seq 150`; do timeout 10 bash -c ' curl --head --silent --fail http://localhost:7901/smp/'; if [ $? -eq 0 ] ; then break;fi; echo "$i. Wait for weblogic to start!"; sleep 5; done;
Database stopped
......@@ -11,6 +11,7 @@ PREFIX="smp-wls-orcl"
function clearOldContainers {
echo "Database stopped" > ./status-folder/database.status
echo "Clear containers and volumes"
docker-compose -p "${PREFIX}" rm -s -f -v
docker volume rm "${PREFIX}_shared-status-folder"
......
#!/bin/bash
# Script builds docker images for SMP oracle/weblogic environment. Docker images for database and weblogic are from
# https://github.com/oracle/docker-images
# Script builds docker images for SMP oracle/weblogic environment. Docker images for database and weblogic are from
# https://github.com/oracle/docker-images
# Prerequisites:
# 1. From oracle download:
......@@ -11,16 +11,22 @@
# and put them to folder ${ORACLE_ARTEFACTS}
#
# 2. build SMP mvn clean install
# 3. run the scripts with arguments
# 3. run the scripts with arguments
# build-docker-images.sh -f build-docker-images.sh -f ${oracle_artefact_folder}
ORA_VERSION="19.3.0"
ORA_EDITION="se2"
ORA_SERVICE="ORCLPDB1"
ORACLE_DB_FILE="oracle-xe-11.2.0-1.0.x86_64.rpm.zip"
ORACLE_DB11_FILE="oracle-xe-11.2.0-1.0.x86_64.rpm.zip"
ORACLE_DB19_FILE="LINUX.X64_193000_db_home.zip"
ORACLE_DOCKERFILE="Dockerfile.xe"
ORACLE_DB_FILE="${ORACLE_DB11_FILE}"
SERVER_JDK_FILE="server-jre-8u211-linux-x64.tar.gz"
WEBLOGIC_122_QUICK_FILE="fmw_12.2.1.3.0_wls_quick_Disk1_1of1.zip"
SMP_VERSION=
ORACLE_ARTEFACTS="/CEF/oracle-install"
ORACLE_ARTEFACTS="/CEF/repo"
SMP_ARTEFACTS="../../smp-webapp/target/"
SMP_ARTEFACTS_CLEAR="false"
......@@ -29,22 +35,19 @@ SMP_IMAGE_PUBLISH="false"
DOCKER_USER=$bamboo_DOCKER_USER
DOCKER_PASSWORD=$bamboo_DOCKER_PASSWORD
# READ argumnets
while getopts v:o:s:c:p: option; do
case "${option}" in
# READ argumnets
while getopts v:o:s:c:p: option
do
case "${option}"
in
v) SMP_VERSION=${OPTARG};;
o) ORACLE_ARTEFACTS=${OPTARG};;
s) SMP_ARTEFACTS=${OPTARG};;
c) SMP_ARTEFACTS_CLEAR=${OPTARG};;
p) SMP_IMAGE_PUBLISH=${OPTARG};;
v) SMP_VERSION=${OPTARG} ;;
o) ORACLE_ARTEFACTS=${OPTARG} ;;
s) SMP_ARTEFACTS=${OPTARG} ;;
c) SMP_ARTEFACTS_CLEAR=${OPTARG} ;;
p) SMP_IMAGE_PUBLISH=${OPTARG} ;;
esac
done
if [[ -z "${SML_VERSION}" ]]
then
if [[ -z "${SML_VERSION}" ]]; then
# get version from setup file
#cd "${SMP_ARTEFACTS}"
#SMP_VERSION="$(ls smp-*-setup.zip | sed -e 's/.*smp-//g' | sed -e 's/-setup\.zip$//g')"
......@@ -52,7 +55,7 @@ then
# go back to dirname
fi
DIRNAME=`dirname "$0"`
DIRNAME=$(dirname "$0")
cd "$DIRNAME"
DIRNAME="$(pwd -P)"
echo "*****************************************************************"
......@@ -62,60 +65,66 @@ echo "* Oracle artefact folders: $ORACLE_ARTEFACTS"
echo "*****************************************************************"
echo ""
# -----------------------------------------------------------------------------
# validate all necessary artefacts and prepare files to build images
# -----------------------------------------------------------------------------
validateAndPrepareArtefacts() {
case "${ORA_VERSION}" in
"19.3.0")
ORACLE_DB_FILE="${ORACLE_DB19_FILE}"
ORACLE_DOCKERFILE="Dockerfile"
;;
"11.2.0.2")
ORACLE_DB_FILE="${ORACLE_DB11_FILE}"
ORACLE_DOCKERFILE="Dockerfile.xe"
;;
esac
export ORA_VERSION
export ORA_EDITION
export ORA_SERVICE
# -----------------------------------------------------------------------------
# validate all necessary artefacts and prepare files to build images
# -----------------------------------------------------------------------------
validateAndPrepareArtefacts() {
# check oracle database
if [[ ! -f "${ORACLE_ARTEFACTS}/Oracle/OracleDatabase/11.2.0.2/${ORACLE_DB_FILE}" ]]
then
echo "Oracle database artefacts '${ORACLE_ARTEFACTS}/Oracle/OracleDatabase/11.2.0.2/${ORACLE_DB_FILE}' not found."
exit 1;
if [[ ! -f "${ORACLE_ARTEFACTS}/Oracle/OracleDatabase/${ORA_VERSION}/${ORACLE_DB_FILE}" ]]; then
echo "Oracle database artefacts '${ORACLE_ARTEFACTS}/Oracle/OracleDatabase/${ORA_VERSION}/${ORACLE_DB_FILE}' not found."
exit 1
else
# copy artefact to docker build folder
cp "${ORACLE_ARTEFACTS}/Oracle/OracleDatabase/11.2.0.2/${ORACLE_DB_FILE}" ./oracle/oracle-db-11.2.0.2/
cp "${ORACLE_ARTEFACTS}/Oracle/OracleDatabase/${ORA_VERSION}/${ORACLE_DB_FILE}" ./oracle/oracle-db-${ORA_VERSION}/
fi
# check server JDK
if [[ ! -f "${ORACLE_ARTEFACTS}/Oracle/Java/${SERVER_JDK_FILE}" ]]
then
if [[ ! -f "${ORACLE_ARTEFACTS}/Oracle/Java/${SERVER_JDK_FILE}" ]]; then
echo "Server JDK artefacts '${ORACLE_ARTEFACTS}/Oracle/Java/${SERVER_JDK_FILE}' not found."
exit 1;
exit 1
else
# copy artefact to docker build folder
cp "${ORACLE_ARTEFACTS}/Oracle/Java/${SERVER_JDK_FILE}" ./oracle/OracleJava/java-8/
fi
# check weblogic
if [[ ! -f "${ORACLE_ARTEFACTS}/${WEBLOGIC_122_QUICK_FILE}" ]]
then
# check weblogic
if [[ ! -f "${ORACLE_ARTEFACTS}/${WEBLOGIC_122_QUICK_FILE}" ]]; then
echo "Weblogic artefacts '${ORACLE_ARTEFACTS}/${WEBLOGIC_122_QUICK_FILE}' not found."
exit 1;
exit 1
else
# copy artefact to docker build folder
cp "${ORACLE_ARTEFACTS}/${WEBLOGIC_122_QUICK_FILE}" ./oracle/weblogic-12.2.1.3/
cp "${ORACLE_ARTEFACTS}/${WEBLOGIC_122_QUICK_FILE}" ./oracle/weblogic-12.2.1.3/
fi
if [[ ! -d "./tomcat-mysql/artefacts/" ]]
then
if [[ ! -d "./tomcat-mysql/artefacts/" ]]; then
mkdir -p "./tomcat-mysql/artefacts/"
fi
if [[ ! -d "./tomcat-mysql-smp-sml/artefacts/" ]]
then
if [[ ! -d "./tomcat-mysql-smp-sml/artefacts/" ]]; then
mkdir -p "./tomcat-mysql-smp-sml/artefacts"
fi
# SMP artefats
if [[ ! -f "${SMP_ARTEFACTS}/smp.war" ]]
then
# SMP artefats
if [[ ! -f "${SMP_ARTEFACTS}/smp.war" ]]; then
echo "SMP artefact '${SMP_ARTEFACTS}/smp.war' not found. Was project built!"
exit 1;
exit 1
else
# copy artefact to docker build folder
# for weblogic
......@@ -125,11 +134,10 @@ echo ""
cp "${SMP_ARTEFACTS}/smp.war" ./tomcat-mysql-smp-sml/artefacts/smp.war
fi
# SMP setup zip
if [[ ! -f "${SMP_ARTEFACTS}/smp-${SMP_VERSION}-setup.zip" ]]
then
# SMP setup zip
if [[ ! -f "${SMP_ARTEFACTS}/smp-${SMP_VERSION}-setup.zip" ]]; then
echo "SMP setup boundle '${SMP_ARTEFACTS}/smp-${SMP_VERSION}-setup.zip' not found. Was project built!"
exit 1;
exit 1
else
# copy artefact to docker build folder
cp "${SMP_ARTEFACTS}/smp-${SMP_VERSION}-setup.zip" ./weblogic-12.2.1.3-smp/smp-setup.zip
......@@ -137,64 +145,58 @@ echo ""
cp "${SMP_ARTEFACTS}/smp-${SMP_VERSION}-setup.zip" ./tomcat-mysql-smp-sml/artefacts/smp-setup.zip
fi
}
# -----------------------------------------------------------------------------
# build docker images
# -----------------------------------------------------------------------------
buildImages() {
# -----------------------------------------------------------------------------
# build docker image for oracle database
# -----------------------------------------------------------------------------
# oracle 1.2.0.2-xe (https://github.com/oracle/docker-images/tree/master/OracleDatabase/SingleInstance/dockerfiles/11.2.0.2)
docker build -f ./oracle/oracle-db-11.2.0.2/Dockerfile.xe -t "smp-oradb-11.2.0.2-xe:${SMP_VERSION}" ./oracle/oracle-db-11.2.0.2/
# build docker images
# -----------------------------------------------------------------------------
buildImages() {
# -----------------------------------------------------------------------------
# build docker image for oracle database
# -----------------------------------------------------------------------------
# -----------------------------------------------------------------------------
# build docker image for oracle database
# -----------------------------------------------------------------------------
# oracle 1.2.0.2-xe (https://github.com/oracle/docker-images/tree/master/OracleDatabase/SingleInstance/dockerfiles/11.2.0.2)
docker build -f ./oracle/oracle-db-${ORA_VERSION}/${ORACLE_DOCKERFILE} -t "smp-oradb-${ORA_VERSION}-${ORA_EDITION}:${SMP_VERSION}" --build-arg DB_EDITION=${ORA_EDITION} ./oracle/oracle-db-${ORA_VERSION}/
# create docker OS image with java (https://github.com/oracle/docker-images/tree/master/OracleJava/java-8)
docker build -t oracle/serverjre:8 ./oracle/OracleJava/java-8/
# -----------------------------------------------------------------------------
# build docker image for oracle database
# -----------------------------------------------------------------------------
# create weblogic basic (https://github.com/oracle/docker-images/tree/master/OracleWebLogic/dockerfiles/12.2.1.3)
docker build -f ./oracle/weblogic-12.2.1.3/Dockerfile.developer -t oracle/weblogic:12.2.1.3-developer ./oracle/weblogic-12.2.1.3/
# create docker OS image with java (https://github.com/oracle/docker-images/tree/master/OracleJava/java-8)
docker build -t oracle/serverjre:8 ./oracle/OracleJava/java-8/
# create weblogic domain-home-in-image (https://github.com/oracle/docker-images/tree/master/OracleWebLogic/samples/12213-domain-home-in-image./)
./oracle/weblogic-12213-domain-home-in-image/container-scripts/setEnv.sh ./oracle/weblogic-12213-domain-home-in-image/properties/docker-build/domain.properties
docker build $BUILD_ARG --force-rm=true -t oracle/12213-domain-home-in-image ./oracle/weblogic-12213-domain-home-in-image/
# create weblogic basic (https://github.com/oracle/docker-images/tree/master/OracleWebLogic/dockerfiles/12.2.1.3)
docker build -f ./oracle/weblogic-12.2.1.3/Dockerfile.developer -t oracle/weblogic:12.2.1.3-developer ./oracle/weblogic-12.2.1.3/
# create weblogic domain-home-in-image (https://github.com/oracle/docker-images/tree/master/OracleWebLogic/samples/12213-domain-home-in-image./)
./oracle/weblogic-12213-domain-home-in-image/container-scripts/setEnv.sh ./oracle/weblogic-12213-domain-home-in-image/properties/docker-build/domain.properties
docker build $BUILD_ARG --force-rm=true -t oracle/12213-domain-home-in-image ./oracle/weblogic-12213-domain-home-in-image/
# build SMP deployment.
docker build -t "smp-weblogic-122:${SMP_VERSION}" ./weblogic-12.2.1.3-smp/ --build-arg SMP_VERSION="$SMP_VERSION"
# build SMP deployment.
docker build -t "smp-weblogic-122:${SMP_VERSION}" ./weblogic-12.2.1.3-smp/ --build-arg SMP_VERSION="$SMP_VERSION"
# build tomcat mysql image deployment.
docker build -t "smp-tomcat-mysql:${SMP_VERSION}" ./tomcat-mysql/ --build-arg SMP_VERSION=${SMP_VERSION}
# build tomcat mysql image deployment.
docker build -t "smp-tomcat-mysql:${SMP_VERSION}" ./tomcat-mysql/ --build-arg SMP_VERSION=${SMP_VERSION}
# build tomcat mysql image deployment.
docker build -t "smp-sml-tomcat-mysql:${SMP_VERSION}" ./tomcat-mysql-smp-sml/ --build-arg SMP_VERSION=${SMP_VERSION}
# build tomcat mysql image deployment.
docker build -t "smp-sml-tomcat-mysql:${SMP_VERSION}" ./tomcat-mysql-smp-sml/ --build-arg SMP_VERSION=${SMP_VERSION}
}
function pushImageToDockerhub {
if [[ "V$SMP_IMAGE_PUBLISH" == "Vtrue" ]]
then
# login to docker
docker login --username="${DOCKER_USER}" --password="${DOCKER_PASSWORD}"
# push images
pushImageIfExisting "smp-tomcat-mysql:${SMP_VERSION}"
pushImageIfExisting "smp-sml-tomcat-mysql:${SMP_VERSION}"
pushImageIfExisting "smp-weblogic-122:${SMP_VERSION}"
pushImageIfExisting "smp-oradb-11.2.0.2-xe:${SMP_VERSION}"
fi
}
function pushImageToDockerhub() {
if [[ "V$SMP_IMAGE_PUBLISH" == "Vtrue" ]]; then
# login to docker
docker login --username="${DOCKER_USER}" --password="${DOCKER_PASSWORD}"
# push images
pushImageIfExisting "smp-tomcat-mysql:${SMP_VERSION}"
pushImageIfExisting "smp-sml-tomcat-mysql:${SMP_VERSION}"
pushImageIfExisting "smp-weblogic-122:${SMP_VERSION}"
pushImageIfExisting "smp-oradb-11.2.0.2-xe:${SMP_VERSION}"
fi
}
function pushImageIfExisting {
function pushImageIfExisting() {
if [[ "x$(docker images -q "${1}")" != "x" ]]; then
echo "Pushing image ${1}"
docker tag "${1}" "${DOCKER_USER}"/"${1}"
......@@ -206,30 +208,27 @@ function pushImageIfExisting {
}
# -----------------------------------------------------------------------------
# clean
# -----------------------------------------------------------------------------
cleanArtefacts() {
rm "./oracle/oracle-db-11.2.0.2/${ORACLE_DB_FILE}" # clean
rm "./oracle/OracleJava/java-8/${SERVER_JDK_FILE}" # clean
# clean
# -----------------------------------------------------------------------------
cleanArtefacts() {
rm "./oracle/oracle-db-${ORA_VERSION}/${ORACLE_DB_FILE}" # clean
rm "./oracle/OracleJava/java-8/${SERVER_JDK_FILE}" # clean
rm "./oracle/weblogic-12.2.1.3/${WEBLOGIC_122_QUICK_FILE}" # clean
rm "./weblogic-12.2.1.3-smp/smp.war"
rm "./weblogic-12.2.1.3-smp/smp-setup.zip"
# clear also the tomcat/mysql image
# clear also the tomcat/mysql image
rm -rf "./tomcat-mysql/artefacts/*.*"
rm -rf "./tomcat-mysql-smp-sml/artefacts/*.*"
if [[ "V$SMP_ARTEFACTS_CLEAR" == "Vtrue" ]]
then
rm -rf "${SMP_ARTEFACTS}/smp-setup.zip"
rm -rf "${SMP_ARTEFACTS}/smp.war"
if [[ "V$SMP_ARTEFACTS_CLEAR" == "Vtrue" ]]; then
rm -rf "${SMP_ARTEFACTS}/smp-setup.zip"
rm -rf "${SMP_ARTEFACTS}/smp.war"
fi
}
validateAndPrepareArtefacts
buildImages
pushImageToDockerhub
cleanArtefacts
......@@ -2,7 +2,7 @@ Folder contains oracle images needed to build database and weblogic from
[Oracle docker git](https://github.com/oracle/docker-images/).
In order to build those images following files must be downloaded from Oracle page
- OracleDB: oracle-xe-11.2.0-1.0.x86_64.rpm.zip
- OracleDB 11xe: oracle-xe-11.2.0-1.0.x86_64.rpm.zip or - OracleDB 19c: LINUX.X64_193000_db_home.zip
- Server JDK 1.8: server-jre-8u211-linux-x64.tar.gz (https://github.com/oracle/docker-images/tree/master/OracleJava)
- weblogic 12.2.1.3: fmw_12.2.1.3.0_wls_quick_Disk1_1of1.zip
......
......@@ -202,7 +202,7 @@ fi;
$ORACLE_BASE/$CHECK_DB_FILE
if [ $? -eq 0 ]; then
echo "#########################"
echo "DATABASE IS READY TO USE!" |& tee /u01/status/database.log
echo "DATABASE IS READY TO USE!" |& tee /u01/status/database.status
echo "#########################"
# Execute custom provided startup scripts
......@@ -211,7 +211,7 @@ if [ $? -eq 0 ]; then
else
echo "#####################################"
echo "########### E R R O R ###############"
echo "DATABASE SETUP WAS NOT SUCCESSFUL!" |& tee /u01/status/database.log
echo "DATABASE SETUP WAS NOT SUCCESSFUL!" |& tee /u01/status/database.status
echo "Please check output for further info!"
echo "########### E R R O R ###############"
echo "#####################################"
......
1858bd0d281c60f4ddabd87b1c214a4f LINUX.X64_193000_db_home.zip
1858bd0d281c60f4ddabd87b1c214a4f LINUX.X64_193000_db_home.zip
# LICENSE UPL 1.0
#
# Copyright (c) 2018, 2020 Oracle and/or its affiliates.
#
# ORACLE DOCKERFILES PROJECT
# --------------------------
# This is the Dockerfile for Oracle Database 19c
#
# REQUIRED FILES TO BUILD THIS IMAGE
# ----------------------------------
# (1) db_home.zip
# Download Oracle Database 19c Enterprise Edition or Standard Edition 2 for Linux x64
# from http://www.oracle.com/technetwork/database/enterprise-edition/downloads/index.html
#
# HOW TO BUILD THIS IMAGE
# -----------------------
# Put all downloaded files in the same directory as this Dockerfile
# Run:
# $ docker build -t oracle/database:19.3.0-${EDITION} .
#
# Pull base image
# ---------------
FROM oraclelinux:7-slim as base
# Labels
# ------
LABEL "provider"="Oracle" \
"issues"="https://github.com/oracle/docker-images/issues" \
"volume.data"="/opt/oracle/oradata" \
"volume.setup.location1"="/opt/oracle/scripts/setup" \
"volume.setup.location2"="/docker-entrypoint-initdb.d/setup" \
"volume.startup.location1"="/opt/oracle/scripts/startup" \
"volume.startup.location2"="/docker-entrypoint-initdb.d/startup" \
"port.listener"="1521" \
"port.oemexpress"="5500"
# Argument to control removal of components not needed after db software installation
ARG SLIMMING=true
# Environment variables required for this build (do NOT change)
# -------------------------------------------------------------
ENV ORACLE_BASE=/opt/oracle \
ORACLE_HOME=/opt/oracle/product/19c/dbhome_1 \
INSTALL_DIR=/opt/install \
INSTALL_FILE_1="LINUX.X64_193000_db_home.zip" \
INSTALL_RSP="db_inst.rsp" \
CONFIG_RSP="dbca.rsp.tmpl" \
PWD_FILE="setPassword.sh" \
RUN_FILE="runOracle.sh" \
START_FILE="startDB.sh" \
CREATE_DB_FILE="createDB.sh" \
SETUP_LINUX_FILE="setupLinuxEnv.sh" \
CHECK_SPACE_FILE="checkSpace.sh" \
CHECK_DB_FILE="checkDBStatus.sh" \
USER_SCRIPTS_FILE="runUserScripts.sh" \
INSTALL_DB_BINARIES_FILE="installDBBinaries.sh" \
RELINK_BINARY_FILE="relinkOracleBinary.sh" \
SLIMMING=$SLIMMING
# Use second ENV so that variable get substituted
ENV PATH=$ORACLE_HOME/bin:$ORACLE_HOME/OPatch/:/usr/sbin:$PATH \
LD_LIBRARY_PATH=$ORACLE_HOME/lib:/usr/lib \
CLASSPATH=$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib
# Copy files needed during both installation and runtime
# -------------
COPY $SETUP_LINUX_FILE $CHECK_SPACE_FILE $INSTALL_DIR/
COPY $RUN_FILE $START_FILE $CREATE_DB_FILE $CONFIG_RSP $PWD_FILE $CHECK_DB_FILE $USER_SCRIPTS_FILE $RELINK_BINARY_FILE $ORACLE_BASE/
RUN chmod ug+x $INSTALL_DIR/*.sh && \
sync && \
$INSTALL_DIR/$CHECK_SPACE_FILE && \
$INSTALL_DIR/$SETUP_LINUX_FILE && \
rm -rf $INSTALL_DIR
#############################################
# -------------------------------------------
# Start new stage for installing the database
# -------------------------------------------
#############################################
FROM base AS builder
ARG DB_EDITION
# Copy DB install file
COPY --chown=oracle:dba $INSTALL_FILE_1 $INSTALL_RSP $INSTALL_DB_BINARIES_FILE $INSTALL_DIR/
# Install DB software binaries
USER oracle
RUN chmod ug+x $INSTALL_DIR/*.sh && \
sync && \
$INSTALL_DIR/$INSTALL_DB_BINARIES_FILE $DB_EDITION
#############################################
# -------------------------------------------
# Start new layer for database runtime
# -------------------------------------------
#############################################
FROM base
USER oracle
COPY --chown=oracle:dba --from=builder $ORACLE_BASE $ORACLE_BASE
USER root
RUN $ORACLE_BASE/oraInventory/orainstRoot.sh && \
$ORACLE_HOME/root.sh
USER oracle
WORKDIR /home/oracle
HEALTHCHECK --interval=1m --start-period=5m \
CMD "$ORACLE_BASE/$CHECK_DB_FILE" >/dev/null || exit 1
# Define default command to start Oracle Database.
CMD exec $ORACLE_BASE/$RUN_FILE
#!/bin/bash
# LICENSE UPL 1.0
#
# Copyright (c) 1982-2018 Oracle and/or its affiliates. All rights reserved.
#
# Since: May, 2017
# Author: gerald.venzl@oracle.com
# Description: Checks the status of Oracle Database.
# Return codes: 0 = PDB is open and ready to use
# 1 = PDB is not open
# 2 = Sql Plus execution failed
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
#
ORACLE_SID="`grep $ORACLE_HOME /etc/oratab | cut -d: -f1`"
OPEN_MODE="READ WRITE"
ORAENV_ASK=NO
source oraenv
# Check Oracle at least one PDB has open_mode "READ WRITE" and store it in status
status=`sqlplus -s / as sysdba << EOF
set heading off;
set pagesize 0;
SELECT DISTINCT open_mode FROM v\\$pdbs WHERE open_mode = '$OPEN_MODE';
exit;
EOF`
# Store return code from SQL*Plus
ret=$?
# SQL Plus execution was successful and PDB is open
if [ $ret -eq 0 ] && [ "$status" = "$OPEN_MODE" ]; then
exit 0;
# PDB is not open
elif [ "$status" != "$OPEN_MODE" ]; then
exit 1;
# SQL Plus execution failed
else
exit 2;
fi;
#!/bin/bash
# LICENSE UPL 1.0
#
# Copyright (c) 1982-2018 Oracle and/or its affiliates. All rights reserved.
#
# Since: January, 2017
# Author: gerald.venzl@oracle.com
# Description: Checks the available space of the system.
#
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
#
REQUIRED_SPACE_GB=18
AVAILABLE_SPACE_GB=`df -PB 1G / | tail -n 1 | awk '{ print $4 }'`
if [ $AVAILABLE_SPACE_GB -lt $REQUIRED_SPACE_GB ]; then
script_name=`basename "$0"`
echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
echo "$script_name: ERROR - There is not enough space available in the container."
echo "$script_name: The container needs at least $REQUIRED_SPACE_GB GB, but only $AVAILABLE_SPACE_GB GB are available."
echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
exit 1;
fi;
#!/bin/bash
# LICENSE UPL 1.0
#
# Copyright (c) 1982-2018 Oracle and/or its affiliates. All rights reserved.
#
# Since: November, 2016
# Author: gerald.venzl@oracle.com
# Description: Creates an Oracle Database based on following parameters:
# $ORACLE_SID: The Oracle SID and CDB name
# $ORACLE_PDB: The PDB name
# $ORACLE_PWD: The Oracle password
#
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
#
set -e
# Check whether ORACLE_SID is passed on
export ORACLE_SID=${1:-ORCLCDB}
# Check whether ORACLE_PDB is passed on
export ORACLE_PDB=${2:-ORCLPDB1}
# Checking if only one of INIT_SGA_SIZE & INIT_PGA_SIZE is provided by the user
if [[ "${INIT_SGA_SIZE}" != "" && "${INIT_PGA_SIZE}" == "" ]] || [[ "${INIT_SGA_SIZE}" == "" && "${INIT_PGA_SIZE}" != "" ]]; then
echo "ERROR: Provide both the values, INIT_SGA_SIZE and INIT_PGA_SIZE or neither of them. Exiting.";
exit 1;
fi;
# Auto generate ORACLE PWD if not passed on
export ORACLE_PWD=${3:-"`openssl rand -base64 8`1"}
echo "ORACLE PASSWORD FOR SYS, SYSTEM AND PDBADMIN: $ORACLE_PWD";
# Replace place holders in response file
cp $ORACLE_BASE/$CONFIG_RSP $ORACLE_BASE/dbca.rsp
sed -i -e "s|###ORACLE_SID###|$ORACLE_SID|g" $ORACLE_BASE/dbca.rsp
sed -i -e "s|###ORACLE_PDB###|$ORACLE_PDB|g" $ORACLE_BASE/dbca.rsp
sed -i -e "s|###ORACLE_PWD###|$ORACLE_PWD|g" $ORACLE_BASE/dbca.rsp
sed -i -e "s|###ORACLE_CHARACTERSET###|$ORACLE_CHARACTERSET|g" $ORACLE_BASE/dbca.rsp
# If both INIT_SGA_SIZE & INIT_PGA_SIZE aren't provided by user
if [[ "${INIT_SGA_SIZE}" == "" && "${INIT_PGA_SIZE}" == "" ]]; then
# If there is greater than 8 CPUs default back to dbca memory calculations
# dbca will automatically pick 40% of available memory for Oracle DB
# The minimum of 2G is for small environments to guarantee that Oracle has enough memory to function
# However, bigger environment can and should use more of the available memory
# This is due to Github Issue #307
if [ `nproc` -gt 8 ]; then
sed -i -e "s|totalMemory=2048||g" $ORACLE_BASE/dbca.rsp
fi;
else
sed -i -e "s|totalMemory=2048||g" $ORACLE_BASE/dbca.rsp
sed -i -e "s|initParams=.*|&,sga_target=${INIT_SGA_SIZE}M,pga_aggregate_target=${INIT_PGA_SIZE}M|g" $ORACLE_BASE/dbca.rsp
fi;
# Create network related config files (sqlnet.ora, tnsnames.ora, listener.ora)
mkdir -p $ORACLE_HOME/network/admin
echo "NAME.DIRECTORY_PATH= (TNSNAMES, EZCONNECT, HOSTNAME)" > $ORACLE_HOME/network/admin/sqlnet.ora
# Listener.ora
echo "LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1))
(ADDRESS = (PROTOCOL = TCP)(HOST = 0.0.0.0)(PORT = 1521))
)
)
DEDICATED_THROUGH_BROKER_LISTENER=ON
DIAG_ADR_ENABLED = off
" > $ORACLE_HOME/network/admin/listener.ora
# Start LISTENER and run DBCA
lsnrctl start &&
dbca -silent -createDatabase -responseFile $ORACLE_BASE/dbca.rsp ||
cat /opt/oracle/cfgtoollogs/dbca/$ORACLE_SID/$ORACLE_SID.log ||
cat /opt/oracle/cfgtoollogs/dbca/$ORACLE_SID.log
echo "$ORACLE_SID=localhost:1521/$ORACLE_SID" > $ORACLE_HOME/network/admin/tnsnames.ora
echo "$ORACLE_PDB=
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 0.0.0.0)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = $ORACLE_PDB)
)
)" >> $ORACLE_HOME/network/admin/tnsnames.ora
# Remove second control file, fix local_listener, make PDB auto open, enable EM global port
sqlplus / as sysdba << EOF
ALTER SYSTEM SET control_files='$ORACLE_BASE/oradata/$ORACLE_SID/control01.ctl' scope=spfile;
ALTER SYSTEM SET local_listener='';
ALTER PLUGGABLE DATABASE $ORACLE_PDB SAVE STATE;
EXEC DBMS_XDB_CONFIG.SETGLOBALPORTENABLED (TRUE);
exit;
EOF
# Remove temporary response file
rm $ORACLE_BASE/dbca.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_v19.0.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=dba
#-------------------------------------------------------------------------------
# Specify the location which holds the inventory files.
# This is an optional parameter if installing on
# Windows based Operating System.
#-------------------------------------------------------------------------------
INVENTORY_LOCATION=###ORACLE_BASE###/oraInventory
#-------------------------------------------------------------------------------
# Specify the complete path of the Oracle Home.
#-------------------------------------------------------------------------------
ORACLE_HOME=###ORACLE_HOME###
#-------------------------------------------------------------------------------
# Specify the complete path of the Oracle Base.
#-------------------------------------------------------------------------------
ORACLE_BASE=###ORACLE_BASE###
#-------------------------------------------------------------------------------
# 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=###ORACLE_EDITION###
###############################################################################
# #
# 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
#------------------------------------------------------------------------------
# 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=false
#------------------------------------------------------------------------------
# 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
\ No newline at end of file
##############################################################################
## ##
## 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_v19.0.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=###ORACLE_SID###
#-----------------------------------------------------------------------------
# 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=###ORACLE_SID###
#-----------------------------------------------------------------------------
# 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=true
#-----------------------------------------------------------------------------
# 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=###ORACLE_PDB###
#-----------------------------------------------------------------------------
# Name : pdbAdminPassword
# Datatype : String
# Description : PDB Administrator user password
# Valid values : Check Oracle12c Administrator's Guide
# Default value : None
# Mandatory : No
#-----------------------------------------------------------------------------
pdbAdminPassword=###ORACLE_PWD###
#-----------------------------------------------------------------------------
# Name : templateName
# Datatype : String
# Description : Name of the template
# Valid values : Template file name
# Default value : None
# Mandatory : Yes
#-----------------------------------------------------------------------------
templateName=General_Purpose.dbc
#-----------------------------------------------------------------------------
# Name : sysPassword
# Datatype : String
# Description : Password for SYS user
# Valid values : Check Oracle12c Administrator's Guide
# Default value : None
# Mandatory : Yes
#-----------------------------------------------------------------------------
sysPassword=###ORACLE_PWD###
#-----------------------------------------------------------------------------
# Name : systemPassword
# Datatype : String
# Description : Password for SYSTEM user
# Valid values : Check Oracle12c Administrator's Guide
# Default value : None
# Mandatory : Yes
#-----------------------------------------------------------------------------
systemPassword=###ORACLE_PWD###
#-----------------------------------------------------------------------------
# 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 : 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=###ORACLE_PWD###
#-----------------------------------------------------------------------------
# Name : characterSet
# Datatype : String
# Description : Character set of the database
# Valid values : Check Oracle12c National Language Support Guide
# Default value : "US7ASCII"
# Mandatory : NO
#-----------------------------------------------------------------------------
characterSet=###ORACLE_CHARACTERSET###
#-----------------------------------------------------------------------------
# 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 : initParams
# Datatype : String
# Description : comma separated list of name=value pairs. Overrides initialization parameters defined in templates
# Default value : None
# Mandatory : NO
#-----------------------------------------------------------------------------
initParams=audit_trail=none,audit_sys_operations=false
#-----------------------------------------------------------------------------
# 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=LISTENER
#-----------------------------------------------------------------------------
# Name : automaticMemoryManagement
# Datatype : Boolean
# Description : flag to indicate Automatic Memory Management is used
# Valid values : TRUE/FALSE
# Default value : TRUE
# Mandatory : NO
#-----------------------------------------------------------------------------
automaticMemoryManagement=FALSE
#-----------------------------------------------------------------------------
# Name : totalMemory
# Datatype : String
# Description : total memory in MB to allocate to Oracle
# Valid values :
# Default value :
# Mandatory : NO
#-----------------------------------------------------------------------------
totalMemory=2048
\ No newline at end of file
#!/bin/bash
# LICENSE UPL 1.0
#
# Copyright (c) 1982-2018 Oracle and/or its affiliates. All rights reserved.
#
# Since: December, 2016
# Author: gerald.venzl@oracle.com
# Description: Sets up the unix environment for DB installation.
#
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
#
# Convert $1 into upper case via "^^" (bash version 4 onwards)
EDITION=${1^^}
# Check whether edition has been passed on
if [ "$EDITION" == "" ]; then
echo "ERROR: No edition has been passed on!"
echo "Please specify the correct edition!"
exit 1;
fi;
# Check whether correct edition has been passed on
if [ "$EDITION" != "EE" -a "$EDITION" != "SE2" ]; then
echo "ERROR: Wrong edition has been passed on!"
echo "Edition $EDITION is no a valid edition!"
exit 1;
fi;
# Check whether ORACLE_BASE is set
if [ "$ORACLE_BASE" == "" ]; then
echo "ERROR: ORACLE_BASE has not been set!"
echo "You have to have the ORACLE_BASE environment variable set to a valid value!"
exit 1;
fi;
# Check whether ORACLE_HOME is set
if [ "$ORACLE_HOME" == "" ]; then
echo "ERROR: ORACLE_HOME has not been set!"
echo "You have to have the ORACLE_HOME environment variable set to a valid value!"
exit 1;
fi;
# Replace place holders
# ---------------------
sed -i -e "s|###ORACLE_EDITION###|$EDITION|g" $INSTALL_DIR/$INSTALL_RSP && \
sed -i -e "s|###ORACLE_BASE###|$ORACLE_BASE|g" $INSTALL_DIR/$INSTALL_RSP && \
sed -i -e "s|###ORACLE_HOME###|$ORACLE_HOME|g" $INSTALL_DIR/$INSTALL_RSP
# Install Oracle binaries
cd $ORACLE_HOME && \
mv $INSTALL_DIR/$INSTALL_FILE_1 $ORACLE_HOME/ && \
unzip $INSTALL_FILE_1 && \
rm $INSTALL_FILE_1 && \
$ORACLE_HOME/runInstaller -silent -force -waitforcompletion -responsefile $INSTALL_DIR/$INSTALL_RSP -ignorePrereqFailure && \
cd $HOME
if $SLIMMING; then
# Remove not needed components
# APEX
rm -rf $ORACLE_HOME/apex && \
# ORDS
rm -rf $ORACLE_HOME/ords && \
# SQL Developer
rm -rf $ORACLE_HOME/sqldeveloper && \
# UCP connection pool
rm -rf $ORACLE_HOME/ucp && \
# All installer files
rm -rf $ORACLE_HOME/lib/*.zip && \
# OUI backup
rm -rf $ORACLE_HOME/inventory/backup/* && \
# Network tools help
rm -rf $ORACLE_HOME/network/tools/help && \
# Database upgrade assistant
rm -rf $ORACLE_HOME/assistants/dbua && \
# Database migration assistant
rm -rf $ORACLE_HOME/dmu && \
# Remove pilot workflow installer
rm -rf $ORACLE_HOME/install/pilot && \
# Support tools
rm -rf $ORACLE_HOME/suptools && \
# Temp location
rm -rf /tmp/* && \
# Database files directory
rm -rf $INSTALL_DIR/database
fi
#!/bin/bash
# LICENSE UPL 1.0
#
# Copyright (c) 2020 Oracle and/or its affiliates. All rights reserved.
#
# Since: March, 2020
# Author: rishabh.y.gupta@oracle.com
# Description: Relinks oracle binary in accordance with the edition passed by the user.
#
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
#
LIB_EDITION="$(/usr/bin/ar t $ORACLE_HOME/lib/libedtn$($ORACLE_HOME/bin/oraversion -majorVersion).a)"
LIB_EDITION=$(echo ${LIB_EDITION} | cut -d. -f1)
LIB_EDITION=${LIB_EDITION: -3}
if [ "${LIB_EDITION}" == "ent" ]; then
CURRENT_EDITION="ENTERPRISE"
fi
if [ "${LIB_EDITION}" == "std" ]; then
CURRENT_EDITION="STANDARD"
fi
# If datafiles already exists
if [ -d $ORACLE_BASE/oradata/$ORACLE_SID ]; then
datafiles_edition=$(ls $ORACLE_BASE/oradata/dbconfig/$ORACLE_SID/.docker_* | rev | cut -d_ -f1 | rev)
if [ "${ORACLE_EDITION}" != "" ] && [ "${ORACLE_EDITION,,}" != $datafiles_edition ]; then
echo "The datafiles being used were created with $datafiles_edition edition software home. Please pass -e ORACLE_EDITION=$datafiles_edition to the docker run cmd.";
exit 1;
elif [ "${ORACLE_EDITION}" == "" ] && [ "${CURRENT_EDITION,,}" != $datafiles_edition ]; then
echo "The current software home is of ${CURRENT_EDITION,,} edition whereas the datafiles being used were created with $datafiles_edition edition software home. Please pass -e ORACLE_EDITION=$datafiles_edition to the docker run cmd.";
exit 1;
fi
fi
if [ "${ORACLE_EDITION}" != "" ]; then
if [ "${CURRENT_EDITION}" != "${ORACLE_EDITION^^}" ]; then
echo "Relinking oracle binary for edition: ${ORACLE_EDITION}";
cmd="make -f ${ORACLE_HOME}/rdbms/lib/ins_rdbms.mk edition_${ORACLE_EDITION,,} ioracle";
echo "$cmd";
$cmd;
CURRENT_EDITION=${ORACLE_EDITION^^}
fi
fi
echo "ORACLE EDITION: ${CURRENT_EDITION}"
touch $ORACLE_HOME/install/.docker_${CURRENT_EDITION,,}
#!/bin/bash
# LICENSE UPL 1.0
#
# Copyright (c) 1982-2018 Oracle and/or its affiliates. All rights reserved.
#
# Since: November, 2016
# Author: gerald.venzl@oracle.com
# Description: Runs the Oracle Database inside the container
#
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
#
########### Move DB files ############
function moveFiles {
if [ ! -d $ORACLE_BASE/oradata/dbconfig/$ORACLE_SID ]; then
mkdir -p $ORACLE_BASE/oradata/dbconfig/$ORACLE_SID/
fi;
mv $ORACLE_HOME/dbs/spfile$ORACLE_SID.ora $ORACLE_BASE/oradata/dbconfig/$ORACLE_SID/
mv $ORACLE_HOME/dbs/orapw$ORACLE_SID $ORACLE_BASE/oradata/dbconfig/$ORACLE_SID/
mv $ORACLE_HOME/network/admin/sqlnet.ora $ORACLE_BASE/oradata/dbconfig/$ORACLE_SID/
mv $ORACLE_HOME/network/admin/listener.ora $ORACLE_BASE/oradata/dbconfig/$ORACLE_SID/
mv $ORACLE_HOME/network/admin/tnsnames.ora $ORACLE_BASE/oradata/dbconfig/$ORACLE_SID/
mv $ORACLE_HOME/install/.docker_* $ORACLE_BASE/oradata/dbconfig/$ORACLE_SID/
# oracle user does not have permissions in /etc, hence cp and not mv
cp /etc/oratab $ORACLE_BASE/oradata/dbconfig/$ORACLE_SID/
symLinkFiles;
}
########### Symbolic link DB files ############
function symLinkFiles {
if [ ! -L $ORACLE_HOME/dbs/spfile$ORACLE_SID.ora ]; then
ln -s $ORACLE_BASE/oradata/dbconfig/$ORACLE_SID/spfile$ORACLE_SID.ora $ORACLE_HOME/dbs/spfile$ORACLE_SID.ora
fi;
if [ ! -L $ORACLE_HOME/dbs/orapw$ORACLE_SID ]; then
ln -s $ORACLE_BASE/oradata/dbconfig/$ORACLE_SID/orapw$ORACLE_SID $ORACLE_HOME/dbs/orapw$ORACLE_SID
fi;
if [ ! -L $ORACLE_HOME/network/admin/sqlnet.ora ]; then
ln -s $ORACLE_BASE/oradata/dbconfig/$ORACLE_SID/sqlnet.ora $ORACLE_HOME/network/admin/sqlnet.ora
fi;
if [ ! -L $ORACLE_HOME/network/admin/listener.ora ]; then
ln -s $ORACLE_BASE/oradata/dbconfig/$ORACLE_SID/listener.ora $ORACLE_HOME/network/admin/listener.ora
fi;
if [ ! -L $ORACLE_HOME/network/admin/tnsnames.ora ]; then
ln -s $ORACLE_BASE/oradata/dbconfig/$ORACLE_SID/tnsnames.ora $ORACLE_HOME/network/admin/tnsnames.ora
fi;
# oracle user does not have permissions in /etc, hence cp and not ln
cp $ORACLE_BASE/oradata/dbconfig/$ORACLE_SID/oratab /etc/oratab
}
########### SIGINT handler ############
function _int() {
echo "Stopping container."
echo "SIGINT received, shutting down database!"
sqlplus / as sysdba <<EOF
shutdown immediate;
exit;
EOF
lsnrctl stop
}
########### SIGTERM handler ############
function _term() {
echo "Stopping container."
echo "SIGTERM received, shutting down database!"
sqlplus / as sysdba <<EOF
shutdown immediate;
exit;
EOF
lsnrctl stop
}
###################################
# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! #
############# MAIN ################
# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! #
###################################
# Check whether container has enough memory
# Github issue #219: Prevent integer overflow,
# only check if memory digits are less than 11 (single GB range and below)
if [ `cat /sys/fs/cgroup/memory/memory.limit_in_bytes | wc -c` -lt 11 ]; then
if [ `cat /sys/fs/cgroup/memory/memory.limit_in_bytes` -lt 2147483648 ]; then
echo "Error: The container doesn't have enough memory allocated."
echo "A database container needs at least 2 GB of memory."
echo "You currently only have $((`cat /sys/fs/cgroup/memory/memory.limit_in_bytes`/1024/1024/1024)) GB allocated to the container."
exit 1;
fi;
fi;
# Check that hostname doesn't container any "_"
# Github issue #711
if hostname | grep -q "_"; then
echo "Error: The hostname must not container any '_'".
echo "Your current hostname is '$(hostname)'"
fi;
# Set SIGINT handler
trap _int SIGINT
# Set SIGTERM handler
trap _term SIGTERM
# Default for ORACLE SID
if [ "$ORACLE_SID" == "" ]; then
export ORACLE_SID=ORCLCDB
else
# Make ORACLE_SID upper case
# Github issue # 984
export ORACLE_SID=${ORACLE_SID^^}
# Check whether SID is no longer than 12 bytes
# Github issue #246: Cannot start OracleDB image
if [ "${#ORACLE_SID}" -gt 12 ]; then
echo "Error: The ORACLE_SID must only be up to 12 characters long."
exit 1;
fi;
# Check whether SID is alphanumeric
# Github issue #246: Cannot start OracleDB image
if [[ "$ORACLE_SID" =~ [^a-zA-Z0-9] ]]; then
echo "Error: The ORACLE_SID must be alphanumeric."
exit 1;
fi;
fi;
# Default for ORACLE PDB
export ORACLE_PDB=${ORACLE_PDB:-ORCLPDB1}
# Make ORACLE_PDB upper case
# Github issue # 984
export ORACLE_PDB=${ORACLE_PDB^^}
# Default for ORACLE CHARACTERSET
export ORACLE_CHARACTERSET=${ORACLE_CHARACTERSET:-AL32UTF8}
# Call relinkOracleBinary.sh before the database is created or started
. "$ORACLE_BASE/$RELINK_BINARY_FILE"
# Check whether database already exists
if [ -d $ORACLE_BASE/oradata/$ORACLE_SID ]; then
symLinkFiles;
# Make sure audit file destination exists
if [ ! -d $ORACLE_BASE/admin/$ORACLE_SID/adump ]; then
mkdir -p $ORACLE_BASE/admin/$ORACLE_SID/adump
fi;
# Start database
$ORACLE_BASE/$START_FILE;
else
# Remove database config files, if they exist
rm -f $ORACLE_HOME/dbs/spfile$ORACLE_SID.ora
rm -f $ORACLE_HOME/dbs/orapw$ORACLE_SID
rm -f $ORACLE_HOME/network/admin/sqlnet.ora
rm -f $ORACLE_HOME/network/admin/listener.ora
rm -f $ORACLE_HOME/network/admin/tnsnames.ora
# Create database
$ORACLE_BASE/$CREATE_DB_FILE $ORACLE_SID $ORACLE_PDB $ORACLE_PWD || exit 1;
# Move database operational files to oradata
moveFiles;
# Execute custom provided setup scripts
$ORACLE_BASE/$USER_SCRIPTS_FILE $ORACLE_BASE/scripts/setup
fi;
# Check whether database is up and running
$ORACLE_BASE/$CHECK_DB_FILE
if [ $? -eq 0 ]; then
echo "#########################"
echo "DATABASE IS READY TO USE!"
echo "#########################"
# Execute custom provided startup scripts
$ORACLE_BASE/$USER_SCRIPTS_FILE $ORACLE_BASE/scripts/startup
echo "DATABASE IS READY TO USE!" > /u01/status/database.status
else
echo "#####################################"
echo "########### E R R O R ###############"
echo "DATABASE SETUP WAS NOT SUCCESSFUL!" |& tee /u01/status/database.status
echo "Please check output for further info!"
echo "########### E R R O R ###############"
echo "#####################################"
fi;
# Tail on alert log and wait (otherwise container will exit)
echo "The following output is now a tail of the alert.log:"
tail -f $ORACLE_BASE/diag/rdbms/*/*/trace/alert*.log &
childPID=$!
wait $childPID
#!/bin/bash
# LICENSE UPL 1.0
#
# Copyright (c) 1982-2018 Oracle and/or its affiliates. All rights reserved.
#
# Since: July, 2017
# Author: gerald.venzl@oracle.com
# Description: Runs user shell and SQL scripts
#
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
#
SCRIPTS_ROOT="$1";
# Check whether parameter has been passed on
if [ -z "$SCRIPTS_ROOT" ]; then
echo "$0: No SCRIPTS_ROOT passed on, no scripts will be run";
exit 1;
fi;
# Execute custom provided files (only if directory exists and has files in it)
if [ -d "$SCRIPTS_ROOT" ] && [ -n "$(ls -A $SCRIPTS_ROOT)" ]; then
echo "";
echo "Executing user defined scripts"
for f in $SCRIPTS_ROOT/*; do
case "$f" in
*.sh) echo "$0: running $f"; . "$f" ;;
*.sql) echo "$0: running $f"; echo "exit" | $ORACLE_HOME/bin/sqlplus -s "/ as sysdba" @"$f"; echo ;;
*) echo "$0: ignoring $f" ;;
esac
echo "";
done
echo "DONE: Executing user defined scripts"
echo "";
fi;
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment