Skip to content

Commit 3c428ff

Browse files
committed
Use /dev/shm for the started marker file
Because /dev/shm will be automatically wiped on container restarts.
1 parent 9f946bb commit 3c428ff

File tree

3 files changed

+7
-9
lines changed

3 files changed

+7
-9
lines changed

OracleDatabase/SingleInstance/dockerfiles/21.3.0/Dockerfile

+1
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ ENV ORACLE_BASE=/opt/oracle \
5959
INSTALL_DB_BINARIES_FILE="installDBBinaries.sh" \
6060
RELINK_BINARY_FILE="relinkOracleBinary.sh" \
6161
CONFIG_TCPS_FILE="configTcps.sh" \
62+
DB_STARTED_MARKER_FILE="/dev/shm/.db_started" \
6263
SLIMMING=$SLIMMING \
6364
ENABLE_ARCHIVELOG=false \
6465
ARCHIVELOG_DIR_NAME=archive_logs \

OracleDatabase/SingleInstance/dockerfiles/21.3.0/checkDBStatus.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,8 @@ EOF
7373
################ MAIN #######################
7474
#############################################
7575

76-
if [ "${BYPASS_STARTED_MARKER:-false}" = false ] && [ ! -f /tmp/.oracle_database_started ]; then
77-
echo "Database was not started yet" >&2
76+
if [ "$IGNORE_DB_STARTED_MARKER" != true ] && [ ! -f "$DB_STARTED_MARKER_FILE" ]; then
77+
echo "Database was not started yet." >&2
7878
exit 1
7979
fi
8080

OracleDatabase/SingleInstance/dockerfiles/21.3.0/runOracle.sh

+4-7
Original file line numberDiff line numberDiff line change
@@ -113,9 +113,6 @@ EOF
113113
# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! #
114114
###################################
115115

116-
# Marker file for the healthcheck
117-
rm -f /tmp/.oracle_database_started
118-
119116
# Check whether container has enough memory
120117
if [[ -f /sys/fs/cgroup/cgroup.controllers ]]; then
121118
memory=$(cat /sys/fs/cgroup/memory.max)
@@ -283,7 +280,7 @@ else
283280
"$ORACLE_BASE"/"$CREATE_DB_FILE" $ORACLE_SID "$ORACLE_PDB" "$ORACLE_PWD" || exit 1;
284281

285282
# Check whether database is successfully created
286-
if BYPASS_STARTED_MARKER=true "$ORACLE_BASE"/"$CHECK_DB_FILE"; then
283+
if IGNORE_DB_STARTED_MARKER=true "$ORACLE_BASE"/"$CHECK_DB_FILE"; then
287284
# Create a checkpoint file if database is successfully created
288285
# Populate the checkpoint file with the current date to avoid timing issue when using NFS persistence in multi-replica mode
289286
echo "$(date -Iseconds)" > "$ORACLE_BASE"/oradata/.${ORACLE_SID}"${CHECKPOINT_FILE_EXTN}"
@@ -306,7 +303,7 @@ else
306303
fi;
307304

308305
# Check whether database is up and running
309-
BYPASS_STARTED_MARKER=true "$ORACLE_BASE"/"$CHECK_DB_FILE"
306+
IGNORE_DB_STARTED_MARKER=true "$ORACLE_BASE"/"$CHECK_DB_FILE"
310307
status=$?
311308

312309
# Check whether database is up and running
@@ -321,8 +318,8 @@ if [ $status -eq 0 ]; then
321318
# Execute custom provided startup scripts
322319
"$ORACLE_BASE"/"$USER_SCRIPTS_FILE" "$ORACLE_BASE"/scripts/startup
323320

324-
# Marker file for the healthcheck
325-
touch /tmp/.oracle_database_started
321+
# Create marker file for the healthcheck
322+
touch "$DB_STARTED_MARKER_FILE"
326323
else
327324
echo "#####################################"
328325
echo "########### E R R O R ###############"

0 commit comments

Comments
 (0)