Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 912822d

Browse filesBrowse files
committed
Added configuration to decide between PDB/non-PDB setup
1 parent 7f5f173 commit 912822d
Copy full SHA for 912822d

File tree

6 files changed

+60
-57
lines changed
Filter options

6 files changed

+60
-57
lines changed

‎12.1.0.2-small-no-pdb/Dockerfile

Copy file name to clipboardExpand all lines: 12.1.0.2-small-no-pdb/Dockerfile
+3-1Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,9 @@ ENV ORACLE_BASE=/opt/oracle \
5353
CHECK_SPACE_FILE="checkSpace.sh" \
5454
INSTALL_DB_BINARIES_FILE="installDBBinaries.sh" \
5555
ORACLE_PWD="oracle" \
56-
ORACLE_PDB="ORCLPDB1"
56+
ORACLE_PDB="ORCLPDB1" \
57+
ORACLE_SID="ORCLCDB" \
58+
CREATE_PDB="false"
5759

5860
# Use second ENV so that variable get substituted
5961
ENV INSTALL_DIR=$ORACLE_BASE/install \

‎12.1.0.2-small-no-pdb/cleanupDB.sh

Copy file name to clipboardExpand all lines: 12.1.0.2-small-no-pdb/cleanupDB.sh
+26-6Lines changed: 26 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,5 @@
11
#!/bin/bash
2-
ORACLE_SID=$1
3-
# Check whether ORACLE_SID is passed on
4-
if [ "$ORACLE_SID" == "" ]; then
5-
ORACLE_SID=ORCL
6-
fi;
7-
export ORACLE_SID
2+
83

94
sqlplus / as sysdba << EOF
105
exec dbms_lock.sleep(30);
@@ -71,3 +66,28 @@ EOF
7166
rm -f $ORACLE_BASE/oradata/$ORACLE_SID/redo01.log
7267
rm -f $ORACLE_BASE/oradata/$ORACLE_SID/redo02.log
7368
rm -f $ORACLE_BASE/oradata/$ORACLE_SID/redo03.log
69+
70+
if [ "$CREATE_PDB" == "true" ]; then
71+
72+
sqlplus / as sysdba << EOF
73+
--PDBSEED
74+
ALTER PLUGGABLE DATABASE PDB\$SEED CLOSE;
75+
ALTER PLUGGABLE DATABASE PDB\$SEED OPEN READ WRITE;
76+
77+
ALTER SESSION SET CONTAINER = PDB\$SEED;
78+
--Initialize XDB in PDBSEED
79+
CREATE TABLE TEMP_XDB_INIT(DUMMY XMLTYPE);
80+
DROP TABLE TEMP_XDB_INIT;
81+
82+
EXEC EXECUTE IMMEDIATE :kill_sess_holding_rollback;
83+
--minimize size of UNDO TS
84+
CREATE UNDO TABLESPACE undotbs0 DATAFILE '$ORACLE_BASE/oradata/$ORACLE_SID/pdbseed/undotbs00.dbf' SIZE 1M AUTOEXTEND ON NEXT 1M;
85+
ALTER SYSTEM SET UNDO_TABLESPACE=undotbs0;
86+
DROP TABLESPACE undotbs1 INCLUDING CONTENTS AND DATAFILES;
87+
--minimize size of TEMP
88+
ALTER TABLESPACE temp SHRINK SPACE;
89+
90+
exit;
91+
EOF
92+
93+
fi;

‎12.1.0.2-small-no-pdb/createDB.sh

Copy file name to clipboardExpand all lines: 12.1.0.2-small-no-pdb/createDB.sh
+2-10Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,11 @@
55
#
66
# Since: November, 2016
77
# Author: gerald.venzl@oracle.com
8-
# Description: Creates an Oracle Database based on following parameters:
9-
# $ORACLE_SID: The Oracle SID and CDB name
10-
# $ORACLE_PDB: The PDB name
11-
#
8+
#
129
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
1310
#
1411

1512

16-
# Check whether ORACLE_SID is passed on
17-
export ORACLE_SID=${1:-ORCL}
18-
19-
# Check whether ORACLE_PDB is passed on
20-
export ORACLE_PDB=${2:-ORCLPDB1}
21-
2213
# Auto generate ORACLE PWD
2314
#ORACLE_PWD="`openssl rand -base64 8`1"
2415
echo "ORACLE AUTO GENERATED PASSWORD FOR SYS, SYSTEM AND PDBAMIN: $ORACLE_PWD";
@@ -29,6 +20,7 @@ sed -i -e "s|###ORACLE_SID###|$ORACLE_SID|g" $ORACLE_BASE/dbca.rsp
2920
sed -i -e "s|###ORACLE_PDB###|$ORACLE_PDB|g" $ORACLE_BASE/dbca.rsp
3021
sed -i -e "s|###ORACLE_PWD###|$ORACLE_PWD|g" $ORACLE_BASE/dbca.rsp
3122
sed -i -e "s|###ORACLE_CHARACTERSET###|$ORACLE_CHARACTERSET|g" $ORACLE_BASE/dbca.rsp
23+
sed -i -e "s|###CREATE_PDB###|$CREATE_PDB|g" $ORACLE_BASE/dbca.rsp
3224

3325
# Create network related config files (sqlnet.ora, tnsnames.ora, listener.ora)
3426
mkdir -p $ORACLE_HOME/network/admin

‎12.1.0.2-small-no-pdb/dbca.rsp.tmpl

Copy file name to clipboardExpand all lines: 12.1.0.2-small-no-pdb/dbca.rsp.tmpl
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ SID = "###ORACLE_SID###"
105105
# Default value : false
106106
# Mandatory : No
107107
#-----------------------------------------------------------------------------
108-
CREATEASCONTAINERDATABASE = "false"
108+
CREATEASCONTAINERDATABASE = "###CREATE_PDB###"
109109

110110
#-----------------------------------------------------------------------------
111111
# Name : NUMBEROFPDBS

‎12.1.0.2-small-no-pdb/runOracle.sh

Copy file name to clipboardExpand all lines: 12.1.0.2-small-no-pdb/runOracle.sh
+24-38Lines changed: 24 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -106,28 +106,18 @@ trap _term SIGTERM
106106
# Set SIGKILL handler
107107
trap _kill SIGKILL
108108

109-
# Default for ORACLE SID
110-
if [ "$ORACLE_SID" == "" ]; then
111-
export ORACLE_SID=ORCL
112-
else
113-
# Check whether SID is no longer than 12 bytes
114-
# Github issue #246: Cannot start OracleDB image
115-
if [ "${#ORACLE_SID}" -gt 12 ]; then
116-
echo "Error: The ORACLE_SID must only be up to 12 characters long."
117-
exit 1;
118-
fi;
119-
120-
# Check whether SID is alphanumeric
121-
# Github issue #246: Cannot start OracleDB image
122-
if [[ "$ORACLE_SID" =~ [^a-zA-Z0-9] ]]; then
123-
echo "Error: The ORACLE_SID must be alphanumeric."
124-
exit 1;
125-
fi;
109+
# Check whether SID is no longer than 12 bytes
110+
# Github issue #246: Cannot start OracleDB image
111+
if [ "${#ORACLE_SID}" -gt 12 ]; then
112+
echo "Error: The ORACLE_SID must only be up to 12 characters long."
113+
exit 1;
126114
fi;
127115

128-
# Default for ORACLE PDB
129-
if [ "$ORACLE_PDB" == "" ]; then
130-
export ORACLE_PDB=ORCLPDB1
116+
# Check whether SID is alphanumeric
117+
# Github issue #246: Cannot start OracleDB image
118+
if [[ "$ORACLE_SID" =~ [^a-zA-Z0-9] ]]; then
119+
echo "Error: The ORACLE_SID must be alphanumeric."
120+
exit 1;
131121
fi;
132122

133123
# Default for ORACLE CHARACTERSET
@@ -138,24 +128,20 @@ fi;
138128
# Start database
139129
$ORACLE_BASE/$START_FILE;
140130

141-
## Check whether database already exists
142-
#if [ -d $PDB_BASE_DIR/$ORACLE_PDB ]; then
143-
# symLinkFiles;
144-
#
145-
# # Make sure audit file destination exists
146-
# if [ ! -d $ORACLE_BASE/admin/$ORACLE_SID/adump ]; then
147-
# mkdir -p $ORACLE_BASE/admin/$ORACLE_SID/adump
148-
# fi;
149-
#
150-
#
151-
#
152-
#else
153-
#
154-
# # Create database
155-
# $ORACLE_BASE/$CREATE_PDB_FILE
156-
#
157-
#fi;
158-
131+
if [ "$CREATE_PDB" == "true" ]; then
132+
# Check whether database already exists
133+
if [ -d $PDB_BASE_DIR/$ORACLE_PDB ]; then
134+
symLinkFiles;
135+
136+
# Make sure audit file destination exists
137+
if [ ! -d $ORACLE_BASE/admin/$ORACLE_SID/adump ]; then
138+
mkdir -p $ORACLE_BASE/admin/$ORACLE_SID/adump
139+
fi;
140+
else
141+
# Create database
142+
$ORACLE_BASE/$CREATE_PDB_FILE
143+
fi;
144+
fi;
159145
# Check whether database prepare was already executed
160146
if [ ! -f $ORACLE_BASE/oradata/$ORACLE_SID/redo03.log ]; then
161147
# Prepare database

‎README.md

Copy file name to clipboardExpand all lines: README.md
+4-1Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,4 +33,7 @@ In case of any issues you have two choices:
3333
- change the image build configuration yourself
3434

3535
The image scrips are provided as they are, no support or reliability is offered. Use at your own risk.
36-
36+
37+
For small images you have an option to choose between PDB (Multi-tenant database) or non-PDB - (Single-tenant) database.
38+
39+
Edit the `Dockerfile` before build and set the flag: `CREATE_PDB="false"` or `CREATE_PDB="true"`

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.