├── .gitattributes ├── .gitignore ├── README.md ├── bashrc19 ├── bashrc21 ├── buildDBImage.sh ├── config ├── dbca.11.2.0.4.rsp ├── dbca.12.1.rsp ├── dbca.12.2.rsp ├── dbca.18.3.rsp ├── dbca.18.4.rsp ├── dbca.19.rsp ├── dbca.21.rsp ├── dbca.23.rsp ├── env.tmpl ├── init.ora.tmpl ├── inst.11.2.0.4.rsp ├── inst.12.1.rsp ├── inst.12.2.rsp ├── inst.18.3.rsp ├── inst.18.4.rsp ├── inst.19.rsp ├── inst.21.rsp ├── inst.23.rsp ├── listener.ora.tmpl ├── login.sql.tmpl ├── manifest ├── netrc.example ├── old │ ├── manifest.11.2.0.2 │ ├── manifest.11.2.0.4 │ ├── manifest.12.1 │ ├── manifest.12.2 │ ├── manifest.18.3 │ ├── manifest.19 │ └── manifest.21 ├── rlwrap.tmpl ├── sqlnet.ora.tmpl └── tnsnames.ora.tmpl ├── database ├── README.md └── patches │ └── README.md ├── functions.sh ├── manageOracle.sh └── templates ├── db.dockerfile ├── db.dockerignore ├── oraclelinux.dockerfile └── oraclelinux.dockerignore /.gitattributes: -------------------------------------------------------------------------------- 1 | *.sh eol=lf 2 | *.conf eol=lf 3 | *.rsp eol=lf 4 | manifest.* eol=lf linguist-language=text 5 | Dockerfile.* eol=lf 6 | Dockerfile.* linguist-detectable=true 7 | Dockerfile.* linguist-language=Dockerfile 8 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.bak 2 | *.swp 3 | */**/*.zip 4 | */**/*.rpm 5 | .dockerignore 6 | #*/install/patches/0* 7 | /config/.mos 8 | /config/.netrc 9 | Dockerfile.db.* 10 | Dockerfile.oraclelinux.* 11 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # cloud-native-oracle 2 | A repository of container image builds for Oracle databases, with support for Intel, Apple Silicon, and ARM processors. 3 | 4 | Jump to a section: 5 | - [Build an image](#build-an-image) 6 | - [Build options and examples](#build-options-and-examples) 7 | - [Build example: Apple Silicon/ARM systems](#build-example-macs-with-apple-siliconarm-systems) 8 | - [Build example: Intel-based systems](#build-example-intel-based-systems-linux-mac-windows) 9 | - [Note for OSX Users](#note-for-osx-users) 10 | - [Run a container](#run-a-container) 11 | - [Examples: Run Oracle Database containers](#run-options-and-examples) 12 | - [Build and run on Apple Silicon/ARM systems](#example-for-apple-silicon) 13 | - [Directory structure](#directory-structure) 14 | - [Where to put files](#file-placement) 15 | - [Why this Repo](#why-this-repo) 16 | - [Features](#features) 17 | - [Errata](#errata) 18 | 19 | # Build an image 20 | One [reason behind this repo](#why-this-repo) was reducing duplication. I wanted one set of scripts (not one-per-version) and less maintenance. That created a need for more than one Dockerfile (one per version) because building 11g and 21c images is *mostly* boilerplate, but not entirely, and Dockerfiles don't take variables. This repo solves that by taking boilerplate Dockerfile templates, processing them to substitute variables, and using them for the build. Named Dockerfiles enable matching .dockerignore files to limit context. But, every version still needs a unique Dockerfile. Rather than polluting the directory with versioned Dockerfiles run directly with `docker build` I'm hiding the complexity with temporary files and a shell script. Version and edition information passed to the script generates temporary Dockerfile and .dockerignore files, runs `docker build`, then deletes the temporary file. 21 | 22 | This is a temporary workaround. I'm working on integrating new capabilities but until then, `buildDBImage.sh` manages Dockerfiles and builds. 23 | 24 | ## Build options and examples 25 | To build a database image, run `buildDBImage.sh` and pass optional values: 26 | ``` 27 | ./buildDBImage.sh [Options] 28 | Options: 29 | --build-arg stringArray Set build-time variables 30 | -d, --debug Turn on build debugging 31 | -e, --edition string Set the database edition 32 | EE: Enterprise Edition (Default) 33 | SE: Standard Edition 34 | XE: Express Edition (Versions 11.2.0.2, 18.4, 23.1.0 only) 35 | --force-patch string Force patch download from MOS 36 | all: Re-download all patches during install 37 | opatch: Re-download opatch only 38 | patch: Re-download patches but not opatch 39 | --force-rm Force-remove build cache 40 | -k, --dockerfile-keep Keep the dynamically generated Dockerfile after build completion 41 | -n, --image-name string Repository name for the completed image (Default: oracle/db) 42 | --no-cache Do not use cache when building the image 43 | --no-sum Do not perform file checksums 44 | --progress string Display build progress 45 | auto (Default) 46 | plain: Show container output 47 | tty: Show abbreviated output 48 | --prune-cache Prune build cache on success 49 | -q, --quiet Suppress build output 50 | -r, --force-rebuild Force rebuild the base Linux image if it exists 51 | --read-only-home Configure a Read-Only Oracle Home 52 | --remove-components string Comma-delimited list of components to remove 53 | Options: DBMA,HELP,ORDS,OUI,PATCH,PILOT,SQLD,SUP,UCP,TCP,ZIP,INV,DBCA,ADMIN,ROH 54 | Default is all of the above 55 | --rpm stringArray Comma-delimited list of binaries/libraries to install 56 | Default: bash-completion,git,less,strace,tree,vi,which 57 | --secret string File name containing MOS credentials for patch download 58 | -S, --source-image string Source OS image repository (Default: oraclelinux) 59 | -T, --source-tag string Source OS tag (Default: 8-slim) 60 | -t, --tag string Tag for the completed image (Default: [ORACLE_VERSION]-[ORACLE_EDITION]) 61 | -v, --version string Oracle Database version (Default: 19.19) 62 | The version must exist in the manifest file within the ./config directory 63 | -h, --help This menu 64 | ``` 65 | Images created by the script are named as: `[repository]:[version]-[edition]` 66 | It additionally creates a version-specific Linux image: `[source]-[tag]-[base_version]` where the base version is 11g, 12.1, 12.2, 18c, 19c, or 21c. This Linux image includes the database prerequisites for the given version and makes building multiple database images for the same database version faster. The majority of the build time is spent applying prerequisite RPMs. The build understands if a version-ready image is present and uses it. 67 | 68 | ### Build example: Macs with Apple Silicon/ARM Systems 69 | The only database currently supported for ARM architectures is Oracle 19.19. 70 | - [Download the Oracle Database 19c for LINUX ARM (aarch64)](https://www.oracle.com/database/technologies/oracle-database-software-downloads.html#db_ee) zip file and place it in the `database` subdirectory. Do not unzip the file. 71 | - From the base directory, run the `buildDBImage.sh` script: 72 | ``` 73 | ./buildDBImage.sh 74 | # or: 75 | ./buildDBImage.sh 19.19 EE 76 | ``` 77 | This will create two images 78 | - A "database-ready" Oracle Enterprise Linux image, with `git`, `less`, `strace`, `tree`, `vi`, `which`, `bash-completion`, and `rlwrap` installed. 79 | - Change these by editing the `RPM_LIST` in `templates/oraclelinux.dockerfile`, or pass a build argument. 80 | - A database image with a default `ORACLE_BASE` under `/u01/app/oracle` and an `ORACLE_HOME` under `$ORACLE_BASE/product/19c/dbhome_1`. 81 | - Change these by editing the entries in `templates/db.dockerfile`, or pass build arguments for each parameter. 82 | 83 | ### Build example: Intel-based systems (Linux, Mac, Windows) 84 | All database versions are supported. 85 | - Download the appropriate installation file and place it in the `database` subdirectory. 86 | - Download any patches to be installed and place them in the `database/patches` subdirectory. 87 | - Update the `config/manifest` file if necessary. See the `README` file under `database` for details on formatting. 88 | - From the base directory, run the `buildDBImage.sh` script, passing the appropriate database version, edition, and OS version: 89 | ``` 90 | # Oracle 11g: 91 | ./buildDBImage.sh 11.2.0.4 EE 7-slim 92 | # Oracle 12.1: 93 | ./buildDBImage.sh 12.1.0.1 EE 7-slim 94 | # Oracle 12.2: 95 | ./buildDBImage.sh 12.2 EE 7-slim 96 | # Oracle 18c: 97 | ./buildDBImage.sh 18.3 EE 7-slim 98 | # Oracle 19c: 99 | ./buildDBImage.sh 19 EE 100 | # or, to build a specific version: 101 | ./buildDBImage.sh EE 102 | # ... where is the RU to apply atop the base 19.3 103 | # Oracle 21c: 104 | ./buildDBImage.sh 21 EE 105 | # or, to build a specific version: 106 | ./buildDBImage.sh EE 107 | # ... where is the RU to apply atop the base 21.3 108 | ``` 109 | 110 | ### Note for OSX users 111 | The default `/bin/bash` on OSX is 3.2, and the natively installed version of `getopt` is not GNU-compatible, meaning you won't be able to pass any parameters to the build script. To get around this limitation, install `bash` and `gnu-getopt` via `brew`: 112 | ``` 113 | brew update 114 | brew install bash 115 | brew install gnu-getopt 116 | ``` 117 | Add the following line to your `$HOME/.bash_profile` to pre-empt the default `getopt` (replace the path to `gnu-getopt` if `brew` installs to a different location on your system): 118 | ``` 119 | export PATH="/opt/homebrew/opt/gnu-getopt/bin:$PATH" 120 | ``` 121 | Then, `source $HOME/.bash_profile` and confirm that `getopt -V` returns the version (and not `--`). 122 | 123 | As a workaround, edit the script and hardcode the options that would be set interactively. 124 | 125 | ## FORCE_PATCH and `.netrc` 126 | When a `'.netrc` file is present, the `FORCE_PATCH` build argument enables patch downloads from My Oracle Support. Patches are downloaded when: 127 | - patches listed in the manifest aren't present in the build context (not added to the `./database/patches` directory) 128 | - the checksum of a patch doesn't match the value in the manifest 129 | - the `FORCE_PATCH` argument matches the patch type 130 | - the `FORCE_PATCH` argument includes the numeric patch ID 131 | 132 | `FORCE_PATCH` may have multiple options, separated by commas: 133 | - `all`: Download all patches listed in the manifest. 134 | - `opatch`: Download the latest version of `opatch`. 135 | - `patch`: Download patches but not `opatch`. 136 | - Patch ID: The numeric patch ID of patches to download. 137 | 138 | Pass the FORCE_PATCH value to `docker build` as `--build-arg FORCE_PATCH=(,,)` 139 | 140 | The `.netrc` file is passed to the build process in an intermediate stage as a build secret. It is not copied to the final database image. 141 | 142 | # Run a container 143 | Run database containers as you would normally, using `docker run [options] [image-name]`. 144 | 145 | ## Run options and examples 146 | Options are controlled by environment variables set via the `docker run -e` flag: 147 | - `PDB_COUNT`: Create non-container databases by setting this value to 0, or set the number of pluggable databases to be spawned. 148 | - `CREATE_CONTAINER`: Ture/false, an alternate method for creating a non-CDB database. 149 | - `ORACLE_PDB`: This is the prefix for the PDB's (when PDB_COUNT > 1) or the PDB_NAME (when PDB_COUNT=1, the default). 150 | - `DB_UNQNAME`: Set the database Unique Name. Default is ORACLE_SID; used mainly for creating containers used for Data Guard where the database and unique names are different, and avoids generating multiple diagnostic directory trees. 151 | - `PDB_LIST`: A comma-delimited list of PDB names. When present, overrides the PDB_COUNT and ORACLE_PDB values. 152 | - `ORACLE_CHARACTERSET` and `ORACLE_NLS_CHARACTERSET`: Set database character sets. 153 | - `INIT_PARAMS`: A list of parameters to set in the database at creation time. The default sets the DB_CREATE_FILE_DEST, DB_CREATE_ONLINE_LOG_DEST_1, and DB_RECOVERY_FILE_DEST to $ORADATA (enabling OMF) and turns off auditing. 154 | - `DEBUG="bash -x"`: Debug container creation. 155 | 156 | Create a non-container database: 157 | `docker run -d -e PDB_COUNT=0 IMG_NAME` 158 | 159 | Create a container database with custom SID and PDB name: 160 | `docker run -d -e ORACLE_SID=mysid -e ORACLE_PDB=mypdb IMG_NAME` 161 | 162 | Create a container database with a default SID and three PDB named mypdb[1,2,3]: 163 | `docker run -d -e PDB_COUNT=3 -e ORACLE_PDB=mypdb IMG_NAME` 164 | 165 | Create a container database with custom SID and named PDB: 166 | `docker run -d -e ORACLE_SID=mydb -e PDB_LIST="test,dev,prod" IMG_NAME` 167 | 168 | Users running ARM/Apple Silicon do not need to do anything differently. On ARM/Apple Silicon, the build process creates an architecture-native image that runs without needing any special commands or virtualization (Colima, etc). 169 | 170 | # Example for Apple Silicon 171 | This is an example of the output seen on a 2021 Apple MacBook Pro (M1, 16GB RAM, Ventura 13.4.1, Docker version 23.0.0, build e92dd87c32): 172 | ``` 173 | 174 | # ./buildDBImage.sh 175 | [+] Building 51.6s (8/8) FINISHED docker:desktop-linux 176 | => [internal] load .dockerignore 0.0s 177 | => => transferring context: 2B 0.0s 178 | => [internal] load build definition from Dockerfile.oraclelinux.202307031409.jTxd 0.0s 179 | => => transferring dockerfile: 1.55kB 0.0s 180 | => [internal] load metadata for docker.io/library/oraclelinux:8-slim 1.3s 181 | => [internal] load build context 0.0s 182 | => => transferring context: 45.06kB 0.0s 183 | => CACHED [1/3] FROM docker.io/library/oraclelinux:8-slim@sha256:0226d80b442e93f977753e1d 0.0s 184 | => => resolve docker.io/library/oraclelinux:8-slim@sha256:0226d80b442e93f977753e1d269c8ec 0.0s 185 | => [2/3] COPY manageOracle.sh /opt/scripts/ 0.0s 186 | => [3/3] RUN chmod ug+x /opt/scripts/manageOracle.sh && /opt/scripts/manageOracle.sh 48.7s 187 | => exporting to image 1.5s 188 | => => exporting layers 1.5s 189 | => => writing image sha256:6cdb5ddeb9d8ffbfcaeba0cb1fad0c003dbffc3cd77b204a8ddc60292e184b 0.0s 190 | => => naming to docker.io/library/oraclelinux:8-slim-19c 0.0s 191 | oraclelinux:8-slim-19c 192 | [+] Building 193.8s (21/21) FINISHED docker:desktop-linux 193 | => [internal] load .dockerignore 0.0s 194 | => => transferring context: 2B 0.0s 195 | => [internal] load build definition from Dockerfile.db.202307031410.NUni 0.0s 196 | => => transferring dockerfile: 5.11kB 0.0s 197 | => resolve image config for docker.io/docker/dockerfile:1.4 0.9s 198 | => CACHED docker-image://docker.io/docker/dockerfile:1.4@sha256:9ba7531bd80fb0a858632727c 0.0s 199 | => [internal] load metadata for docker.io/library/oraclelinux:8-slim-19c 0.0s 200 | => [db 1/6] FROM docker.io/library/oraclelinux:8-slim-19c 0.0s 201 | => [internal] load build context 38.5s 202 | => => transferring context: 2.42GB 38.5s 203 | => [db 2/6] COPY --chown=oracle:oinstall manageOracle.sh /opt/scripts/ 0.6s 204 | => [stage-1 2/9] COPY --chown=oracle:oinstall ./config/dbca.* /opt/install/ 0.6s 205 | => [stage-1 3/9] COPY --chown=oracle:oinstall ./config/*.tmpl /opt/install/ 0.0s 206 | => [db 3/6] COPY --chown=oracle:oinstall ./config/inst.* /opt/install/ 0.0s 207 | => [db 4/6] COPY --chown=oracle:oinstall ./config/manifest.* /opt/install/ 0.0s 208 | => [stage-1 4/9] COPY --chown=oracle:oinstall manageOracle.sh /opt/scripts/ 0.0s 209 | => [db 5/6] COPY --chown=oracle:oinstall ./database/ /opt/install/ 6.3s 210 | => [db 6/6] RUN chmod ug+x /opt/scripts/manageOracle.sh && /opt/scripts/manageOracl 98.9s 211 | => [stage-1 5/9] COPY --chown=oracle:oinstall --from=db /u01/app/oraInventory /u01/app/o 0.0s 212 | => [stage-1 6/9] COPY --chown=oracle:oinstall --from=db /u01/app/oracle /u01/app/oracle 18.6s 213 | => [stage-1 7/9] COPY --chown=oracle:oinstall --from=db /opt/oracle/oradata /opt/orac 0.0s 214 | => [stage-1 8/9] RUN /opt/scripts/manageOracle.sh -R 0.5s 215 | => [stage-1 9/9] WORKDIR /home/oracle 0.0s 216 | => exporting to image 17.6s 217 | => => exporting layers 17.6s 218 | => => writing image sha256:4874efbbfe1cfb271e314ed8d6d0773e5a270d1a0b789861af76e59d4b6f82 0.0s 219 | => => naming to docker.io/oraclesean/db:19.19-EE 0.0s 220 | ``` 221 | 222 | Total build time was 245.4 seconds. After building the image: 223 | ``` 224 | # docker images 225 | REPOSITORY TAG IMAGE ID CREATED SIZE 226 | oraclesean/db 19.19-EE 4874efbbfe1c About an hour ago 5.87GB 227 | oraclelinux 8-slim-19c 6cdb5ddeb9d8 About an hour ago 690MB 228 | ``` 229 | 230 | The ARM image size is about 2GB smaller than its corresponding Intel-based image. 231 | 232 | Here's an example of running a network and container, with volumes defined for data, database logs, the audit directory, and a scripts directory. 233 | 234 | ## Create a network (optional) 235 | This creates a network called `oracle-db`. This step is optional; if you elect to not create a network here, be sure to remove the network assignment from the `docker run` command. 236 | ``` 237 | docker network create oracle-db --attachable --driver bridge 238 | ``` 239 | 240 | ## Set the container name and data path 241 | Set a name for the container and a path to mount bind volumes. 242 | ``` 243 | CONTAINER_NAME=ARM 244 | ORADATA=~/oradata 245 | ``` 246 | 247 | ## Create volumes 248 | I cannot overemphasize the value of volumes for Oracle databases. They persist data outside the container and make data independent of the container itself. Putting volatile directories outside the container's filesystem improves performance. And, volumes don't "hide" data in the `/var/lib/docker` directory of the virtual machine. You have better visibility into space use, and you're far less likely to fill the VM's disk. 249 | 250 | ## Create a script directory (optional) 251 | This creates a shared directory in the container for saving/sharing files between container and host. If you bypass this step, be sure to remove the corresponding definition from the `docker run` command later. 252 | ``` 253 | mkdir -p $ORADATA/scripts 254 | ``` 255 | 256 | ## Create the audit, data, and diagnostic directories 257 | This creates separate subdirectories for each file type and bind mounts them to Docker volumes. Assigning them to Docker volumes means they're visible in the Docker Desktop tool, as well as through the CLI via `docker volume ls` and other commands. 258 | ``` 259 | for dir in audit data diag reco 260 | do mkdir -p $ORADATA/${CONTAINER_NAME}/${dir} 261 | rm -fr $ORADATA/${CONTAINER_NAME}/${dir}/* 262 | docker volume rm ${CONTAINER_NAME}_${dir} 2>/dev/null 263 | docker volume create --opt type=none --opt o=bind \ 264 | --opt device=$ORADATA/${CONTAINER_NAME}/${dir} \ 265 | ${CONTAINER_NAME}_${dir} 266 | done 267 | ``` 268 | 269 | ## Remove the container (if it already exists) 270 | If you created a container by the same name, remove it before recreating it. 271 | ``` 272 | docker rm -f $CONTAINER_NAME 2>/dev/null 273 | ``` 274 | 275 | ## Create the container 276 | In the following command, I'm creating a container named `$CONTAINER_NAME`, then: 277 | - Mapping volumes for data (`/opt/oracle/oradata`), log data (`/u01/app/oracle/diag`), audit files (`/u01/app/oracle/admin`), and a shared directory for scripts (`/scripts`) 278 | - Assigning the container to a network called `oracle-db` 279 | - Setting the database SID 280 | - Setting the name of the PDB to ${CONTAINER_NAME}PDB1 281 | - Mapping port 8080 in the container to port 8080 on the host 282 | - Mapping port 1521 in the container to port 51521 on the host 283 | ``` 284 | docker run -d \ 285 | --name ${CONTAINER_NAME} \ 286 | --volume ${CONTAINER_NAME}_data:/u02/app/oracle/oradata \ 287 | --volume ${CONTAINER_NAME}_diag:/u01/app/oracle/diag \ 288 | --volume ${CONTAINER_NAME}_audit:/u01/app/oracle/admin \ 289 | --volume ${CONTAINER_NAME}_reco:/u03/app/oracle \ 290 | --volume $ORADATA/scripts:/scripts \ 291 | --network oracle-db \ 292 | -e ORACLE_SID=${CONTAINER_NAME} \ 293 | -e ORACLE_PDB=${CONTAINER_NAME}PDB1 \ 294 | -p 8080:8080 \ 295 | -p 51521:1521 \ 296 | oracle/db:19.19-EE 297 | ``` 298 | 299 | Add or remove options as you see fit. 300 | 301 | ## Monitor the database creation and logs 302 | View the database activity: 303 | ``` 304 | docker logs -f $CONTAINER_NAME 305 | ``` 306 | 307 | Sample output from a database: 308 | ``` 309 | # docker logs -f $CONTAINER_NAME 310 | 311 | # ----------------------------------------------------------------------------------------------- # 312 | Oracle password for SYS, SYSTEM and PDBADMIN: HB#K_xhkwM_O10 313 | # ----------------------------------------------------------------------------------------------- # 314 | 315 | # ----------------------------------------------------------------------------------------------- # 316 | runDBCA: Running DBCA for database ARM at 2023-07-03 20:16:05 317 | # ----------------------------------------------------------------------------------------------- # 318 | 319 | LSNRCTL for Linux: Version 19.0.0.0.0 - Production on 03-JUL-2023 20:16:05 320 | 321 | Copyright (c) 1991, 2023, Oracle. All rights reserved. 322 | 323 | Starting /u01/app/oracle/product/19c/dbhome_1/bin/tnslsnr: please wait... 324 | 325 | TNSLSNR for Linux: Version 19.0.0.0.0 - Production 326 | System parameter file is /u01/app/oracle/product/19c/dbhome_1/network/admin/listener.ora 327 | Log messages written to /u01/app/oracle/diag/tnslsnr/96bb65f2a1b7/listener/alert/log.xml 328 | Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1))) 329 | Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=0.0.0.0)(PORT=1521))) 330 | 331 | Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1))) 332 | STATUS of the LISTENER 333 | ------------------------ 334 | Alias LISTENER 335 | Version TNSLSNR for Linux: Version 19.0.0.0.0 - Production 336 | Start Date 03-JUL-2023 20:16:06 337 | Uptime 0 days 0 hr. 0 min. 0 sec 338 | Trace Level off 339 | Security ON: Local OS Authentication 340 | SNMP OFF 341 | Listener Parameter File /u01/app/oracle/product/19c/dbhome_1/network/admin/listener.ora 342 | Listener Log File /u01/app/oracle/diag/tnslsnr/96bb65f2a1b7/listener/alert/log.xml 343 | Listening Endpoints Summary... 344 | (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1))) 345 | (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=0.0.0.0)(PORT=1521))) 346 | Services Summary... 347 | Service "ARM" has 1 instance(s). 348 | Instance "ARM", status UNKNOWN, has 1 handler(s) for this service... 349 | The command completed successfully 350 | # ----------------------------------------------------------------------------------------------- # 351 | runDBCA: Creating container database ARM and 3 pluggable database(s) with name ARMPDB at 2023-07-03 20:16:06 352 | # ----------------------------------------------------------------------------------------------- # 353 | Prepare for db operation 354 | 8% complete 355 | Copying database files 356 | 31% complete 357 | Creating and starting Oracle instance 358 | 32% complete 359 | 36% complete 360 | 40% complete 361 | 43% complete 362 | 46% complete 363 | Completing Database Creation 364 | 51% complete 365 | 54% complete 366 | Creating Pluggable Databases 367 | 58% complete 368 | 63% complete 369 | 68% complete 370 | 77% complete 371 | Executing Post Configuration Actions 372 | 100% complete 373 | Database creation complete. For details check the logfiles at: 374 | /u01/app/oracle/cfgtoollogs/dbca/ARM. 375 | Database Information: 376 | Global Database Name:ARM 377 | System Identifier(SID):ARM 378 | Look at the log file "/u01/app/oracle/cfgtoollogs/dbca/ARM/ARM.log" for further details. 379 | 380 | Pluggable database altered. 381 | 382 | Pluggable database altered. 383 | 384 | # ----------------------------------------------------------------------------------------------- # 385 | runDBCA: DBCA complete at 2023-07-03 20:26:37 386 | # ----------------------------------------------------------------------------------------------- # 387 | 388 | # ----------------------------------------------------------------------------------------------- # 389 | Database ARM with unique name ARM is open and available. 390 | # ----------------------------------------------------------------------------------------------- # 391 | 392 | # ----------------------------------------------------------------------------------------------- # 393 | Tailing alert_ARM.log: 394 | 2023-07-03T20:26:36.493063+00:00 395 | ARMPDB3(5):CREATE SMALLFILE TABLESPACE "USERS" LOGGING DATAFILE '/opt/oracle/oradata/ARM/ARMPDB3/users01.dbf' SIZE 5M REUSE AUTOEXTEND ON NEXT 1280K MAXSIZE UNLIMITED EXTENT MANAGEMENT LOCAL SEGMENT SPACE MANAGEMENT AUTO 396 | ARMPDB3(5):Completed: CREATE SMALLFILE TABLESPACE "USERS" LOGGING DATAFILE '/opt/oracle/oradata/ARM/ARMPDB3/users01.dbf' SIZE 5M REUSE AUTOEXTEND ON NEXT 1280K MAXSIZE UNLIMITED EXTENT MANAGEMENT LOCAL SEGMENT SPACE MANAGEMENT AUTO 397 | ARMPDB3(5):ALTER DATABASE DEFAULT TABLESPACE "USERS" 398 | ARMPDB3(5):Completed: ALTER DATABASE DEFAULT TABLESPACE "USERS" 399 | 2023-07-03T20:26:37.882084+00:00 400 | alter pluggable database all open 401 | Completed: alter pluggable database all open 402 | alter pluggable database all save state 403 | Completed: alter pluggable database all save state 404 | ``` 405 | 406 | Database creation took about 10 minutes; note that this output is for a CDB with three Pluggable Databases (PDB). 407 | 408 | # Directory Structure 409 | Three subdirectories contain the majority of assets and configuration needed by images. 410 | 411 | ## `./config` 412 | Here you'll find version-specific files and configuration, including: 413 | - `dbca..rsp`: Every version of Oracle seems to introduce new options and features for Database Configuration Assistant (DBCA). Each version-specific file includes options with default and placeholder values. During database creation, the script replaces placeholders with values passed to the container at runtime via the `-e` option. 414 | - `inst..rsp`: The database install response files, like the DBCA response files, include default and placeholder values for customizing database installation for any version of Oracle. The script updates the placeholder values with those present in the Dockerfile or given to the build operation through a `--build-arg` option. 415 | - `manifest`: The manifest file includes information for all database and/or patch versions: 416 | ``` 417 | # md5sum File name Type Version Other 418 | 1858bd0d281c60f4ddabd87b1c214a4f LINUX.X64_193000_db_home.zip database 19 SE,EE 419 | #1f86171d22137e31cc2086bf7af36e91 oracle-database-ee-19c-1.0-1.x86_64.rpm database 19 SE,EE 420 | b8e1367997544ab2790c5bcbe65ca805 p6880880_190000_Linux-x86-64.zip opatch 19 6880880 421 | 2a06e8c7409b21de9be6d404d39febda p30557433_190000_Linux-x86-64.zip patch 19.6 30557433 422 | 0e0831a46cc3f8312a761212505ba5d1 p30565805_196000DBRU_Linux-x86-64.zip patch 19.6 30565805 423 | ... 424 | 5b2f369f6c1f0397c656a5554bc864e6 p33192793_190000_Linux-x86-64.zip patch 19.13 33192793 425 | 680af566ae1ed41a9916dfb0a122565c p33457235_1913000DBRU_Linux-x86-64.zip patch 19.13 33457235 426 | 30eb702fe0c1bee393bb80ff8f10afe9 p33516456_190000_Linux-x86-64.zip patch 19.13.1 33516456 427 | de8c41d94676479b9aa35d66ca11c96a p33457235_1913100DBRUR_Linux-x86-64.zip patch 19.13.1 33457235 428 | 7bcfdcd0f3086531e232fd0237b7438f p33515361_190000_Linux-x86-64.zip patch 19.14 33515361 429 | fd96f9db3c1873dfee00efe8088186a4 p33912872_190000_Linux-x86-64.zip patch 19 33912872 430 | ``` 431 | 432 | Column layout: 433 | - md5sum: The md5sum used for verification/check. 434 | - File name: Asset file name. 435 | - Type: Identifies the type of file. Possible values: 436 | - `database`: A file for installing database software. May be a .zip or .rpm file. 437 | - `opatch`: The OPatch file for this database version. 438 | - `patch`: Individual (non-OPatch) patch files. 439 | - Version: The database version the file applies to. Possible values: 440 | - database, opatch: The "base version" (in this example, 19). 441 | - patch: The patch version (eg 19.13 or 19.13.1). When a patch (or version) has multiple files, enter files in apply order, first to last. 442 | - Other: 443 | - database: Indicates Edition support. 444 | - `SE`: Standard Edition, Standard Edition 2 445 | - `EE`: Enterprise Edition 446 | - `SE,EE`: All editions 447 | - `XE`: Express Edition 448 | - opatch, patch: The patch number. 449 | 450 | Lines beginning with a `#` are ignored as comments. 451 | 452 | In this example, the patch number `33457235` appears twice, once for 19.13 and agains for 19.13.1, but there are version-specific files/checksums. 453 | Patch 33912872 appears once, with a generic version. This patch is applicable to any release but must be applied after the RU. The build process evaluates patches in order, so it will apply this general patch last. 454 | 455 | Additional template files exist in this directory (I will eventually move them to the `template` directory for consistency). There are three categories: 456 | - TNS configurations. Templates for setting up listener and networking configurations. Customize as necessary. During initial database creation, the files are copied to their proper locations and variables interpreted from the environment. 457 | - `listener.ora.tmpl` 458 | - `sqlnet.ora.tmpl` 459 | - `tnsnames.ora.tmpl` 460 | 461 | - Database configuration. Templates used for specialized database creation outside the "normal" automation, currently only used in upgrade images. 462 | - `init.ora.tmpl` 463 | 464 | - Environment configurations. Used to set up the interactive environment in the container. Each has a specific function: 465 | - `env.tmpl`: Used to build `~oracle/.bashrc`. Pay attention to escaping (`\`) on variables, there to support multi-home and multi-SID environments. 466 | - `login.sql.tmpl`: Used to create a `login.sql` file under `$SQLPATH` that formats and customizes SQLPlus output. 467 | - `rlwrap.tmpl`: If `rlwrap` is present in the environment, adds aliases for `sqlplus`, `rman`, and dgmgrl` to the shell. 468 | 469 | - Credential files: 470 | - `.netrc`: MOS login credentials. See the netrc.example file in this directory for format. Adding a `netrc` file allows the build process to download patches from MOS. See the FORCE_PATCH build arguement for more information. 471 | 472 | ## `./database` and `./database/patches` 473 | **All** database and patch files go here. I redesigned the file structure of this repo in March 2022 to use a common directory for all software. Eliminating versioned subdirectories simplified file management and eliminated file duplication. 474 | 475 | I previously supported versioning at the directory and Dockerfile level. It required a 19.13 directory (or a 19c directory and a 19.13 subdirectory), a dedicated Dockerfile, `Dockerfile.19.13`, and a matching docker ignore file, `Dockerfile.19.13.dockerignore`. But all 19c versions use the same .zip/.rpm for installation. `docker build` reads everything in the current directory and its subdirectories into its context prior to performing the build. It doesn't support links. So, to build 19.13 meant I had to have a copy of the 19c base installation media in each subdirectory. Implementation of .dockerignore requires the Dockerfile and its ignore file to have matching names. So, to limit context (preventing `docker build` from reading _every_ file at/below the build directory) I had to have separate, identically-named Dockerfile/.dockerignore files for *every version* I wanted to build. 476 | 477 | That duplication was something I set out to to avoid. I switched instead to a dynamic build process that reads context from a common directory, using .dockerignore to narrow its scope. The advantage is having one directory and one copy for all software. 478 | 479 | Combining this design with a manifest file means I no longer need to move patches in and out of subdirectories to control the patch level of image builds, nor worry about placing them in numbered folders to manage the apply order. Add the file to the appropriate directory (`database` or `database/patch`) and include an entry in the version manifest. 480 | 481 | ## `./templates` 482 | Dynamic builds run from the Dockerfile templates in this directory and create two images: a database image and a database-ready Oracle Linux image. 483 | 484 | The Oracle Enterprise Linux image, tagged with the database version, includes all database version prerequisites (notably the database preinstall RPM). The same image works for any database version installed atop it, and installing the prereqs (at least on my system) takes longer than installing database software. Rather than duplicating that work, the build looks to see if the image is present and starts there. If not, it builds the OEL image. 485 | 486 | Do not be confused by output like this: 487 | ``` 488 | REPOSITORY TAG SIZE 489 | oraclelinux 7-slim-19c 442MB 490 | oraclelinux 7-slim 133MB 491 | oracle/db 19.13.1-EE 7.58GB 492 | ``` 493 | 494 | The total size of these images is not 442MB + 133MB + 7.58GB. Layers in the oraclelinux:7-slim are reused in the oraclelinux:7-slim-19c image, which are reused in the oracle/db:19.13.1-EE image. 495 | 496 | The buildDBImage.sh script reads these templates and creates temporary Dockerfiles and dockerignore files, using information in the manifest according to the version (and other information) passed to the script. 497 | 498 | # Why this Repo 499 | I build and run many Oracle databases in containers. There were things I didn't like about Oracle's build scripts. My goals for this repository are: 500 | - Build any version and any patch level 501 | - Code should be agnostic 502 | - Migrate version-specific actions to templates 503 | - Store versioned information as configurations and manifests 504 | - Eliminate duplicate assets 505 | - Flatten and simplify the directory tree 506 | - Streamline builds and reduce image build times 507 | - Allow build- and run-time customization 508 | - Avoid unnecessary environment settings 509 | - Follow Oracle recommendations and best practices 510 | - Support for archive and RPM-based installations 511 | - Leverage buildx/BuildKit capabilities 512 | - Support advanced features and customization: 513 | - Read-Only Homes 514 | - CDB and non-CDB database creation 515 | - For CDB databases, control the number/naming of PDBs 516 | - Data Guard, Sharding, RAC, GoldenGate, upgrades, etc. 517 | 518 | There is one script to handle all operations, for all editions and versions. This adds some complexity to the script (it has to accommodate peculiarities of every version and edition) but: 519 | - _For the most part_ these operations are identical across the board 520 | - One script in the root directory does everything and only one script needs maintenance 521 | - Version differences are all in one place vs. hidden in multiple files in parallel directories 522 | 523 | The `/opt/scripts/manageOracle.sh` script manages all Oracle/Docker operations, from build through installation: 524 | - Configures the environment 525 | - Installs RPM 526 | - Installs the database 527 | - Creates the database 528 | - Starts and stops the database 529 | - Performs health checks 530 | 531 | ## Flexible Image Creation 532 | Each Dockerfile uses a set of common ARG values. Defaults are set in each Dockerfile but can be overridden by passing `--build-arg` values to `docker build`. This allows a single Dockerfile to accommodate a wide range of build options without changes to any files, including: 533 | - Removing specific components (APEX, SQL Developer, help files, etc) to minimize image size without editing scripts. It's easier to build images to include components that are normally be deleted. This is particularly useful for building images for testing 19c upgrades. APEX is included in the seed database but older APEX schemas have to be removed prior to a 19c upgrade. Where's the removal script? In the APEX directory, among those commonly removed to trim image size! 534 | - Add programs/binaries at build time as variables, rather than in a script. Hey, sometimes you want editors or `strace` or `git`, sometimes you don't. Set the defaults to your preferred set of binaries. Override them at build time as necessary, again without having to edit/revert any files. 535 | - Some database versions may require special RPM. Rather than maintaining that in scripts, it's in the Dockerfile (configuration). 536 | - Add supplemental RPMs. Some RPM have dependencies (such as `rlwrap`) that require a second execution of `rpm install`. All builds treat this the same way. 537 | - The RPM list includes tools for interactive use of containers. 538 | - Remove `git`, `less`, `strace`, `tree`, `vi`, `which`, and `bash-completion` for non-interactive environments 539 | - `sudo` is used to run installations from the `manageOracle.sh` script 540 | - All builds are multi-stage with identical steps, users and operations. Differences are handled by the management script by reading configuration information from the Dockerfile, discovered in the file structure, or set in the environment. 541 | - Customizing the directories for `ORACLE_BASE`, `ORACLE_HOME`, `oraInventory`, and the `oradata` directory. 542 | - Specify Read-Only Oracle Home (ROOH). Set `ROOH=ENABLE` in the Dockerfile, or pass `--build-arg ROOH=ENABLE` during build. 543 | 544 | ## Install Oracle from Archive (ZIP) or RPM 545 | RPM builds operate a little differently. They have a dependency on `root` because database configuration and startup is managed through `/etc/init.d`. The configuration is in `/etc/sysconfig`. If left at their default (I have a repo for building default RPM-based Oracle installations elsewhere) they need `root` and pose a security risk. I experimented with workarounds (adding `oracle` to `sudoers`, changing the `/etc/init.d` script group to `oinstall`, etc) but RPM-created databases still ran differently. 546 | 547 | I use the RPM to create the Oracle software home, then discard what's in `/etc/init.d` and `/etc/sysconfig` and create and start the database "normally" using DBCA and SQLPlus. 548 | 549 | This allows additional options for RPM-based installations, including changing the directory structure (for non-18c XE installs—the 18c XE home does not include libraries needed to recompile) and managing configuration through the same mechanism as "traditional" installations, meaning anything that can be applied to a "normal" install can be set in a RPM-based installation, without editing a different set of files in `/etc/sysconfig` and `ORACLE_HOME`. Express Edition on 18c (18.4) can be extended to use: 550 | - Custom SID (not stuck with XE) 551 | - Container or non-container 552 | - Custom PDB name(s) 553 | - Multiple PDB 554 | 555 | ## Flexible Container Creation 556 | I wanted images capable of running highly customizable database environments out of the gate, that mimic what's seen in real deployments. This includes running non-CDB databases, multiple pluggable databases, case-sensitive SID and PDB names, and custom PDB naming (to name a few). Database creation is controlled and customized by passing environment variables to `docker run` via `-e VARIABLE=VALUE`. Notable options include: 557 | - `PDB_COUNT`: Create non-container databases by setting this value to 0, or set the number of pluggable databases to be spawned. 558 | - `CREATE_CONTAINER`: Ture/false, an alternate method for creating a non-CDB database. 559 | - `ORACLE_PDB`: This is the prefix for the PDB's (when PDB_COUNT > 1) or the PDB_NAME (when PDB_COUNT=1, the default). 560 | - `DB_UNQNAME`: Set the database Unique Name. Default is ORACLE_SID; used mainly for creating containers used for Data Guard where the database and unique names are different, and avoids generating multiple diagnostic directory trees. 561 | - `PDB_LIST`: A comma-delimited list of PDB names. When present, overrides the PDB_COUNT and ORACLE_PDB values. 562 | - `ORACLE_CHARACTERSET` and `ORACLE_NLS_CHARACTERSET`: Set database character sets. 563 | - `INIT_PARAMS`: A list of parameters to set in the database at creation time. The default sets the DB_CREATE_FILE_DEST, DB_CREATE_ONLINE_LOG_DEST_1, and DB_RECOVERY_FILE_DEST to $ORADATA (enabling OMF) and turns off auditing. 564 | 565 | ## DEBUG mode 566 | Debug image builds, container creation, or container operation. 567 | - Use `--build-arg DEBUG="bash -x"` to debug image builds 568 | - Use `-e DEBUG="bash -x"` to debug container creation 569 | - Use `export DEBUG="bash -x"` to turn on debugging output in a running container 570 | - Use `unset DEBUG` to turn debugging off in a running container 571 | 572 | # Examples 573 | Create a non-container database: 574 | `docker run -d -e PDB_COUNT=0 IMG_NAME` 575 | Create a container database with custom SID and PDB name: 576 | `docker run -d -e ORACLE_SID=mysid -e ORACLE_PDB=mypdb IMG_NAME` 577 | Create a container database with a default SID and three PDB named mypdb[1,2,3]: 578 | `docker run -d -e PDB_COUNT=3 -e ORACLE_PDB=mypdb IMG_NAME` 579 | Create a container database with custom SID and named PDB: 580 | `docker run -d -e ORACLE_SID=mydb -e PDB_LIST="test,dev,prod" IMG_NAME` 581 | 582 | # Errata 583 | 584 | ## ORACLE_PDB Behavior in Containers 585 | There are multiple mechanisms that set the ORACLE_PDB variable in a container. It is set explicitly by passing a value (e.g. `-e ORACLE_PDB=value`) during `docker run`. This is the preferred way of doing things since it correctly sets the environment. 586 | The value may be set implicitly four ways: 587 | - If ORACLE_PDB is not set and the database version requires a PDB (20c and later), the value of ORACLE_PDB is inherited from the image. 588 | - If ORACLE_PDB is not set and PDB_COUNT is non-zero, PDB_COUNT PDBs are implied. The value of ORACLE_PDB is inherited from the image. 589 | - If both ORACLE_PDB and PDB_COUNT are set, ORACLE_PDB is assumed to be a prefix. PDB_COUNT pluggable databases are created as ${ORACLE_PDB}1 through ${ORACLE_PDB}${PDB_COUNT}. ORACLE_PDB in this case is not an actual pluggable database but a prefix. 590 | - If ORACLE_PDB is not set and PDB_LIST contains one or more values, ORACLE_PDB is inherited from the image. 591 | In each case the ORACLE_PDB environment variable is added to the `oracle` user's login scripts. Run that request more than one PDB (PDB_LIST, PDB_COUNT > 1) set the default value to the first PDB in the list/${ORACLE_PDB}1. 592 | In these latter cases, the ORACLE_PDB for interactive sessions is set by login but non-interactive sessions *DO NOT* get the local value. They inherit the value from the container's native environment. 593 | Take the following examples: 594 | - `docker run ... -e ORACLE_PDB=PDB ...`: The interactive and non-interactive values of ORACLE_PDB match. 595 | - 'docker run ... -e PDB_COUNT=n ...`: The interactive value of ORACLE_PDB is ORCLPDB1. The non-interactive value is ORCLPDB. This happens because the inherited value, ORCLPDB is used for non-interactive sessions. 596 | - `docker run ... -e PDB_LIST=PDB1,MYPDB ...`: The interactive value of ORACLE_PDB is PDB1. The non-interactive value is ORCLPDB (see above). 597 | - `docker run ... ` a 21c database: The interactive value of ORACLE_PDB is set in the DBCA scripts as ORCLPDB. The non-interactive value equals whatever is set in the Dockerfile. 598 | This can cause confusion when calling scripts. For example: 599 | ``` 600 | docker exec -it CON_NAME bash 601 | env | grep ORACLE_PDB 602 | exit 603 | ``` 604 | ...will show the correct, expected value. However: 605 | ``` 606 | docker exec -it CON_NAME bash -c "env | grep ORACLE_PDB" 607 | ``` 608 | ...may show a different value. This is expected (and intended and desirable—it's necessary for statelessness and idempotency) but may lead to confusion. 609 | I recommend handling this as follows: 610 | - Set ORACLE_PDB explicitly in `docker run` even when using PDB_LIST. PDB_LIST is evaluated first so setting ORACLE_PDB sets the environment and PDB_LIST creates multiple pluggable databases. The default PDB should be first in the list and match ORACLE_PDB. 611 | - If you need multiple PDBs, use PDB_LIST instead of PDB_COUNT, and set ORACLE_PDB to the "default" PDB. Otherwise, the ORACLE_PDB value in non-interactive shells is the prefix and not a full/valid PDB name. 612 | 613 | # Glossary 614 | - APEX: Oracle Application Express, a low-code web development tool. 615 | - CDB: Container Database - Introduced in 12c, container databases introduce capacity and security enhancements. Each CDB consists of a root container plus one or more Pluggable Databases, or PDBs. 616 | - DBCA: Oracle Database Configuration Assistant - a tool for creating databases. 617 | - EE: Oracle Enterprise Edition - A licensed, more robust version of Oracle that can be extended through addition of add-ons like Advanced Compression, Partitioning, etc. 618 | - ORACLE_BASE: The base directory for Oracle software installation. 619 | - ORACLE_HOME: The directory path containing an Oracle database software installation. 620 | - ORACLE_INVENTORY, Oracle Inventory: Metadata of Oracle database installations on a host. 621 | - PDB: Pluggable Database - One or more PDBs "plug in" to a container database. 622 | - RPM: RedHat Package Manager - package files for installing software on Linux. 623 | - runInstall: Performs Oracle database software installation. 624 | - SE, SE2: Oracle Standard Edition/Oracle Standard Edition 2 - A licensed version of Oracle with limited features. Not all features are available, licensed, or extensive in SE/SE2. For example, partitioning is not available in SE/SE2, and RAC is limited to specific node/core counts. 625 | - XE: Oracle Express Edition - A limited version of the Oracle database that is free to use. 626 | 627 | ## TODO: 628 | - Replace positional options with flags 629 | - Expand customizations 630 | - Add flexibility to pass `--build-arg`s to the script/image 631 | - Add a "Create Dockerfile" option (don't run the build) 632 | - Add Dockerfile naming capability 633 | - Add a help menu and error dialogs 634 | - Integrate secrets 635 | - More... 636 | -------------------------------------------------------------------------------- /bashrc19: -------------------------------------------------------------------------------- 1 | # .bashrc 2 | # Source global definitions 3 | if [ -f /etc/bashrc ]; then 4 | . /etc/bashrc 5 | fi 6 | 7 | export PS1="[\u - ${ORACLE_SID}] \w\n# " 8 | 9 | export ORACLE_BASE=/u01/app/oracle 10 | export ORACLE_SID=$(egrep -v "^$|^#" /etc/oratab | cut -d: -f1 | head -1) 11 | export ORACLE_UNQNAME=$ORACLE_SID 12 | export ORACLE_HOME=$(egrep "^${ORACLE_SID}:" /etc/oratab | egrep -v "^$|^#" | cut -d: -f2 | head -1) 13 | export ORACLE_BASE_CONFIG="$($ORACLE_HOME/bin/orabaseconfig 2>/dev/null || echo $ORACLE_HOME)"/dbs 14 | export ORACLE_BASE_HOME="$($ORACLE_HOME/bin/orabasehome 2>/dev/null || echo $ORACLE_HOME)" 15 | export TNS_ADMIN=$ORACLE_BASE_HOME/network/admin 16 | export BASEPATH=/usr/sbin:/usr/local/sbin:/usr/local/bin:/usr/bin:/sbin:/bin 17 | export PATH=$ORACLE_HOME/bin:$ORACLE_HOME/OPatch/:$BASEPATH 18 | export CLASSPATH=$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib 19 | export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/usr/lib 20 | export ORACLE_PATH=$ORACLE_PATH 21 | export ORACLE_19C_HOME=$ORACLE_BASE/product/19c/dbhome_1 22 | 23 | alias sqlplus="rlwrap \$ORACLE_HOME/bin/sqlplus" 24 | alias rman="rlwrap \$ORACLE_HOME/bin/rman" 25 | alias dgmgrl="rlwrap \$ORACLE_HOME/bin/dgmgrl" 26 | 27 | # Fix for directory expansion 28 | shopt -s direxpand 2>/dev/null || true 29 | -------------------------------------------------------------------------------- /bashrc21: -------------------------------------------------------------------------------- 1 | # .bashrc 2 | # Source global definitions 3 | if [ -f /etc/bashrc ]; then 4 | . /etc/bashrc 5 | fi 6 | 7 | export PS1="[\u - ${ORACLE_SID}] \w\n# " 8 | 9 | export ORACLE_BASE=/u01/app/oracle 10 | export ORACLE_SID=$(egrep -v "^$|^#" /etc/oratab | cut -d: -f1 | head -1) 11 | export ORACLE_UNQNAME=$ORACLE_SID 12 | export ORACLE_HOME=$(egrep "^${ORACLE_SID}:" /etc/oratab | egrep -v "^$|^#" | cut -d: -f2 | head -1) 13 | export ORACLE_BASE_CONFIG="$($ORACLE_HOME/bin/orabaseconfig 2>/dev/null || echo $ORACLE_HOME)"/dbs 14 | export ORACLE_BASE_HOME="$($ORACLE_HOME/bin/orabasehome 2>/dev/null || echo $ORACLE_HOME)" 15 | export TNS_ADMIN=$ORACLE_BASE_HOME/network/admin 16 | export BASEPATH=/usr/sbin:/usr/local/sbin:/usr/local/bin:/usr/bin:/sbin:/bin 17 | export PATH=$ORACLE_HOME/bin:$ORACLE_HOME/OPatch/:$BASEPATH 18 | export CLASSPATH=$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib 19 | export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/usr/lib 20 | export ORACLE_PATH=$ORACLE_PATH 21 | export ORACLE_21C_HOME=$ORACLE_BASE/product/21c/dbhome_1 22 | 23 | alias sqlplus="rlwrap \$ORACLE_HOME/bin/sqlplus" 24 | alias rman="rlwrap \$ORACLE_HOME/bin/rman" 25 | alias dgmgrl="rlwrap \$ORACLE_HOME/bin/dgmgrl" 26 | 27 | # Fix for directory expansion 28 | shopt -s direxpand 2>/dev/null || true 29 | -------------------------------------------------------------------------------- /buildDBImage.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Automate dynamic image builds 4 | 5 | . ./functions.sh 6 | 7 | getEdition() { 8 | # Set variables based on edition. 9 | case $ORACLE_EDITION in 10 | EE) export ORACLE_EDITION_ARG="EE" ;; 11 | SE*) export ORACLE_EDITION_ARG="SE" ;; 12 | XE) export ORACLE_EDITION_ARG="XE" 13 | export INSTALL_RESPONSE_ARG="oracle-${ORACLE_VERSION}-${ORACLE_EDITION}.conf" 14 | export ORACLE_BASE_CONFIG_ARG="###" 15 | export ORACLE_BASE_CONFIG_ENV="###" 16 | export ORACLE_BASE_HOME_ARG="###" 17 | export ORACLE_BASE_HOME_ENV="###" 18 | export ORACLE_ROH_ARG="###" 19 | export ORACLE_ROH_ENV="###" 20 | # Perform conditional setup by version. 21 | case $ORACLE_VERSION in 22 | 11.2.0.2) export ORACLE_HOME_ARG="11.2.0/xe" ;; 23 | 18.4) export MIN_SPACE_GB_ARG=13 24 | export ORACLE_HOME_ARG="18c/dbhomeXE" 25 | export ORACLE_PDB_ARG="ARG ORACLE_PDB=XEPDB" 26 | export ORACLE_RPM_ARG="ARG ORACLE_RPM=\"https://download.oracle.com/otn-pub/otn_software/db-express/oracle-database-xe-18c-1.0-1.x86_64.rpm\"" 27 | ;; 28 | *) error "Selected version ($ORACLE_VERSION) is not available for Express Edition" ;; 29 | esac ;; 30 | *) error "Invalid edition name ($ORACLE_EDITION) provided" ;; 31 | esac 32 | } 33 | 34 | getVersion() { 35 | # Set defaults 36 | DOCKER_RUN_LABEL="-e PDB_COUNT= -e ORACLE_PDB= " 37 | DISTRO_ARG="###" 38 | DISTRO_ENV="###" 39 | INSTALL_RESPONSE_ARG="$ORACLE_VERSION" 40 | MIN_SPACE_GB_ARG=12 41 | ORACLE_SID_ARG="ORCLCDB" 42 | ORACLE_HOME_ARG="${ORACLE_VERSION}/dbhome_1" 43 | ORACLE_BASE_CONFIG_ARG="ARG ORACLE_BASE_CONFIG=\$ORACLE_BASE/dbs" 44 | ORACLE_BASE_CONFIG_ENV="ORACLE_BASE_CONFIG=\$ORACLE_BASE_CONFIG \\\\" 45 | ORACLE_BASE_HOME_ARG="ARG ORACLE_BASE_HOME=\$ORACLE_BASE/homes" 46 | ORACLE_BASE_HOME_ENV="ORACLE_BASE_HOME=\$ORACLE_BASE_HOME \\\\" 47 | ORACLE_PDB_ARG="ARG ORACLE_PDB=" 48 | ORACLE_PDB_ENV="ORACLE_PDB=\$ORACLE_PDB \\\\" 49 | ORACLE_ROH_ARG="ARG ROOH=" 50 | ORACLE_ROH_ENV="ROOH=\$ROOH \\\\" 51 | ORACLE_RPM_ARG="" 52 | PDB_COUNT_ARG="ARG PDB_COUNT=1" 53 | PDB_COUNT_ENV="PDB_COUNT=\$PDB_COUNT \\\\" 54 | 55 | if [ "$ORACLE_VERSION" == "11.2.0.2" ] || [ "$ORACLE_VERSION" == "18.4" ] 56 | then ORACLE_EDITION="XE" 57 | fi 58 | 59 | case $ORACLE_VERSION in 60 | 11*) export ORACLE_BASE_VERSION="$ORACLE_VERSION" 61 | export DOCKER_RUN_LABEL="" 62 | export ORACLE_BASE_CONFIG_ARG="###" 63 | export ORACLE_BASE_CONFIG_ENV="###" 64 | export ORACLE_BASE_HOME_ARG="###" 65 | export ORACLE_BASE_HOME_ENV="###" 66 | export ORACLE_PDB_ARG="###" 67 | export ORACLE_PDB_ENV="###" 68 | export ORACLE_ROH_ARG="###" 69 | export ORACLE_SID_ARG=ORCL 70 | export PDB_COUNT_ARG="###" 71 | export PDB_COUNT_ENV="###" 72 | export PCB_COUNT_LABEL="###" 73 | export PREINSTALL_TAG="11g" 74 | ;; 75 | 12*) export ORACLE_BASE_VERSION="$ORACLE_VERSION" 76 | export ORACLE_BASE_CONFIG_ARG="###" 77 | export ORACLE_BASE_CONFIG_ENV="###" 78 | export ORACLE_BASE_HOME_ARG="###" 79 | export ORACLE_BASE_HOME_ENV="###" 80 | export ORACLE_ROH_ARG="###" 81 | export PREINSTALL_TAG="$ORACLE_VERSION" 82 | ;; 83 | 18*) export ORACLE_BASE_VERSION="${ORACLE_VERSION:0:2}" 84 | export PREINSTALL_TAG="${ORACLE_BASE_VERSION}c" 85 | ;; 86 | 19*|2*) export ORACLE_BASE_VERSION=${ORACLE_VERSION:0:2} 87 | export INSTALL_RESPONSE_ARG="$ORACLE_BASE_VERSION" 88 | export PREINSTALL_TAG="${ORACLE_BASE_VERSION}c" 89 | case "${S_TAG}" in 90 | 8*) DISTRO_ARG="ARG CV_ASSUME_DISTID=OEL8" 91 | DISTRO_ENV="CV_ASSUME_DISTID=\$CV_ASSUME_DISTID \\\\" 92 | ;; 93 | esac 94 | ;; 95 | *) error "Invalid version ($ORACLE_VERSION) provided" ;; 96 | esac 97 | 98 | if [ -n "$SYSTEMD" ] 99 | then local __tag="${S_TAG}-sysd" 100 | export DB_REPO="${DB_REPO}-sysd" 101 | export systemd="--build-arg SYSTEMD=Y" 102 | export SYSTEMD_VOLUME="VOLUME [ \"/sys/fs/cgroup\" ]" 103 | else local __tag="$S_TAG" 104 | fi 105 | LINUX_IMAGE="${SOURCE}:${__tag}-${PREINSTALL_TAG}" 106 | } 107 | 108 | getImage() { 109 | docker images --filter=reference="${LINUX_IMAGE}" --format "{{.Repository}}:{{.Tag}}" 110 | } 111 | 112 | setBuildKit() { 113 | # Check whether Docker Build Kit is available; version must be 18.09 or greater. 114 | version=$(docker --version | awk '{print $3}') 115 | major_version=$((10#$(echo "$version" | cut -d. -f1))) 116 | minor_version=$((10#$(echo "$version" | cut -d. -f2))) 117 | BUILDKIT=0 118 | export MOS_SECRET="" 119 | 120 | if [ "$major_version" -gt 18 ] || [ "$major_version" -eq 18 -a "$minor_version" -gt 9 ] 121 | then BUILDKIT=1 122 | MOS_CRED_FQ=${MOS_CRED_FN:-./config/.netrc} 123 | MOS_CRED_FN=$(basename "$MOS_CRED_FQ") 124 | if [ -f "$MOS_CRED_FQ" ] 125 | then export MOS_SECRET="--mount=type=secret,id=netrc,mode=0600,uid=54321,gid=54321,dst=/home/oracle/$MOS_CRED_FN" 126 | DB_BUILD_OPTIONS=("${DB_BUILD_OPTIONS[@]}" --secret id=netrc,src="$MOS_CRED_FQ") 127 | #DB_BUILD_OPTIONS="$DB_BUILD_OPTIONS --secret id=netrc,src=$MOS_CRED_FQ" 128 | fi 129 | fi 130 | } 131 | 132 | createDockerfiles() { 133 | dockerfile=$(mktemp ./Dockerfile."$1"."$(date '+%Y%m%d%H%M')".XXXX) 134 | dockerignore=${dockerfile}.dockerignore 135 | 136 | chmod 664 "$dockerfile" 137 | # If FROM_BASE is set it means there was no existing oraclelinux image tagged 138 | # with the DB version. Create a full Dockerfile to build the OS, otherwise use 139 | # the existing image to save time. 140 | cat ./templates/"$1".dockerfile > "$dockerfile" 141 | cat ./templates/"$1".dockerignore > "$dockerignore" 142 | } 143 | 144 | addException() { 145 | case $2 in 146 | database) local __path="database" ;; 147 | patch) local __path="database/patches" ;; 148 | asset) local __path="config" ;; 149 | esac 150 | printf '!/%s/%s\n' "$__path" "$1" >> "$dockerignore" 151 | } 152 | 153 | processManifest() { 154 | if [ -f ./config/manifest ] 155 | then 156 | # Get the correct architecture. 157 | case "$(uname -m)" in 158 | arm64|aarch64) arch="arm64" ;; # Match arm64 or aarch64 for ARM64 files 159 | *) arch="x86|x64|amd64" ;; # Regexp match for x86 and x64 because non-ARM files are identified by both x86 and x64 :( 160 | esac 161 | grep -i -E "$arch" ./config/manifest | grep -ve "^#" | awk '{print $1,$2,$3,$4,$5}' | while IFS=" " read -r checksum filename filetype version extra 162 | do 163 | if [ "$filetype" == "database" ] && [ "$version" == "$ORACLE_BASE_VERSION" ] && [ -f ./database/"$filename" ] && [ -z "$edition" ] 164 | then case $1 in 165 | ignore) addException "$filename" database ;; 166 | label) SED -e "s/^###SOFTWARE_LABEL###/&\nLABEL database.software.${version}=\"Edition=${extra}, Version=${version}, File=${filename}, md5sum=${checksum}\"\n/" "$dockerfile" ;; 167 | esac 168 | elif [ "$filetype" == "database" ] && [ "$version" == "$ORACLE_BASE_VERSION" ] && [ -f ./database/"$filename" ] && [[ $edition =~ $ORACLE_EDITION ]] 169 | then case $1 in 170 | ignore) addException "$filename" database ;; 171 | label) SED -e "s/^###SOFTWARE_LABEL###/&\nLABEL database.software.${version}=\"Edition=${extra}, Version=${version}, File=${filename}, md5sum=${checksum}\"\n/" "$dockerfile" ;; 172 | esac 173 | elif [ "$filetype" == "opatch" -o "$filetype" == "patch" ] && [ "$version" == "$ORACLE_BASE_VERSION" -o "$version" == "$ORACLE_VERSION" ] && [ -f ./database/patches/"$filename" ] 174 | then case $1 in 175 | ignore) addException "$filename" patch ;; 176 | label) SED -e "s/^###SOFTWARE_LABEL###/&\nLABEL database.patch.${extra}=\"Patch ID=${extra}, Version=${version}, File=${filename}, md5sum=${checksum}\"\n/" "$dockerfile" ;; 177 | esac 178 | fi 179 | done 180 | fi 181 | } 182 | 183 | processDockerfile() { 184 | for var in DB_REPO \ 185 | DISTRO_ARG \ 186 | DISTRO_ENV \ 187 | DOCKER_RUN_LABEL \ 188 | FROM_BASE \ 189 | FROM_OEL_BASE \ 190 | INSTALL_RESPONSE_ARG \ 191 | LINUX_IMAGE \ 192 | MIN_SPACE_GB_ARG \ 193 | MOS_SECRET \ 194 | ORACLE_BASE_CONFIG_ARG \ 195 | ORACLE_BASE_CONFIG_ENV \ 196 | ORACLE_BASE_HOME_ARG \ 197 | ORACLE_BASE_HOME_ENV \ 198 | ORACLE_BASE_VERSION \ 199 | ORACLE_EDITION_ARG \ 200 | ORACLE_HOME_ARG \ 201 | ORACLE_PDB_ARG \ 202 | ORACLE_PDB_ENV \ 203 | ORACLE_ROH_ARG \ 204 | ORACLE_ROH_ENV \ 205 | ORACLE_RPM_ARG \ 206 | ORACLE_SID_ARG \ 207 | ORACLE_VERSION \ 208 | PDB_COUNT_ARG \ 209 | PDB_COUNT_ENV \ 210 | PREINSTALL_TAG \ 211 | SYSTEMD_VOLUME 212 | do REPIFS=$IFS 213 | IFS= 214 | replaceVars "$1" "$var" 215 | IFS=$REPIFS 216 | done 217 | 218 | # Insert labesl for each patch in apply order. 219 | processManifest label 220 | 221 | # Remove unset lines 222 | SED -e '/###$/d' "$1" 223 | } 224 | 225 | removeDockerfile () { 226 | if [ -z "$RM_DOCKERFILE" ] 227 | then rm "$1" "$2" 228 | fi 229 | } 230 | 231 | usage () { 232 | echo " Usage: $0 [options]" 233 | echo " " 234 | echo " Options: " 235 | echo " --build-arg stringArray Set build-time variables " 236 | echo " -d, --debug Turn on build debugging " 237 | echo " -e, --edition string Set the database edition " 238 | echo " EE: Enterprise Edition (Default) " 239 | echo " SE: Standard Edition " 240 | echo " XE: Express Edition (Versions 11.2.0.2, 18.4, 23.1.0 only) " 241 | echo " --force-patch string Force patch download from MOS " 242 | echo " all: Re-download all patches during install " 243 | echo " opatch: Re-download opatch only " 244 | echo " patch: Re-download patches but not opatch " 245 | echo " --force-rm Force-remove build cache " 246 | echo " -k, --dockerfile-keep Keep the dynamically generated Dockerfile after build completion " 247 | echo " -n, --image-name string Repository name for the completed image (Default: oracle/db) " 248 | echo " --no-cache Do not use cache when building the image " 249 | echo " --no-sum Do not perform file checksums " 250 | echo " --progress string Display build progress " 251 | echo " auto (Default) " 252 | echo " plain: Show container output " 253 | echo " tty: Show abbreviated output " 254 | echo " --prune-cache Prune build cache on success " 255 | echo " -q, --quiet Suppress build output " 256 | echo " -r, --force-rebuild Force rebuild the base Linux image if it exists " 257 | echo " --read-only-home Configure a Read-Only Oracle Home " 258 | echo " --remove-components string Comma-delimited list of components to remove " 259 | echo " Options: DBMA,HELP,ORDS,OUI,PATCH,PILOT,SQLD,SUP,UCP,TCP,ZIP,INV,DBCA,ADMIN,ROH " 260 | echo " Default is all of the above " 261 | echo " --rpm stringArray Comma-delimited list of binaries/libraries to install " 262 | echo " Default: bash-completion,git,less,strace,tree,vi,which " 263 | echo " --secret string File name containing MOS credentials for patch download " 264 | echo " -S, --source-image string Source OS image repository (Default: oraclelinux) " 265 | echo " -T, --source-tag string Source OS tag (Default: 8-slim) " 266 | echo " -t, --tag string Tag for the completed image (Default: [ORACLE_VERSION]-[ORACLE_EDITION]) " 267 | echo " -v, --version string Oracle Database version (Default: 19.19) " 268 | echo " The version must exist in the manifest file within the ./config directory " 269 | echo " -h, --help This menu " 270 | echo " " 271 | exit "$1" 272 | } 273 | 274 | if [ -n "$*" ] && [[ $(getopt -V) =~ -- ]] 275 | then # The system must be using GNU-getopt to process command line parameters. This is not the default on MacOS. 276 | error "An incompatible version of getopt is installed. Cannot process parameters." 277 | elif [ -n "$*" ] # Only process command line parameters if options were passed. 278 | then OPTS=de:hkn:qrS:T:t:v: 279 | OPTL=build-arg:,debug,dockerfile-keep,edition:,force-patch:,force-rebuild,force-rm,help,image-name:,no-cache,no-sum,progress:,prune-cache,quiet,read-only-home,remove-components:,rpm:,secret:,source-image:,source-tag:,tag:,version: 280 | ARGS=$(getopt -a -o $OPTS -l $OPTL -- "$@") || usage 1 281 | eval set -- "$ARGS" 282 | while : 283 | do 284 | case "$1" in 285 | --build-arg ) BUILD_OPTIONS=("${BUILD_OPTIONS[@]}" --build-arg "$2"); shift 2 ;; 286 | -d | --debug ) BUILD_OPTIONS=("${BUILD_OPTIONS[@]}" --build-arg DEBUG="bash -x"); shift ;; 287 | -e | --edition ) case "${2^^}" in 288 | EE | SE | XE ) ORACLE_EDITION="${2^^}" ;; 289 | * ) error "-e/--edition must be one of EE, SE, or XE" ;; 290 | esac 291 | shift 2 ;; 292 | --force-patch ) case "${2,,}" in 293 | all | opatch | patch ) DB_BUILD_OPTIONS=("${DB_BUILD_OPTIONS[@]}" --build-arg FORCE_PATCH="${2,,}") ;; 294 | * ) error "--force-patch must be one of all, opatch, or patch" ;; 295 | esac 296 | shift 2 ;; 297 | --force-rm ) BUILD_OPTIONS=("${BUILD_OPTIONS[@]}" --force-rm=true); shift ;; 298 | -k | --dockerfile-keep ) RM_DOCKERFILE=1; shift ;; 299 | -n | --image-name ) TARGET="$2"; shift 2 ;; 300 | --no-cache ) BUILD_OPTIONS=("${BUILD_OPTIONS[@]}" --no-cache=true); shift ;; 301 | --no-sum ) DB_BUILD_OPTIONS=("${DB_BUILD_OPTIONS[@]}" --build-arg SKIP_MD5SUM=1); shift ;; 302 | --progress ) case "${2,,}" in 303 | auto | plain | tty ) BUILD_OPTIONS=("${BUILD_OPTIONS[@]}" --progress "$2") ;; 304 | * ) error "--progress must be one of auto, plain, or tty" ;; 305 | esac 306 | shift 2 ;; 307 | --prune-cache ) PRUNE_CACHE=1; shift ;; 308 | -q | --quiet ) BUILD_OPTIONS=("${BUILD_OPTIONS[@]}" --quiet); shift ;; 309 | -r | --force-rebuild ) FORCE_REBUILD=1; shift ;; 310 | --read-only-home ) DB_BUILD_OPTIONS=("${DB_BUILD_OPTIONS[@]}" --build-arg ROOH=ENABLE); shift ;; 311 | --remove-components ) DB_BUILD_OPTIONS=("${DB_BUILD_OPTIONS[@]}" --build-arg REMOVE_COMPONENTS="$2"); shift 2 ;; 312 | --rpm ) OS_BUILD_OPTIONS=("${OS_BUILD_OPTIONS[@]}" --build-arg RPM_LIST="${2//,/ }"); shift 2 ;; 313 | --secret ) if [ -f "$2" ] 314 | then MOS_CRED_FQ="$2" 315 | else error "Credential file $2 not found" 316 | fi 317 | shift 2 ;; 318 | -S | --source-image ) SOURCE="$2"; shift 2 ;; 319 | -T | --source-tag ) S_TAG="$2"; shift 2 ;; 320 | -t | --tag ) T_TAG="$2"; shift 2 ;; 321 | -v | --version ) ORACLE_VERSION="$2"; shift 2 ;; 322 | -h | --help ) usage 0 ;; 323 | -- ) shift; break ;; 324 | * ) usage 1 ;; 325 | esac 326 | done 327 | fi 328 | 329 | # Set defaults for version, edition, tag and source: 330 | ORACLE_VERSION=${ORACLE_VERSION:-19.19} 331 | ORACLE_EDITION=${ORACLE_EDITION:-EE} 332 | SOURCE=${SOURCE:-oraclelinux} 333 | S_TAG=${S_TAG:-8-slim} 334 | TARGET=${TARGET:-oracle/db} 335 | T_TAG=${T_TAG:-${ORACLE_VERSION}-${ORACLE_EDITION}} 336 | 337 | getVersion 338 | getEdition 339 | setBuildKit 340 | 341 | # Set build arguments 342 | export SOURCE_IMAGE="$SOURCE":"$S_TAG" 343 | export TARGET_IMAGE="$TARGET":"$T_TAG" 344 | 345 | ## Set systemd options 346 | # if [ -n "$SYSTEMD" ] 347 | #then OS_BUILD_OPTIONS=("${OS_BUILD_OPTIONS[@]}" --build-arg SYSTEMD=Y) 348 | #fi 349 | 350 | if [ -z "$(getImage)" ] || [ -n "$FORCE_REBUILD" ] 351 | then # There is no base image or FORCE_BUILD is set: Create a base image. 352 | export FROM_BASE="FROM $SOURCE_IMAGE as base" 353 | FROM_OEL_BASE="base" 354 | createDockerfiles oraclelinux || error "There was a problem creating the Dockerfiles" 355 | processDockerfile "$dockerfile" 356 | BUILD_OPTIONS=("${BUILD_OPTIONS[@]}" --build-arg BUILD_DATE="$(date -u +'%Y-%m-%dT%H:%M:%SZ')") 357 | 358 | # Run the build 359 | DOCKER_BUILDKIT=$BUILDKIT docker build "${OS_BUILD_OPTIONS[@]}" \ 360 | "${BUILD_OPTIONS[@]}" \ 361 | -t "$LINUX_IMAGE" \ 362 | -f "$dockerfile" . && removeDockerfile "$dockerfile" "$dockerignore" 363 | fi 364 | 365 | FROM_OEL_BASE="$(getImage)"; export FROM_OEL_BASE 366 | createDockerfiles db || error "There was a problem creating the Dockerfiles" 367 | processDockerfile "$dockerfile" 368 | BUILD_OPTIONS=("${BUILD_OPTIONS[@]}" --build-arg BUILD_DATE="$(date -u +'%Y-%m-%dT%H:%M:%SZ')") 369 | 370 | # Add exceptions to the ignore file 371 | if [ "$ORACLE_BASE_VERSION" != "$ORACLE_VERSION" ] 372 | then addException "*.${ORACLE_BASE_VERSION}.rsp" asset 373 | addException "*.${ORACLE_BASE_VERSION}" asset 374 | else addException "*.${ORACLE_VERSION}.rsp" asset 375 | addException "*.${ORACLE_VERSION}" asset 376 | fi 377 | processManifest ignore 378 | 379 | DOCKER_BUILDKIT=$BUILDKIT docker build "${DB_BUILD_OPTIONS[@]}" \ 380 | "${BUILD_OPTIONS[@]}" \ 381 | -t "$TARGET_IMAGE" \ 382 | -f "$dockerfile" . && removeDockerfile "$dockerfile" "$dockerignore"; docker images 383 | 384 | if [ -n "$PRUNE_CACHE" ] 385 | then logger "Pruning build cache" 386 | logger "Space use before:" 387 | docker system df 388 | logger " " 389 | docker builder prune -f 390 | logger "Space use after:" 391 | docker system df 392 | fi 393 | -------------------------------------------------------------------------------- /config/dbca.11.2.0.4.rsp: -------------------------------------------------------------------------------- 1 | [GENERAL] 2 | RESPONSEFILE_VERSION="11.2.0" 3 | OPERATION_TYPE="createDatabase" 4 | [CREATEDATABASE] 5 | GDBNAME="###ORACLE_SID###" 6 | SID="###ORACLE_SID###" 7 | TEMPLATENAME="General_Purpose.dbc" 8 | SYSPASSWORD="###ORACLE_PWD###" 9 | SYSTEMPASSWORD="###ORACLE_PWD###" 10 | SYSMANPASSWORD="###ORACLE_PWD###" 11 | DBSNMPPASSWORD="###ORACLE_PWD###" 12 | EMCONFIGURATION="NONE" 13 | DATAFILEDESTINATION=###DATA### 14 | RECOVERYAREADESTINATION=###RECO###/fast_recovery_area 15 | STORAGETYPE=FS 16 | CHARACTERSET="###ORACLE_CHARACTERSET###" 17 | NATIONALCHARACTERSET="###ORACLE_NLS_CHARACTERSET###" 18 | #VARIABLESFILE= 19 | #VARIABLES= 20 | #INITPARAMS="JAVA_JIT_ENABLED=false" 21 | INITPARAMS="###INIT_PARAMS###" 22 | AUTOMATICMEMORYMANAGEMENT=FALSE 23 | TOTALMEMORY="800" 24 | -------------------------------------------------------------------------------- /config/dbca.12.1.rsp: -------------------------------------------------------------------------------- 1 | [GENERAL] 2 | RESPONSEFILE_VERSION = "12.1.0" 3 | OPERATION_TYPE = "createDatabase" 4 | [CREATEDATABASE] 5 | GDBNAME = "###ORACLE_SID###" 6 | SID = "###ORACLE_SID###" 7 | CREATEASCONTAINERDATABASE = "###CREATE_CONTAINER###" 8 | NUMBEROFPDBS = ###PDBS### 9 | PDBNAME = "###PDB_NAME###" 10 | PDBADMINPASSWORD = "###ORACLE_PWD###" 11 | TEMPLATENAME = "General_Purpose.dbc" 12 | SYSPASSWORD = "###ORACLE_PWD###" 13 | SYSTEMPASSWORD = "###ORACLE_PWD###" 14 | EMCONFIGURATION = "DBEXPRESS" 15 | EMEXPRESSPORT = "5500" 16 | DBSNMPPASSWORD = "###ORACLE_PWD###" 17 | CHARACTERSET = "###ORACLE_CHARACTERSET###" 18 | NATIONALCHARACTERSET= "###ORACLE_NLS_CHARACTERSET###" 19 | INITPARAMS = "###INIT_PARAMS###" 20 | AUTOMATICMEMORYMANAGEMENT = "FALSE" 21 | TOTALMEMORY = "2048" 22 | DATAFILEDESTINATION = "###DATA###" 23 | -------------------------------------------------------------------------------- /config/dbca.12.2.rsp: -------------------------------------------------------------------------------- 1 | responseFileVersion=/oracle/assistants/rspfmt_dbca_response_schema_v12.2.0 2 | gdbName=###ORACLE_SID### 3 | sid=###ORACLE_SID### 4 | createAsContainerDatabase=###CREATE_CONTAINER### 5 | numberOfPDBs=###PDBS### 6 | pdbName=###PDB_NAME### 7 | pdbAdminPassword=###ORACLE_PWD### 8 | templateName=General_Purpose.dbc 9 | sysPassword=###ORACLE_PWD### 10 | systemPassword=###ORACLE_PWD### 11 | emConfiguration=DBEXPRESS 12 | emExpressPort=5500 13 | dbsnmpPassword=###ORACLE_PWD### 14 | characterSet=###ORACLE_CHARACTERSET### 15 | nationalCharacterSet=###ORACLE_NLS_CHARACTERSET### 16 | initParams=###INIT_PARAMS### 17 | automaticMemoryManagement=FALSE 18 | totalMemory=2048 19 | -------------------------------------------------------------------------------- /config/dbca.18.3.rsp: -------------------------------------------------------------------------------- 1 | responseFileVersion=/oracle/assistants/rspfmt_dbca_response_schema_v18.0.0 2 | gdbName=###ORACLE_SID### 3 | sid=###ORACLE_SID### 4 | createAsContainerDatabase=###CREATE_CONTAINER### 5 | numberOfPDBs=###PDBS### 6 | pdbName=###ORACLE_PDB### 7 | pdbAdminPassword=###ORACLE_PWD### 8 | templateName=General_Purpose.dbc 9 | sysPassword=###ORACLE_PWD### 10 | systemPassword=###ORACLE_PWD### 11 | emConfiguration=DBEXPRESS 12 | emExpressPort=5500 13 | dbsnmpPassword=###ORACLE_PWD### 14 | characterSet=###ORACLE_CHARACTERSET### 15 | nationalCharacterSet=###ORACLE_NLS_CHARACTERSET### 16 | initParams=###INIT_PARAMS### 17 | automaticMemoryManagement=FALSE 18 | totalMemory=2048 19 | -------------------------------------------------------------------------------- /config/dbca.18.4.rsp: -------------------------------------------------------------------------------- 1 | responseFileVersion=/oracle/assistants/rspfmt_dbca_response_schema_v12.2.0 2 | gdbName=###ORACLE_SID### 3 | sid=###ORACLE_SID### 4 | databaseConfigType= 5 | RACOneNodeServiceName= 6 | policyManaged= 7 | createServerPool= 8 | serverPoolName= 9 | cardinality= 10 | force= 11 | pqPoolName= 12 | pqCardinality= 13 | createAsContainerDatabase=###CREATE_CONTAINER### 14 | numberOfPDBs=###PDBS### 15 | pdbName=###PDB_NAME### 16 | useLocalUndoForPDBs= 17 | pdbAdminPassword=###ORACLE_PWD### 18 | nodelist= 19 | templateName=XE_Database.dbc 20 | sysPassword=###ORACLE_PWD### 21 | systemPassword=###ORACLE_PWD### 22 | oracleHomeUserPassword= 23 | emConfiguration=DBEXPRESS 24 | emExpressPort=5500 25 | runCVUChecks= 26 | dbsnmpPassword=###ORACLE_PWD### 27 | omsHost= 28 | omsPort= 29 | emUser= 30 | emPassword= 31 | dvConfiguration= 32 | dvUserName= 33 | dvUserPassword= 34 | dvAccountManagerName= 35 | dvAccountManagerPassword= 36 | olsConfiguration= 37 | datafileJarLocation= 38 | datafileDestination= 39 | recoveryAreaDestination= 40 | storageType= 41 | diskGroupName= 42 | asmsnmpPassword= 43 | recoveryGroupName= 44 | characterSet=###ORACLE_CHARACTERSET### 45 | nationalCharacterSet=###ORACLE_NLS_CHARACTERSET### 46 | registerWithDirService= 47 | dirServiceUserName= 48 | dirServicePassword= 49 | walletPassword= 50 | listeners= 51 | variablesFile= 52 | variables= 53 | initParams=###INIT_PARAMS### 54 | sampleSchema=FALSE 55 | memoryPercentage= 56 | databaseType= 57 | automaticMemoryManagement=FALSE 58 | totalMemory=2048 59 | -------------------------------------------------------------------------------- /config/dbca.19.rsp: -------------------------------------------------------------------------------- 1 | responseFileVersion=/oracle/assistants/rspfmt_dbca_response_schema_v19.0.0 2 | gdbName=###ORACLE_SID### 3 | sid=###ORACLE_SID### 4 | createAsContainerDatabase=###CREATE_CONTAINER### 5 | numberOfPDBs=###PDBS### 6 | pdbName=###PDB_NAME### 7 | pdbAdminPassword=###ORACLE_PWD### 8 | templateName=General_Purpose.dbc 9 | sysPassword=###ORACLE_PWD### 10 | systemPassword=###ORACLE_PWD### 11 | emConfiguration=DBEXPRESS 12 | emExpressPort=5500 13 | dbsnmpPassword=###ORACLE_PWD### 14 | characterSet=###ORACLE_CHARACTERSET### 15 | nationalCharacterSet=###ORACLE_NLS_CHARACTERSET### 16 | initParams=###INIT_PARAMS### 17 | automaticMemoryManagement=FALSE 18 | totalMemory=2048 19 | datafileDestination=###DATA### 20 | -------------------------------------------------------------------------------- /config/dbca.21.rsp: -------------------------------------------------------------------------------- 1 | responseFileVersion=/oracle/assistants/rspfmt_dbca_response_schema_v21.0.0 2 | gdbName=###ORACLE_SID### 3 | sid=###ORACLE_SID### 4 | createAsContainerDatabase=###CREATE_CONTAINER### 5 | numberOfPDBs=###PDBS### 6 | pdbName=###PDB_NAME### 7 | pdbAdminPassword=###ORACLE_PWD### 8 | templateName=General_Purpose.dbc 9 | sysPassword=###ORACLE_PWD### 10 | systemPassword=###ORACLE_PWD### 11 | emConfiguration=DBEXPRESS 12 | emExpressPort=5500 13 | dbsnmpPassword=###ORACLE_PWD### 14 | characterSet=###ORACLE_CHARACTERSET### 15 | nationalCharacterSet=###ORACLE_NLS_CHARACTERSET### 16 | initParams=###INIT_PARAMS### 17 | automaticMemoryManagement=FALSE 18 | totalMemory=2048 19 | -------------------------------------------------------------------------------- /config/dbca.23.rsp: -------------------------------------------------------------------------------- 1 | responseFileVersion=/oracle/assistants/rspfmt_dbca_response_schema_v23.0.0 2 | gdbName=###ORACLE_SID### 3 | sid=###ORACLE_SID### 4 | databaseConfigType=SI 5 | storageType=FS 6 | diskGroupName= 7 | recoveryGroupName= 8 | datafileDestination=/u02/app/oracle/oradata 9 | recoveryAreaDestination=/u03/app/oracle 10 | #createAsContainerDatabase=###CREATE_CONTAINER### 11 | numberOfPDBs=###PDBS### 12 | pdbName=###PDB_NAME### 13 | pdbAdminPassword=###ORACLE_PWD### 14 | #templateName=General_Purpose.dbc 15 | templateName=seed_db.dbc 16 | sysPassword=###ORACLE_PWD### 17 | systemPassword=###ORACLE_PWD### 18 | emConfiguration=NONE 19 | #emExpressPort=5500 20 | #dbsnmpPassword=###ORACLE_PWD### 21 | characterSet=###ORACLE_CHARACTERSET### 22 | nationalCharacterSet=###ORACLE_NLS_CHARACTERSET### 23 | initParams=###INIT_PARAMS### 24 | automaticMemoryManagement=FALSE 25 | totalMemory=2048 26 | -------------------------------------------------------------------------------- /config/env.tmpl: -------------------------------------------------------------------------------- 1 | # Set Oracle environment 2 | export PS1="[\u - \\\${ORACLE_SID}] \w\n# " 3 | 4 | export ORACLE_BASE=${ORACLE_BASE} 5 | export ORACLE_SID=\$(egrep -v "^$|^#" /etc/oratab | cut -d: -f1 | head -1) 6 | export ORACLE_UNQNAME=\${ORACLE_UNQNAME:-\$ORACLE_SID} 7 | export ORACLE_HOME=\$(egrep "^\$ORACLE_SID:" /etc/oratab | egrep -v "^$|^#" | cut -d: -f2 | head -1) 8 | export BASEPATH=/usr/sbin:/usr/local/sbin:/usr/local/bin:/usr/bin:/sbin:/bin 9 | export PATH=\$ORACLE_HOME/bin:\$ORACLE_HOME/OPatch/:\$BASEPATH 10 | export CLASSPATH=\$ORACLE_HOME/jlib:\$ORACLE_HOME/rdbms/jlib 11 | export LD_LIBRARY_PATH=\$ORACLE_HOME/lib:/usr/lib 12 | export ORACLE_BASE_CONFIG="\$(\$ORACLE_HOME/bin/orabaseconfig 2>/dev/null || echo \$ORACLE_HOME)"/dbs 13 | export ORACLE_BASE_HOME="\$(\$ORACLE_HOME/bin/orabasehome 2>/dev/null || echo \$ORACLE_HOME)" 14 | export TNS_ADMIN=\$ORACLE_BASE_HOME/network/admin 15 | export ORACLE_PATH=${ORACLE_PATH} 16 | -------------------------------------------------------------------------------- /config/init.ora.tmpl: -------------------------------------------------------------------------------- 1 | *.db_name=${ORACLE_SID} 2 | *.db_unique_name=${DB_UNQNAME} 3 | *.pga_aggregate_target=10M 4 | *.sga_target=600M 5 | -------------------------------------------------------------------------------- /config/inst.11.2.0.4.rsp: -------------------------------------------------------------------------------- 1 | oracle.install.responseFileVersion=/oracle/install/rspfmt_dbinstall_response_schema_v11_2_0 2 | oracle.install.option=INSTALL_DB_SWONLY 3 | ORACLE_HOSTNAME=localhost 4 | UNIX_GROUP_NAME=oinstall 5 | INVENTORY_LOCATION=###ORACLE_INV### 6 | SELECTED_LANGUAGES=en 7 | ORACLE_HOME=###ORACLE_HOME### 8 | ORACLE_BASE=###ORACLE_BASE### 9 | oracle.install.db.InstallEdition=###ORACLE_EDITION### 10 | oracle.install.db.EEOptionsSelection=false 11 | oracle.install.db.optionalComponents=oracle.rdbms.partitioning:11.2.0.4.0,oracle.oraolap:11.2.0.4.0,oracle.rdbms.dm:11.2.0.4.0,oracle.rdbms.dv:11.2.0.4.0,oracle.rdbms.lbac:11.2.0.4.0,oracle.rdbms.rat:11.2.0.4.0 12 | oracle.install.db.DBA_GROUP=dba 13 | oracle.install.db.OPER_GROUP=dba 14 | oracle.install.db.CLUSTER_NODES= 15 | oracle.install.db.isRACOneInstall=false 16 | oracle.install.db.racOneServiceName= 17 | oracle.install.db.config.starterdb.type= 18 | oracle.install.db.config.starterdb.globalDBName= 19 | oracle.install.db.config.starterdb.SID= 20 | oracle.install.db.config.starterdb.characterSet= 21 | oracle.install.db.config.starterdb.memoryOption=true 22 | oracle.install.db.config.starterdb.memoryLimit=2048 23 | oracle.install.db.config.starterdb.installExampleSchemas=false 24 | oracle.install.db.config.starterdb.enableSecuritySettings=true 25 | oracle.install.db.config.starterdb.password.ALL= 26 | oracle.install.db.config.starterdb.password.SYS= 27 | oracle.install.db.config.starterdb.password.SYSTEM= 28 | oracle.install.db.config.starterdb.password.SYSMAN= 29 | oracle.install.db.config.starterdb.password.DBSNMP= 30 | oracle.install.db.config.starterdb.control=DB_CONTROL 31 | oracle.install.db.config.starterdb.gridcontrol.gridControlServiceURL= 32 | oracle.install.db.config.starterdb.automatedBackup.enable=false 33 | oracle.install.db.config.starterdb.automatedBackup.osuid= 34 | oracle.install.db.config.starterdb.automatedBackup.ospwd= 35 | oracle.install.db.config.starterdb.storageType= 36 | oracle.install.db.config.starterdb.fileSystemStorage.dataLocation= 37 | oracle.install.db.config.starterdb.fileSystemStorage.recoveryLocation= 38 | oracle.install.db.config.asm.diskGroup= 39 | oracle.install.db.config.asm.ASMSNMPPassword= 40 | MYORACLESUPPORT_USERNAME= 41 | MYORACLESUPPORT_PASSWORD= 42 | SECURITY_UPDATES_VIA_MYORACLESUPPORT= 43 | DECLINE_SECURITY_UPDATES=true 44 | PROXY_HOST= 45 | PROXY_PORT= 46 | PROXY_USER= 47 | PROXY_PWD= 48 | PROXY_REALM= 49 | COLLECTOR_SUPPORTHUB_URL= 50 | oracle.installer.autoupdates.option=SKIP_UPDATES 51 | oracle.installer.autoupdates.downloadUpdatesLoc= 52 | AUTOUPDATES_MYORACLESUPPORT_USERNAME= 53 | AUTOUPDATES_MYORACLESUPPORT_PASSWORD= 54 | -------------------------------------------------------------------------------- /config/inst.12.1.rsp: -------------------------------------------------------------------------------- 1 | oracle.install.responseFileVersion=/oracle/install/rspfmt_dbinstall_response_schema_v12.1.0 2 | oracle.install.option=INSTALL_DB_SWONLY 3 | ORACLE_HOSTNAME=localhost 4 | UNIX_GROUP_NAME=dba 5 | INVENTORY_LOCATION=###ORACLE_INV### 6 | SELECTED_LANGUAGES=en 7 | ORACLE_HOME=###ORACLE_HOME### 8 | ORACLE_BASE=###ORACLE_BASE### 9 | oracle.install.db.InstallEdition=###ORACLE_EDITION### 10 | oracle.install.db.DBA_GROUP=dba 11 | oracle.install.db.OPER_GROUP=dba 12 | oracle.install.db.BACKUPDBA_GROUP=dba 13 | oracle.install.db.DGDBA_GROUP=dba 14 | oracle.install.db.KMDBA_GROUP=dba 15 | SECURITY_UPDATES_VIA_MYORACLESUPPORT=false 16 | DECLINE_SECURITY_UPDATES=true 17 | -------------------------------------------------------------------------------- /config/inst.12.2.rsp: -------------------------------------------------------------------------------- 1 | oracle.install.responseFileVersion=/oracle/install/rspfmt_dbinstall_response_schema_v12.2.0 2 | oracle.install.option=INSTALL_DB_SWONLY 3 | UNIX_GROUP_NAME=dba 4 | INVENTORY_LOCATION=###ORACLE_INV### 5 | ORACLE_HOME=###ORACLE_HOME### 6 | ORACLE_BASE=###ORACLE_BASE### 7 | oracle.install.db.InstallEdition=###ORACLE_EDITION### 8 | oracle.install.db.OSDBA_GROUP=dba 9 | oracle.install.db.OSOPER_GROUP=dba 10 | oracle.install.db.OSBACKUPDBA_GROUP=dba 11 | oracle.install.db.OSDGDBA_GROUP=dba 12 | oracle.install.db.OSKMDBA_GROUP=dba 13 | oracle.install.db.OSRACDBA_GROUP=dba 14 | SECURITY_UPDATES_VIA_MYORACLESUPPORT=false 15 | DECLINE_SECURITY_UPDATES=true 16 | -------------------------------------------------------------------------------- /config/inst.18.3.rsp: -------------------------------------------------------------------------------- 1 | oracle.install.responseFileVersion=/oracle/install/rspfmt_dbinstall_response_schema_v18.0.0 2 | oracle.install.option=INSTALL_DB_SWONLY 3 | UNIX_GROUP_NAME=dba 4 | INVENTORY_LOCATION=###ORACLE_INV### 5 | ORACLE_HOME=###ORACLE_HOME### 6 | ORACLE_BASE=###ORACLE_BASE### 7 | oracle.install.db.InstallEdition=###ORACLE_EDITION### 8 | oracle.install.db.OSDBA_GROUP=dba 9 | oracle.install.db.OSOPER_GROUP=dba 10 | oracle.install.db.OSBACKUPDBA_GROUP=dba 11 | oracle.install.db.OSDGDBA_GROUP=dba 12 | oracle.install.db.OSKMDBA_GROUP=dba 13 | oracle.install.db.OSRACDBA_GROUP=dba 14 | SECURITY_UPDATES_VIA_MYORACLESUPPORT=false 15 | DECLINE_SECURITY_UPDATES=true 16 | -------------------------------------------------------------------------------- /config/inst.18.4.rsp: -------------------------------------------------------------------------------- 1 | oracle.install.responseFileVersion=/oracle/install/rspfmt_dbinstall_response_schema_v12.1.0 2 | oracle.install.option=INSTALL_DB_SWONLY 3 | ORACLE_HOSTNAME=localhost 4 | UNIX_GROUP_NAME=dba 5 | INVENTORY_LOCATION=###ORACLE_INV### 6 | SELECTED_LANGUAGES=en 7 | ORACLE_HOME=###ORACLE_HOME### 8 | ORACLE_BASE=###ORACLE_BASE### 9 | oracle.install.db.InstallEdition=###ORACLE_EDITION### 10 | oracle.install.db.DBA_GROUP=dba 11 | oracle.install.db.OPER_GROUP=dba 12 | oracle.install.db.BACKUPDBA_GROUP=dba 13 | oracle.install.db.DGDBA_GROUP=dba 14 | oracle.install.db.KMDBA_GROUP=dba 15 | SECURITY_UPDATES_VIA_MYORACLESUPPORT=false 16 | DECLINE_SECURITY_UPDATES=true 17 | -------------------------------------------------------------------------------- /config/inst.19.rsp: -------------------------------------------------------------------------------- 1 | oracle.install.responseFileVersion=/oracle/install/rspfmt_dbinstall_response_schema_v19.0.0 2 | oracle.install.option=INSTALL_DB_SWONLY 3 | UNIX_GROUP_NAME=oinstall 4 | INVENTORY_LOCATION=###ORACLE_INV### 5 | ORACLE_HOME=###ORACLE_HOME### 6 | ORACLE_BASE=###ORACLE_BASE### 7 | oracle.install.db.InstallEdition=###ORACLE_EDITION### 8 | oracle.install.db.OSDBA_GROUP=oinstall 9 | oracle.install.db.OSOPER_GROUP=oinstall 10 | oracle.install.db.OSBACKUPDBA_GROUP=oinstall 11 | oracle.install.db.OSDGDBA_GROUP=oinstall 12 | oracle.install.db.OSKMDBA_GROUP=oinstall 13 | oracle.install.db.OSRACDBA_GROUP=oinstall 14 | SECURITY_UPDATES_VIA_MYORACLESUPPORT=false 15 | DECLINE_SECURITY_UPDATES=true 16 | -------------------------------------------------------------------------------- /config/inst.21.rsp: -------------------------------------------------------------------------------- 1 | oracle.install.responseFileVersion=/oracle/install/rspfmt_dbinstall_response_schema_v19.0.0 2 | oracle.install.option=INSTALL_DB_SWONLY 3 | UNIX_GROUP_NAME=oinstall 4 | INVENTORY_LOCATION=###ORACLE_INV### 5 | ORACLE_HOME=###ORACLE_HOME### 6 | ORACLE_BASE=###ORACLE_BASE### 7 | oracle.install.db.InstallEdition=###ORACLE_EDITION### 8 | oracle.install.db.OSDBA_GROUP=oinstall 9 | oracle.install.db.OSOPER_GROUP=oinstall 10 | oracle.install.db.OSBACKUPDBA_GROUP=oinstall 11 | oracle.install.db.OSDGDBA_GROUP=oinstall 12 | oracle.install.db.OSKMDBA_GROUP=oinstall 13 | oracle.install.db.OSRACDBA_GROUP=oinstall 14 | SECURITY_UPDATES_VIA_MYORACLESUPPORT=false 15 | DECLINE_SECURITY_UPDATES=true 16 | -------------------------------------------------------------------------------- /config/inst.23.rsp: -------------------------------------------------------------------------------- 1 | oracle.install.responseFileVersion=/oracle/install/rspfmt_dbinstall_response_schema_v23.0.0 2 | installOption=INSTALL_DB_SWONLY 3 | UNIX_GROUP_NAME=oinstall 4 | INVENTORY_LOCATION=###ORACLE_INV### 5 | ORACLE_HOME=###ORACLE_HOME### 6 | ORACLE_BASE=###ORACLE_BASE### 7 | installEdition=###ORACLE_EDITION### 8 | OSDBA=oinstall 9 | OSOPER=oinstall 10 | OSBACKUPDBA=oinstall 11 | OSDGDBA=oinstall 12 | OSKMDBA=oinstall 13 | OSRACDBA=oinstall 14 | SECURITY_UPDATES_VIA_MYORACLESUPPORT=false 15 | DECLINE_SECURITY_UPDATES=true 16 | -------------------------------------------------------------------------------- /config/listener.ora.tmpl: -------------------------------------------------------------------------------- 1 | LISTENER = 2 | (DESCRIPTION_LIST = 3 | (DESCRIPTION = 4 | (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1)) 5 | (ADDRESS = (PROTOCOL = TCP)(HOST = ${CONTAINER_NAME=0.0.0.0})(PORT = 1521)) 6 | ) 7 | ) 8 | 9 | SID_LIST_LISTENER = 10 | (SID_LIST = 11 | (SID_DESC = 12 | (GLOBAL_DBNAME = ${DB_UNQNAME-$ORACLE_SID}) 13 | (ORACLE_HOME = ${ORACLE_HOME}) 14 | (SID_NAME = ${ORACLE_SID}) 15 | ) 16 | ) 17 | 18 | DEDICATED_THROUGH_BROKER_LISTENER=ON 19 | DIAG_ADR_ENABLED = off 20 | -------------------------------------------------------------------------------- /config/login.sql.tmpl: -------------------------------------------------------------------------------- 1 | set pages 9999 lines 200 tab off 2 | -------------------------------------------------------------------------------- /config/manifest: -------------------------------------------------------------------------------- 1 | # 11.2.0.2 2 | dd7881a55569d890241f11cd0eeb7d48 oracle-xe-11.2.0-1.0.x86_64.rpm.zip database 11.2.0.2 XE 3 | # 4 | # 11.2.0.4 5 | 1616f61789891a56eafd40de79f58f28 p13390677_112040_Linux-x86-64_1of7.zip database 11.2.0.4 SE,EE 6 | 67ba1e68a4f581b305885114768443d3 p13390677_112040_Linux-x86-64_2of7.zip database 11.2.0.4 SE,EE 7 | 0a508686dc487806c1d75ea02c6ff29b p6880880_112000_Linux-x86-64.zip opatch 11.2.0.4 6880880 8 | eb970c5843f3a69ad6476f7fba1f9a7f p31537677_112040_Linux-x86-64.zip patch 11.2.0.4 31537677 9 | # 10 | # 12.1 11 | #4ed271b77b14aa25eea31b6574015471 linuxamd64_12101_database_1of2.zip database 12.1.0.1 EE 12 | #623b3f8b81d4eee06e333118d4d0040f linuxamd64_12101_database_2of2.zip database 12.1.0.1 EE 13 | 080435a40bd4c8dff6399b231a808e9a linuxamd64_12102_database_1of2.zip database 12.1 EE 14 | 30f20ef9437442b8282ce3984546c982 linuxamd64_12102_database_2of2.zip database 12.1 EE 15 | 80c2928c6382af06926cb173e4f4aef5 linuxamd64_12102_database_se2_1of2.zip database 12.1 SE 16 | bf0942f360f8938917511a8960280d11 linuxamd64_12102_database_se2_2of2.zip database 12.1 SE 17 | e955139c2c62bfcad3170173c2c144c0 p6880880_121010_Linux-x86-64.zip opatch 12.1 6880880 18 | 83ba2c6f4e4eb15939ddbce9fcd9bd7f p32768233_121020_Linux-x86-64.zip patch 12.1 32768233 19 | f926c2fa170a03929a4bb330b54006da p34057742_121020_Linux-x86-64.zip patch 12.1 34057742 20 | bc427a4d8c31929da523cae7fd6e659c p34006614_121020_Linux-x86-64.zip patch 12.1 34006614 # RDBMS - DSTV38 UPDATE - TZDATA2022A 21 | # 22 | # 12.2 23 | 1841f2ce7709cf909db4c064d80aae79 linuxx64_12201_database.zip database 12.2 SE,EE 24 | 901f2781420fcf97ac74773e17b8665b p6880880_122010_Linux-x86-64.zip opatch 12.2 6880880 25 | 053a9f7b9156f89b0143d26d36a9fcd5 p34006614_122010_Linux-x86-64.zip patch 12.2 34006614 # RDBMS - DSTV38 UPDATE - TZDATA2022A 26 | # 27 | # 18c 28 | 99a7c4a088a8a502c261e741a8339ae8 LINUX.X64_180000_db_home.zip database 18.3 SE,EE 29 | #2ef79c73660191b1b6d68a5380892b60 oracle-database-ee-18c-1.0-1.x86_64.rpm database 18.3 SE,EE 30 | 901f2781420fcf97ac74773e17b8665b p6880880_180000_Linux-x86-64.zip opatch 18.3 6880880 31 | 41b4b4137a70105059d965c4e3ef55bc p34006614_180000_Linux-x86-64.zip patch 18.3 34006614 # RDBMS - DSTV38 UPDATE - TZDATA2022A 32 | # 33 | # 19c 34 | 1858bd0d281c60f4ddabd87b1c214a4f LINUX.X64_193000_db_home.zip database 19 SE,EE 35 | #1f86171d22137e31cc2086bf7af36e91 oracle-database-ee-19c-1.0-1.x86_64.rpm database 19 SE,EE 36 | 6c39043ad12e11bcdc505184631e11a2 LINUX.ARM64_1919000_db_home.zip database 19 SE,EE ARM 37 | 8d3cf4926a69cef54dbd3d4327aa90af p6880880_190000_Linux-x86-64.zip opatch 19 6880880 38 | #29118578e285c20d7799d803adbe12d5 p6880880_190000_Linux-ARM-64.zip opatch 19 6880880 ARM 39 | 2a06e8c7409b21de9be6d404d39febda p30557433_190000_Linux-x86-64.zip patch 19.6 30557433 40 | 0e0831a46cc3f8312a761212505ba5d1 p30565805_196000DBRU_Linux-x86-64.zip patch 19.6 30565805 41 | f949a2bc8c5b1e01fd24ebee8c7feebe p30869156_190000_Linux-x86-64.zip patch 19.7 30869156 42 | fef4c7b7f7c313847de69667258eb3cd p30565805_197000DBRU_Linux-x86-64.zip patch 19.7 30565805 43 | 2003566250018b0b5c53e6f98d5d6d80 p31281355_190000_Linux-x86-64.zip patch 19.8 31281355 44 | bd8060c43c60bd4337bb2a89471b1fba p30565805_198000DBRU_Linux-x86-64.zip patch 19.8 30565805 45 | 65c2d78b70ebba4ee66d9454af9bbbb8 p31771877_190000_Linux-x86-64.zip patch 19.9 31771877 46 | add92eb9abca0f67593ae08e128bc3d4 p32218454_190000_Linux-x86-64.zip patch 19.10 32218454 47 | e51e866dbe507ee8c2958ed8643e28bc p33195096_1910000DBRU_Linux-x86-64.zip patch 19.10 33195096 48 | d2b136a8eb13e2446b62752b4d55db2f p32545013_190000_Linux-x86-64.zip patch 19.11 32545013 49 | f61d7cee9f16b70069cabe9617abc3d1 p33457235_1911000DBRU_Linux-x86-64.zip patch 19.11 33457235 50 | 726b68f86c2060a63808836a6831cb3d p33153989_190000_Linux-x86-64.zip patch 19.11.2 33153989 51 | 317e43c72d6c60dc4105b0be19acc84e p33457235_1911200DBRUR_Linux-x86-64.zip patch 19.11.2 33457235 52 | d382bbd63c7230eb2aa46f98e7f90837 p32904851_190000_Linux-x86-64.zip patch 19.12 32904851 53 | 1a86167e157ede01b3f266ce6b0994df p33457235_1912000DBRU_Linux-x86-64.zip patch 19.12 33457235 54 | 51476858bed61c8c764e613a59822d6b p33195096_1912000DBRU_Linux-x86-64.zip patch 19.12 33195096 55 | 73133e0259a6fc39326001bc43976881 p33210889_190000_Linux-x86-64.zip patch 19.12.1 33210889 56 | 9d868fb8f273ef10338ee5ee15a7c336 p33457235_1912100DBRUR_Linux-x86-64.zip patch 19.12.1 33457235 57 | de60e587df931a96deac13c5119e4264 p33494256_190000_Linux-x86-64.zip patch 19.12.2 33494256 58 | 5b2f369f6c1f0397c656a5554bc864e6 p33192793_190000_Linux-x86-64.zip patch 19.13 33192793 59 | 680af566ae1ed41a9916dfb0a122565c p33457235_1913000DBRU_Linux-x86-64.zip patch 19.13 33457235 60 | d6ed864be92a8b6a0b17ae4881d592ad p33195096_1913000DBRU_Linux-x86-64.zip patch 19.13 33195096 61 | 30eb702fe0c1bee393bb80ff8f10afe9 p33516456_190000_Linux-x86-64.zip patch 19.13.1 33516456 62 | de8c41d94676479b9aa35d66ca11c96a p33457235_1913100DBRUR_Linux-x86-64.zip patch 19.13.1 33457235 63 | b0f065b8cb6e6b45ccb3558042a7edc5 p33783771_190000_Linux-x86-64.zip patch 19.13.2 33783771 64 | 2470d39d7013c8dddb9f46769aeee36e p33195096_1913200DBRUR_Linux-x86-64.zip patch 19.13.2 33195096 65 | 7bcfdcd0f3086531e232fd0237b7438f p33515361_190000_Linux-x86-64.zip patch 19.14 33515361 66 | 3d51419f3f820f1a610c1cb4af1c350e p33457235_1914000DBRU_Linux-x86-64.zip patch 19.14 33457235 67 | 84e8c009daca658ce32fb99a31bc3984 p33195096_1914000DBRU_Linux-x86-64.zip patch 19.14 33195096 68 | 9af8fefc1cd25cfbef611922091a81bc p33806138_190000_Linux-x86-64.zip patch 19.14.1 33806138 69 | 665b940107da7f51f611fcbbf27f0df3 p34110559_190000_Linux-x86-64.zip patch 19.14.2 34110559 70 | 8da9aac7168bd850521c23f0c7ea70d2 p33195096_1914200DBRUR_Linux-x86-64.zip patch 19.14.2 33195096 71 | 4b1ce8b287073994ddf72282a7d1e2e9 p33806152_190000_Linux-x86-64.zip patch 19.15 33806152 72 | ec7cc001b66271c6475b7dca7f6d0163 p33195096_1915000DBRU_Linux-x86-64.zip patch 19.15 33195096 73 | 5f7d0f8d72d425167a7f43dde54377de p34119532_190000_Linux-x86-64.zip patch 19.15.1 34119532 74 | 999ea5904579ff3d9920388db1b4cf70 p33195096_1915100DBRUR_Linux-x86-64.zip patch 19.15.1 33195096 75 | ebc61b15e15aa0d84131b61ae776ba41 p34429835_190000_Linux-x86-64.zip patch 19.15.2 34429835 76 | 12d5aadb52df3269ad0d995657660bb0 p34133642_190000_Linux-x86-64.zip patch 19.16 34133642 77 | b82e96e953f3da29987b8914c64b3c4e p33195096_1916000DBRU_Linux-x86-64.zip patch 19.16 33195096 78 | 42a6c3484a1bd7f6aa3ca3434d762fb7 p34444812_190000_Linux-x86-64.zip patch 19.16.1 34444812 79 | 5866e2e148a1cecc267b3b43e68b62c3 p34419443_190000_Linux-x86-64.zip patch 19.17 34419443 80 | ecf713d7b63f04415c942a6e181ff84c p34765931_190000_Linux-x86-64.zip patch 19.18 34765931 81 | #e537faca84d6f471556d999cf0683e7d p35319490_190000_Linux-x86-64.zip patch 19.20 35319490 # GI 82 | #f76d716ff2ac38f390cb5d4f80329592 p35370167_190000_Linux-x86-64.zip patch 19.20 35370167 # GI+OJVM 83 | c4a5f60d3fc3fa5552468648c8eec0be p35320081_190000_Linux-x86-64.zip patch 19.20 35320081 # DBRU 84 | #519171abb48a17e9645fbdac7a02b499 p35370174_190000_Linux-x86-64.zip patch 19.20 35370174 # DBRU+OJVM 85 | #d3cf62c2d8d58b6cfd3a1ec2c5c3cbc2 p35642822_190000_Linux-x86-64.zip patch 19.21 35642822 # GI 86 | #20390ae5ce834b6e73e2fa9e847c5bbd p35643107_190000_Linux-ARM-64.zip patch 19.21 35643107 ARM 87 | 5bdda7ea563cf4dad97e3e0dd23cd637 p35643107_190000_Linux-x86-64.zip patch 19.21 35643107 # DBRU 88 | #5c21e9c6a325274ff875351e31835c4a p35742441_190000_Linux-x86-64.zip patch 19.21 35742441 # GI+OJVM 89 | #64a883bb4e515741d7c183151eec9e52 p35742413_190000_Linux-x86-64.zip patch 19.21 35742413 # DBRU+OJVM 90 | 70ae8bfa23c0e5b9b4b65e977ab57f55 p35943157_190000_Linux-x86-64.zip patch 19.22 35943157 # DBRU 91 | 96d87c4fc52c631283c9e97ef8ccaed4 p36356978_1922000DBRU_Linux-x86-64.zip patch 19.22 36356978 # DBMRP 19.22.0.0.240319 92 | 59bd01e1f904ac9586d74bb0fd44b9ff p36233263_190000_Linux-x86-64.zip patch 19.23 36233263 # DBRU 93 | #8ea864606aa290c788da012172dc7d0f p36209492_190000_Linux-x86-64.zip patch 19.23 36209492 # DBRU+OJVM 94 | #fdeb6175d3b851664d68142e069e65a2 p36233126_190000_Linux-x86-64.zip patch 19.23 36233126 # GI 95 | #09333b5e9ab6ad25ad7ad74446c8b821 p36209493_190000_Linux-x86-64.zip patch 19.23 36209493 # GI+OJVM 96 | 1851472b1a587c4b2dc501fed5ce04a1 p36582781_190000_Linux-x86-64.zip patch 19.24 36582781 97 | 5fc16e540ff5fe6343e736f710e2de6b p36912597_190000_Linux-x86-64.zip patch 19.25 36912597 98 | # DATABASE PERL UPDATE IN 19C TO V5.32-1 (CVE-2022-23990 - LIBEXPAT UPDATE) 99 | # General for any version, must be applied after RU 100 | 60dbd6f92635fb98790a9d69e80d5dcf p33912872_190000_Linux-x86-64.zip patch 19 33912872 101 | 1948e198d83209e22be4653822448123 p34006614_190000_Linux-x86-64.zip patch 19 34006614 # RDBMS - DSTV38 UPDATE - TZDATA2022A 102 | # 103 | # 21c 104 | 83d2945ef61d2bb2e5945c1c10155134 LINUX.X64_211000_db_home.zip database 21.1 SE,EE 105 | 8ac915a800800ddf16a382506d3953db LINUX.X64_213000_db_home.zip database 21 SE,EE 106 | #be49680760d60089815cc0b4ae2e1805 oracle-database-ee-21c-1.0-1.ol7.x86_64.rpm database 21 SE,EE OEL7 107 | #db3d15b21e17a455a1c28861d5ce0a4f oracle-database-ee-21c-1.0-1.ol8.x86_64.rpm database 21 SE,EE OEL8 108 | b4d9da84ad17461a6e11c34a8461dd8d oracle-database-xe-21c-1.0-1.ol7.x86_64.rpm database 21 XE OEL7 109 | 6e795f0d868743050364c14517c1b641 oracle-database-xe-21c-1.0-1.ol8.x86_64.rpm database 21 XE OEL8 110 | 901f2781420fcf97ac74773e17b8665b p6880880_210000_Linux-x86-64.zip opatch 21 6880880 111 | 458e5b20bb62b801da940000a5137fac p33516412_210000_Linux-x86-64.zip patch 21.5 33516412 112 | e8e5e81faafb730de225f111ede677f8 p33843745_210000_Linux-x86-64.zip patch 21.6 33843745 113 | 70cb6d33ea30aff9302a5bf0ac1e5348 p34160444_210000_Linux-x86-64.zip patch 21.7 34160444 114 | 9e2c9df0385b7c9cd96faeeff7c12558 p34527084_210000_Linux-x86-64.zip patch 21.8 34527084 115 | 55a24d77f6128f36c7e28ad08c122df2 p34839741_210000_Linux-x86-64.zip patch 21.9 34839741 116 | #23ed6147c1948d346cfbc5de72054a1f p35427907_210000_Linux-x86-64.zip patch 21.11 35427907 # GI+OJVM 117 | 559fa35decaed605cfac05e33fbc3ffd p35428978_210000_Linux-x86-64.zip patch 21.11 35428978 # DBRU 118 | #ebcfb0073611995d3963636f2b12d069 p35738010_210000_Linux-x86-64.zip patch 21.12 35738010 # GI 119 | 6d36e2f7795c0c01dd7076cb85e71671 p35740258_210000_Linux-x86-64.zip patch 21.12 35740258 # DBRU 120 | 90a375bee9c6d184e6bc1fe56d2bcccb p36352352_210000_Linux-x86-64.zip patch 21.14 36352352 # DBRU 121 | #64cf83e08eb897fba92de1995e4ceb46 p36352207_210000_Linux-x86-64.zip patch 21.14 36352207 # GI 122 | # DATABASE PERL UPDATE FOR 21C TO V5.32-1 (CVE-2022-23990 - LIBEXPAT UPDATE) 123 | # General for any version, must be applied after RU 124 | e7922edf762f751675e4d90a29627b52 p33928944_210000_Linux-x86-64.zip patch 21 33928944 125 | c42962f8e97b920286c2e07f256e57cd p34006614_210000_Linux-x86-64.zip patch 21 34006614 # RDBMS - DSTV38 UPDATE - TZDATA2022A 126 | # 127 | # 23ai 128 | #f3b8ed1a1e6cbb107eb906e0f2acf7ea LINUX.X64_231000_db_home.zip database 23.1 SE,EE 129 | #94fd4db83ddbc75c670b76cc6c3156d9 LINUX.X64_233000_db_home.zip database 23 SE,EE 130 | 594d372a21e558b1a5155fc3b111894a LINUX.X64_235000_db_home.zip database 23 SE,EE 131 | acbe2c68448d1ba9f86ccd315ee9d22d p6880880_230000_Linux-x86-64.zip opatch 23 6880880 132 | #f33f60e41f7a8905f3074b15958de614 p35921148_230000_Linux-x86-64.zip patch 23.3 35921148 # 23.3 OCT2023 SECURITY FIXES (Patch) 133 | 0a50f1236143c0566ba684b90d44f46a p36507037_230000_Linux-x86-64.zip patch 23.3 36507037 # 23.3 APR2024 Security Fixes 134 | 594d372a21e558b1a5155fc3b111894a LINUX.X64_235000_db_home.zip database 23 SE,EE 135 | -------------------------------------------------------------------------------- /config/netrc.example: -------------------------------------------------------------------------------- 1 | # Create a MOS credential file, ./config/.netrc 2 | # Update the login and password fields only 3 | machine login.oracle.com 4 | login mos_user@email.com 5 | password your_mos_password 6 | -------------------------------------------------------------------------------- /config/old/manifest.11.2.0.2: -------------------------------------------------------------------------------- 1 | dd7881a55569d890241f11cd0eeb7d48 oracle-xe-11.2.0-1.0.x86_64.rpm.zip database 11.2.0.2 XE 2 | -------------------------------------------------------------------------------- /config/old/manifest.11.2.0.4: -------------------------------------------------------------------------------- 1 | 1616f61789891a56eafd40de79f58f28 p13390677_112040_Linux-x86-64_1of7.zip database 11.2.0.4 SE,EE 2 | 67ba1e68a4f581b305885114768443d3 p13390677_112040_Linux-x86-64_2of7.zip database 11.2.0.4 SE,EE 3 | 171045894bf20a80ed45fea27207b839 p6880880_112000_Linux-x86-64.zip opatch 11.2.0.4 6880880 4 | eb970c5843f3a69ad6476f7fba1f9a7f p31537677_112040_Linux-x86-64.zip patch 11.2.0.4 31537677 5 | -------------------------------------------------------------------------------- /config/old/manifest.12.1: -------------------------------------------------------------------------------- 1 | 080435a40bd4c8dff6399b231a808e9a linuxamd64_12102_database_1of2.zip database 12.1 EE 2 | 30f20ef9437442b8282ce3984546c982 linuxamd64_12102_database_2of2.zip database 12.1 EE 3 | dadbf2cfbc9b53f92d0b07f6677af966 linuxamd64_12102_database_se2_1of2.zip database 12.1 SE 4 | 2bda8cd4883bbd3f892dc152e568fc9e linuxamd64_12102_database_se2_2of2.zip database 12.1 SE 5 | 9a66f9ff5ccedf1a253820d2984a540b p6880880_121010_Linux-x86-64.zip opatch 12.1 6880880 6 | 19cdb4322035099328e2a90737918767 p32768233_121020_Linux-x86-64.zip patch 12.1 32768233 7 | -------------------------------------------------------------------------------- /config/old/manifest.12.2: -------------------------------------------------------------------------------- 1 | 1841f2ce7709cf909db4c064d80aae79 linuxx64_12201_database.zip database 12.2 SE,EE 2 | 9a66f9ff5ccedf1a253820d2984a540b p6880880_122010_Linux-x86-64.zip opatch 12.2 6880880 3 | -------------------------------------------------------------------------------- /config/old/manifest.18.3: -------------------------------------------------------------------------------- 1 | 99a7c4a088a8a502c261e741a8339ae8 LINUX.X64_180000_db_home.zip database 18.3 SE,EE 2 | #2ef79c73660191b1b6d68a5380892b60 oracle-database-ee-18c-1.0-1.x86_64.rpm database 18.3 SE,EE 3 | 9a66f9ff5ccedf1a253820d2984a540b p6880880_180000_Linux-x86-64.zip opatch 18.3 6880880 4 | -------------------------------------------------------------------------------- /config/old/manifest.19: -------------------------------------------------------------------------------- 1 | 1858bd0d281c60f4ddabd87b1c214a4f LINUX.X64_193000_db_home.zip database 19 SE,EE 2 | 6c39043ad12e11bcdc505184631e11a2 LINUX.ARM64_1919000_db_home.zip database 19 SE,EE ARM 3 | #1f86171d22137e31cc2086bf7af36e91 oracle-database-ee-19c-1.0-1.x86_64.rpm database 19 SE,EE 4 | #f65d3ce87cec3a09c3f2bc480c58ea4b p6880880_190000_Linux-x86-64.zip opatch 19 6880880 5 | 9a66f9ff5ccedf1a253820d2984a540b p6880880_190000_Linux-x86-64.zip opatch 19 6880880 6 | 2a06e8c7409b21de9be6d404d39febda p30557433_190000_Linux-x86-64.zip patch 19.6 30557433 7 | 0e0831a46cc3f8312a761212505ba5d1 p30565805_196000DBRU_Linux-x86-64.zip patch 19.6 30565805 8 | f949a2bc8c5b1e01fd24ebee8c7feebe p30869156_190000_Linux-x86-64.zip patch 19.7 30869156 9 | fef4c7b7f7c313847de69667258eb3cd p30565805_197000DBRU_Linux-x86-64.zip patch 19.7 30565805 10 | 2003566250018b0b5c53e6f98d5d6d80 p31281355_190000_Linux-x86-64.zip patch 19.8 31281355 11 | bd8060c43c60bd4337bb2a89471b1fba p30565805_198000DBRU_Linux-x86-64.zip patch 19.8 30565805 12 | 65c2d78b70ebba4ee66d9454af9bbbb8 p31771877_190000_Linux-x86-64.zip patch 19.9 31771877 13 | add92eb9abca0f67593ae08e128bc3d4 p32218454_190000_Linux-x86-64.zip patch 19.10 32218454 14 | d2b136a8eb13e2446b62752b4d55db2f p32545013_190000_Linux-x86-64.zip patch 19.11 32545013 15 | f61d7cee9f16b70069cabe9617abc3d1 p33457235_1911000DBRU_Linux-x86-64.zip patch 19.11 33457235 16 | 726b68f86c2060a63808836a6831cb3d p33153989_190000_Linux-x86-64.zip patch 19.11.2 33153989 17 | 317e43c72d6c60dc4105b0be19acc84e p33457235_1911200DBRUR_Linux-x86-64.zip patch 19.11.2 33457235 18 | a3cc49832e94a6abd0490ab22732b39f p32904851_190000_Linux-x86-64.zip patch 19.12 32904851 19 | 1a86167e157ede01b3f266ce6b0994df p33457235_1912000DBRU_Linux-x86-64.zip patch 19.12 33457235 20 | 73133e0259a6fc39326001bc43976881 p33210889_190000_Linux-x86-64.zip patch 19.12.1 33210889 21 | 9d868fb8f273ef10338ee5ee15a7c336 p33457235_1912100DBRUR_Linux-x86-64.zip patch 19.12.1 33457235 22 | de60e587df931a96deac13c5119e4264 p33494256_190000_Linux-x86-64.zip patch 19.12.2 33494256 23 | 5b2f369f6c1f0397c656a5554bc864e6 p33192793_190000_Linux-x86-64.zip patch 19.13 33192793 24 | 680af566ae1ed41a9916dfb0a122565c p33457235_1913000DBRU_Linux-x86-64.zip patch 19.13 33457235 25 | 30eb702fe0c1bee393bb80ff8f10afe9 p33516456_190000_Linux-x86-64.zip patch 19.13.1 33516456 26 | de8c41d94676479b9aa35d66ca11c96a p33457235_1913100DBRUR_Linux-x86-64.zip patch 19.13.1 33457235 27 | b0f065b8cb6e6b45ccb3558042a7edc5 p33783771_190000_Linux-x86-64.zip patch 19.13.2 33783771 28 | 7bcfdcd0f3086531e232fd0237b7438f p33515361_190000_Linux-x86-64.zip patch 19.14 33515361 29 | 9af8fefc1cd25cfbef611922091a81bc p33806138_190000_Linux-x86-64.zip patch 19.14.1 33806138 30 | 665b940107da7f51f611fcbbf27f0df3 p34110559_190000_Linux-x86-64.zip patch 19.14.2 34110559 31 | 4b1ce8b287073994ddf72282a7d1e2e9 p33806152_190000_Linux-x86-64.zip patch 19.15 33806152 32 | ec7cc001b66271c6475b7dca7f6d0163 p33195096_1915000DBRU_Linux-x86-64.zip patch 19.15 33195096 33 | 5f7d0f8d72d425167a7f43dde54377de p34119532_190000_Linux-x86-64.zip patch 19.15.1 34119532 34 | ebc61b15e15aa0d84131b61ae776ba41 p34429835_190000_Linux-x86-64.zip patch 19.15.2 34429835 35 | 12d5aadb52df3269ad0d995657660bb0 p34133642_190000_Linux-x86-64.zip patch 19.16 34133642 36 | b82e96e953f3da29987b8914c64b3c4e p33195096_1916000DBRU_Linux-x86-64.zip patch 19.16 33195096 37 | 42a6c3484a1bd7f6aa3ca3434d762fb7 p34444812_190000_Linux-x86-64.zip patch 19.16.1 34444812 38 | 5866e2e148a1cecc267b3b43e68b62c3 p34419443_190000_Linux-x86-64.zip patch 19.17 34419443 39 | # DATABASE PERL UPDATE IN 19C TO V5.32-1 (CVE-2022-23990 - LIBEXPAT UPDATE) 40 | # General for any version, must be applied after RU 41 | fd96f9db3c1873dfee00efe8088186a4 p33912872_190000_Linux-x86-64.zip patch 19 33912872 42 | -------------------------------------------------------------------------------- /config/old/manifest.21: -------------------------------------------------------------------------------- 1 | 8ac915a800800ddf16a382506d3953db LINUX.X64_213000_db_home.zip database 21 SE,EE 2 | #be49680760d60089815cc0b4ae2e1805 oracle-database-ee-21c-1.0-1.ol7.x86_64.rpm database 21 SE,EE OEL7 3 | #db3d15b21e17a455a1c28861d5ce0a4f oracle-database-ee-21c-1.0-1.ol8.x86_64.rpm database 21 SE,EE OEL8 4 | 9a66f9ff5ccedf1a253820d2984a540b p6880880_210000_Linux-x86-64.zip opatch 21 6880880 5 | e52c22cdc2f6cb18f571569c9412b693 p33516412_210000_Linux-x86-64.zip patch 21.5 33516412 6 | a4f3339727becb27a4033b84615ac214 p33843745_210000_Linux-x86-64.zip patch 21.6 33843745 7 | 70cb6d33ea30aff9302a5bf0ac1e5348 p34160444_210000_Linux-x86-64.zip patch 21.7 34160444 8 | f9fd56bcb1f4faab2ebde54f193b7a63 p34527084_210000_Linux-x86-64.zip patch 21.8 34527084 9 | # DATABASE PERL UPDATE FOR 21C TO V5.32-1 (CVE-2022-23990 - LIBEXPAT UPDATE) 10 | # General for any version, must be applied after RU 11 | 1e3fdfd8dfea43b9d9f34d1202348b89 p33928944_210000_Linux-x86-64.zip patch 21 33928944 12 | -------------------------------------------------------------------------------- /config/rlwrap.tmpl: -------------------------------------------------------------------------------- 1 | alias sqlplus="rlwrap \$ORACLE_HOME/bin/sqlplus" 2 | alias rman="rlwrap \$ORACLE_HOME/bin/rman" 3 | alias dgmgrl="rlwrap \$ORACLE_HOME/bin/dgmgrl" 4 | -------------------------------------------------------------------------------- /config/sqlnet.ora.tmpl: -------------------------------------------------------------------------------- 1 | NAME.DIRECTORY_PATH=(TNSNAMES, EZCONNECT, HOSTNAME) 2 | -------------------------------------------------------------------------------- /config/tnsnames.ora.tmpl: -------------------------------------------------------------------------------- 1 | ${ALIAS} = 2 | (DESCRIPTION = 3 | (ADDRESS = (PROTOCOL = TCP)(HOST = ${CONTAINER_NAME=0.0.0.0})(PORT = 1521)) 4 | (CONNECT_DATA = 5 | (SERVER = DEDICATED) 6 | (SERVICE_NAME = ${ALIAS}) 7 | ) 8 | ) 9 | -------------------------------------------------------------------------------- /database/README.md: -------------------------------------------------------------------------------- 1 | # Database Software Directory 2 | Place database software in this directory. 3 | -------------------------------------------------------------------------------- /database/patches/README.md: -------------------------------------------------------------------------------- 1 | # Database Patch Directory 2 | Place database patches in this directory and add a corresponding file, `../../version/install/manifest` that includes the patch ID and full patch name: 3 | ``` 4 | 33457235 p33457235_1913000DBRU_Linux-x86-64.zip 5 | ``` 6 | When applying multiple patches, add the entries in order of application. 7 | 8 | There is no need to add OPatch to this list; it is checked automatically. 9 | -------------------------------------------------------------------------------- /functions.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Fix sed discrepancies on OSX: 4 | case $(sed --help 2>&1) in 5 | *GNU* ) SED () { sed -i "$@"; } 6 | ;; 7 | * ) SED () { sed -i '' "$@"; } 8 | ;; 9 | esac 10 | 11 | logger() { 12 | local __format="$1" 13 | shift 1 14 | 15 | __line="# ----------------------------------------------------------------------------------------------- #" 16 | 17 | if [[ $__format =~ B ]] 18 | then printf "\n%s\n" "$__line" 19 | elif [[ $__format =~ b ]] 20 | then printf "\n" 21 | fi 22 | 23 | printf "%s\n" " $*" 24 | 25 | if [[ $__format =~ A ]] 26 | then printf "%s\n\n" "$__line" 27 | elif [[ $__format =~ a ]] 28 | then printf "\n" 29 | fi 30 | 31 | } 32 | 33 | warn() { 34 | printf "WARNING: %s\n" "$@" 35 | } 36 | 37 | error() { 38 | printf "ERROR: %s\nExiting...\n" "$@" 39 | exit 1 40 | } 41 | 42 | debug() { 43 | __s1= 44 | __s2= 45 | if [ "$debug" ] 46 | then __s1="DEBUG: $1" 47 | __s2="${2//\n/}" #"$(echo $2 | sed 's/\n//g')" 48 | printf "%-40s: %s\n" "$__s1" "$__s2" | tee -a "$3" 49 | fi 50 | } 51 | 52 | fixcase() { 53 | echo "$1" | tr '[:upper:]' '[:lower:]' 54 | } 55 | 56 | FIXCASE() { 57 | echo "$1" | tr '[:lower:]' '[:upper:]' 58 | } 59 | 60 | replaceVars() { 61 | local __file="$1" 62 | local __var="$2" 63 | if [ -z "$3" ] 64 | then local __val="$(eval echo "\$$(echo "$__var")")" 65 | else local __val="$3" 66 | fi 67 | # SED -e "s|###${__var}###|"${__val}"|g" "$__file" 68 | SED -e "s|###${__var}###|${__val}|g" "$__file" 69 | } 70 | 71 | checkSum() { 72 | # $1 is the file name containing the md5 hashes 73 | # $2 is the extension to check 74 | grep -E "${2}$" "$1" | while read checksum_value filename 75 | do 76 | # md5sum is present and values do not match 77 | if [ "$(type md5sum 2>/dev/null)" ] && [ ! "$(md5sum "$INSTALL_DIR"/"$filename" | awk '{print $1}')" == "$checksum_value" ] 78 | then error "Checksum for $filename did not match" 79 | else # Unzip to the correct directory--ORACLE_HOME for 18c/19c, INSTALL_DIR for others 80 | case $ORACLE_VERSION in 81 | 18.*|19.*|21.*) sudo su - oracle -c "unzip -oq -d $ORACLE_HOME $INSTALL_DIR/$filename" ;; 82 | *) sudo su - oracle -c "unzip -oq -d $INSTALL_DIR $INSTALL_DIR/$filename" ;; 83 | esac 84 | fi 85 | done 86 | } 87 | 88 | -------------------------------------------------------------------------------- /manageOracle.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | #---------------------------------------------------------------------# 3 | # # 4 | # Oracle Container Management # 5 | # # 6 | # This script is used to perform all management functions for Oracle # 7 | # database containers. The default action starts a database, running # 8 | # DBCA if none exists. Other options include: # 9 | # # 10 | # -e: Configure the environment (deprecated) # 11 | # -h: Perform the Docker health check # 12 | # -O: Install Oracle database software # 13 | # -p: List patches installed in the database # 14 | # -P: Change privileged passwords # 15 | # -R: Perform post-software installation root actions # 16 | # -U: Install an addition home for upgrade images # 17 | #---------------------------------------------------------------------# 18 | ORACLE_CHARACTERSET=${ORACLE_CHARACTERSET:-AL32UTF8} 19 | ORACLE_NLS_CHARACTERSET=${ORACLE_NLS_CHARACTERSET:-AL16UTF16} 20 | 21 | logger() { 22 | local __format="$1" 23 | shift 1 24 | 25 | __line="# ----------------------------------------------------------------------------------------------- #" 26 | 27 | if [[ $__format =~ B ]] 28 | then printf "\n%s\n" "${__line}" 29 | elif [[ $__format =~ b ]] 30 | then printf "\n" 31 | fi 32 | 33 | if [[ $__format =~ D ]] 34 | then dt="at $(date -R)" 35 | elif [[ $__format =~ d ]] 36 | then dt="at $(date '+%F %T')" 37 | else dt="" 38 | fi 39 | 40 | printf "%s %s\n" " $*" "$dt" 41 | 42 | if [[ $__format =~ A ]] 43 | then printf "%s\n" "${__line}" 44 | elif [[ $__format =~ a ]] 45 | then printf "\n" 46 | fi 47 | } 48 | 49 | warn() { 50 | printf "WARNING: %s\n" "$@" 51 | } 52 | 53 | error() { 54 | printf "ERROR: %s\nExiting...\n" "$@" 55 | return 1 56 | } 57 | 58 | debug() { 59 | __s1= 60 | __s2= 61 | if [ "$debug" ] 62 | then __s1="DEBUG: $1" 63 | __s2="${2//\n/}" 64 | printf "%-40s: %s\n" "$__s1" "$__s2" | tee -a "$3" 65 | fi 66 | } 67 | 68 | fixcase() { 69 | echo "$1" | tr '[:upper:]' '[:lower:]' 70 | } 71 | 72 | FIXCASE() { 73 | echo "$1" | tr '[:lower:]' '[:upper:]' 74 | } 75 | 76 | _sigint() { 77 | logger BA "${FUNCNAME[0]}: SIGINT recieved: stopping database" 78 | stopDB 79 | } 80 | 81 | _sigterm() { 82 | logger BA "${FUNCNAME[0]}: SIGTERM received: stopping database" 83 | stopDB 84 | } 85 | 86 | _sigkill() { 87 | logger BA "${FUNCNAME[0]}: SIGKILL received: Stopping database" 88 | stopDB 89 | } 90 | 91 | replaceVars() { 92 | local __file="$1" 93 | local __var="$2" 94 | if [ -z "$3" ] 95 | then local __val="$(eval echo \$$(echo "$__var"))" 96 | else local __val="$3" 97 | fi 98 | sed -i -e "s|###${__var}###|${__val}|g" "$__file" 99 | } 100 | 101 | checkDirectory() { 102 | if [ ! -d "$1" ] 103 | then error "Directory $1 does not exist" 104 | elif [ ! -w "$1" ] 105 | then error "Directory $1 is not writable" 106 | fi 107 | } 108 | 109 | getPreinstall() { 110 | # Set the default RPM by version: 111 | case $1 in 112 | 11*) pre="oracle-rdbms-server-11gR2-preinstall unzip" ;; 113 | 12.1*) pre="oracle-rdbms-server-12cR1-preinstall tar" ;; 114 | 12.2*) pre="oracle-database-server-12cR2-preinstall" ;; 115 | 18*) pre="oracle-database-preinstall-18c" ;; 116 | 19*) pre="oracle-database-preinstall-19c" ;; 117 | 21*) pre="oracle-database-preinstall-21c" ;; 118 | 23*) pre="oracle-database-preinstall-23ai-1.0-2.el8.x86_64.rpm" 119 | curl -L -o "${pre}" https://yum.oracle.com/repo/OracleLinux/OL8/appstream/x86_64/getPackage/"${pre}" 120 | microdnf install -y dnf 121 | dnf localinstall -y "${pre}" ;; 122 | *) pre="oracle-database-preinstall-19c" ;; 123 | esac 124 | 125 | # Set the EPEL release: 126 | release=$(grep -e "^VERSION=" /etc/os-release | sed -e 's/^.*=\"//g' -e 's/\..*$//g') 127 | # release=$(grep -e "^PLATFORM_ID" /etc/os-release | sed -e 's/^.*://g' -e 's/"//g') 128 | 129 | export RPM_LIST="file hostname openssl oracle-epel-release-el${release} ${pre} ${RPM_LIST}" 130 | } 131 | 132 | getYum() { 133 | # Get the correct package installer: yum, dnf, or microdnf: 134 | export YUM=$(command -v yum || command -v dnf || command -v microdnf) 135 | } 136 | 137 | configENV() { 138 | set -e 139 | 140 | local __min_space_gb=${MIN_SPACE_GB:-12} 141 | local __target_home=${TARGET_HOME:-$ORACLE_HOME} 142 | 143 | if [ ! "$(df -PB 1G / | tail -n 1 | awk '{print $4}')" -ge "$__min_space_gb" ] 144 | then error "The build requires at least $__min_space_gb GB free space." 145 | fi 146 | 147 | getPreinstall "$ORACLE_VERSION" 148 | getYum 149 | 150 | $YUM -y update 151 | $YUM -y install $RPM_LIST 152 | sync 153 | 154 | if [ -n "$RPM_SUPPLEMENT" ] 155 | then $YUM -y install "$RPM_SUPPLEMENT" 156 | fi 157 | 158 | # Add option to add systemd support to the image (for AHF/TFA) 159 | if [ -n "$SYSTEMD" ] 160 | then $YUM -y install systemd 161 | cd /lib/systemd/system/sysinit.target.wants 162 | for i in * 163 | do [ "$i" == systemd-tmpfiles-setup.service ] || rm -f "$i" 164 | done 165 | rm -f /etc/systemd/system/{getty,graphical,local-fs,remote-fs,sockets,sysinit,system-update,systemd-remount}.target.wants/* 166 | rm -f /lib/systemd/system/{anaconda,basic,local-fs,multi-user}.target.wants/* 167 | rm -f /lib/systemd/system/sockets.target.wants/{*initctl*,*udev*} 168 | rm -rf /var/cache/yum 169 | sync 170 | systemctl set-default multi-user.target 171 | fi 172 | 173 | $YUM clean all 174 | 175 | mkdir -p {"$INSTALL_DIR","$SCRIPTS_DIR"} || error "Failure creating directories." 176 | } 177 | 178 | configDBENV() { 179 | set -e 180 | 181 | local __target_home=${TARGET_HOME:-$ORACLE_HOME} 182 | 183 | mkdir -p {"$ORACLE_INV","$ORACLE_HOME","$__target_home","${DATA}"/dbconfig,"${RECO}"/fast_recovery_area,"$ORACLE_BASE"/{admin,scripts/{setup,startup}}} || error "Failure creating directories." 184 | case $ORACLE_VERSION in 185 | 18.*|19.*|2*) if [ "${ROOH^^}" = "ENABLE" ]; then mkdir -p "$ORACLE_BASE"/{dbs,homes} || error "Failure creating directories."; fi 186 | ;; 187 | esac 188 | chown -R oracle:oinstall "$INSTALL_DIR" "$SCRIPTS_DIR" "$ORACLE_INV" "$ORACLE_BASE" "${DATA}" "${RECO}" "$__target_home" || error "Failure changing directory ownership." 189 | ln -s "$ORACLE_BASE"/scripts /docker-entrypoint-initdb.d || error "Failure setting Docker entrypoint." 190 | echo oracle:oracle | chpasswd || error "Failure setting the oracle user password." 191 | } 192 | 193 | configUserENV() { 194 | # Create login.sql: 195 | if [ -n "$ORACLE_PATH" ] && [ ! -f "$ORACLE_PATH/login.sql" ] 196 | then copyTemplate "$INSTALL_DIR"/login.sql.tmpl "$ORACLE_PATH"/login.sql replace 197 | fi 198 | # Create the user profile: 199 | if [ "$(grep -c "Set Oracle environment" "$HOME"/.bashrc)" -eq 0 ] 200 | then copyTemplate "$INSTALL_DIR"/env.tmpl "$HOME"/.bashrc append 201 | fi 202 | # Add rlwrap: 203 | if [ "$(rlwrap -v)" ] 204 | then copyTemplate "$INSTALL_DIR"/rlwrap.tmpl "$HOME"/.bashrc append 205 | fi > /dev/null 2>&1 206 | } 207 | 208 | checkSum() { 209 | # $1 is the file name 210 | # $2 is the md5sum 211 | if [ -n "SKIP_MD5SUM" ] 212 | then echo 0 213 | elif [ -z "$FILE_MD5SUM" ] && [ "$(type md5sum 2>/dev/null)" ] && [ ! "$(md5sum "$1" | awk '{print $1}')" == "$2" ] 214 | then error "Checksum for $1 did not match" 215 | fi 216 | } 217 | 218 | setBase() { 219 | case $ORACLE_VERSION in 220 | 18*|19*|2*) ORACLE_BASE_CONFIG=$("$ORACLE_HOME"/bin/orabaseconfig)/dbs; export ORACLE_BASE_CONFIG 221 | ORACLE_BASE_HOME=$("$ORACLE_HOME"/bin/orabasehome); export ORACLE_BASE_HOME ;; 222 | *) ORACLE_BASE_CONFIG="$ORACLE_HOME"/dbs; export ORACLE_BASE_CONFIG 223 | ORACLE_BASE_HOME="$ORACLE_HOME"; export ORACLE_BASE_HOME ;; 224 | esac 225 | export TNS_ADMIN="$ORACLE_BASE_HOME"/network/admin 226 | } 227 | 228 | mkPass() { 229 | # Generate a random 16-character password; first character always alphanum, including one guaranteed special character: 230 | # echo "$(tr -dc '[:alnum:]' /dev/null 2>&1 || $YUM install -y curl 278 | 279 | # Log in to MOS if there isn't already a cookie file. 280 | if [ ! -f "$__cookie" ] 281 | then sudo su - oracle -c "curl $__curl_flags \"https://updates.oracle.com/Orion/Services/download\" >/dev/null" || error "MOS login failed" 282 | fi 283 | # Set ownership of the patch directory. 284 | if [ "$(stat -c "%G" "$__patch_dir")" != "$(id -gn oracle)" ] 285 | then chown oracle:"$(id -gn oracle)" "$__patch_dir" || error "Error changing ownership of $__patch_dir" 286 | fi 287 | # Get the list of available patches. 288 | sudo su - oracle -c "curl $__curl_flags -L --location-trusted \"https://updates.oracle.com/Orion/SimpleSearch/process_form?search_type=patch&patch_number=${__patch_id}&plat_lang=${__platform_id}\" -o $__patch_list" || error "Error downloading the patch list" 289 | # Loop over the list of patches that resolve to a URL containing the patch file and get the link. 290 | for link in $(grep -e "https.*$__patch_file" "$__patch_list" | sed -e "s/^.*\href[^\"]*\"//g;s/\".*$//g") 291 | do 292 | if [ "$link" ] 293 | then # Download newer/updated versions only 294 | if [ -f "$__patch_dir/$__patch_file" ] 295 | then local __curl_flags="$__curl_flags -z $__patch_dir/$__patch_file" 296 | fi 297 | # Download the patch via curl 298 | local __patch_bytes=$(sudo su - oracle -c "curl -Rk $__curl_flags -L --location-trusted \"$link\" -o $__patch_dir/$__patch_file -w '%{size_download}\n'") || error "Error downloading patch $__patch_id" 299 | if [ "$__patch_bytes" -eq 0 ] 300 | then echo "Server timestamp is not newer - patch $__patch_id was not downloaded" 301 | fi 302 | else warn "No download available for patch $__patch_id using $link" 303 | fi 304 | done 305 | } 306 | 307 | process_manifest() { 308 | case "$(uname -m)" in 309 | arm64|aarch64) arch="grep ARM64" ;; 310 | *) arch="grep -v ARM64" ;; 311 | esac 312 | 313 | case $1 in 314 | database ) grep -e "^[[:alnum:]].*\b.*\.zip[[:blank:]]*\b${1}\b[[:blank:]]*${2}[[:blank:]].*${3}" "$manifest" | eval "$arch" 315 | ;; 316 | * ) grep -e "^[[:alnum:]].*\b.*\.zip[[:blank:]]*\b${1}\b[[:blank:]]*\(${2}[[:blank:]]\|${3}[[:blank:]]\)" "$manifest" | eval "$arch" 317 | ;; 318 | esac 319 | } 320 | 321 | installPatch() { 322 | # $1 is the patch type (patch, opatch) 323 | # $2 is the version 324 | local __minor_version=$2 325 | local __major_version=${2%%.*} 326 | if [ -d "$INSTALL_DIR/patches" ] 327 | then 328 | if [ -f "$manifest" ] 329 | then manifest="$(find "$INSTALL_DIR" -maxdepth 1 -name "manifest*" 2>/dev/null)" 330 | # Allow manifest to hold version-specific (version = xx.yy) and generic patches (version = xx) and apply them in order. 331 | while read patchid install_file checksum 332 | do 333 | 334 | # If there's a credential file and either: 335 | # ...the patch file isn't present 336 | # ...or the FORCE_PATCH flag matches the patch type (all, opatch, patch) or the patch ID 337 | # ...the checksum in the patch manifest doesn't match the file 338 | local __checksum_result=$(checkSum "$INSTALL_DIR/patches/$install_file" "$checksum" 2>/dev/null) 339 | 340 | if [[ -f "/home/oracle/.netrc" && ( ! -f "$INSTALL_DIR/patches/$install_file" || "$(echo "$FORCE_PATCH" | grep -ci -e "\b$1\b" -e "\b$patchid\b" -e "\ball\b")" -eq 1 ) || "$__checksum_result" != "0" ]] 341 | then downloadPatch "$patchid" "$INSTALL_DIR"/patches "$install_file" 342 | fi 343 | if [ -f "$INSTALL_DIR/patches/$install_file" ] 344 | then case $1 in 345 | opatch) sudo su - oracle -c "unzip -oq -d $ORACLE_HOME $INSTALL_DIR/patches/$install_file" || error "An incorrect version of OPatch was found (version, architecture or bit mismatch)" ;; 346 | patch) sudo su - oracle -c "unzip -oq -d $INSTALL_DIR $INSTALL_DIR/patches/$install_file" || error "There was a problem unzipping $install_file" 347 | # Get the apply command from the README 348 | # Some README wrap the sample command in
. Counting occurrences of a bounded napply in the README seems the best solution. 349 | if [ "$(k=0; for j in $(grep -chE "\bnapply\b" "$INSTALL_DIR"/"$patchid"/README.*); do k=$(($j+$k)); done; echo $k)" -gt 0 ] 350 | then opatch_apply="napply" 351 | else opatch_apply=$(grep -E "opatch .apply.*" "$INSTALL_DIR"/"$patchid"/README.* | sort | head -1 | awk '{print $2}') 352 | fi 353 | opatch_apply="${opatch_apply:-apply}" 354 | sudo su - oracle -c "$ORACLE_HOME/OPatch/opatch $opatch_apply -silent $INSTALL_DIR/$patchid" || error "OPatch $opatch_apply for $patchid failed" 355 | ;; 356 | esac 357 | else error "Patch $patchid identified in manifest not found" 358 | fi 359 | done < <(process_manifest "$1" "$__major_version" "$__minor_version" | awk '{print $5,$2,$1}') 360 | else error "The manifest file was not found" 361 | fi 362 | else warn "The patch directory was not found" #error "The patch directory was not found" 363 | fi 364 | } 365 | 366 | getPatches() { 367 | # Print a patch summary 368 | sudo su - oracle -c "$ORACLE_HOME/OPatch/opatch lspatches" || logger BA "There was a problem running opatch lspatches" 369 | } 370 | 371 | installOracle() { 372 | set -e 373 | 374 | # Default the version and home, use local values to allow multi-home installations 375 | local __version=${1:-$ORACLE_VERSION} 376 | local __major_version=$(echo "$__version" | cut -d. -f1) 377 | local __oracle_home=${2:-$ORACLE_HOME} 378 | 379 | if [ -z "$ORACLE_EDITION" ] 380 | then error "A database edition is required" 381 | elif [ "$ORACLE_EDITION" != "EE" ] && [ "$ORACLE_EDITION" != "SE" ] && [ "$ORACLE_EDITION" != "SE2" ] && [ "$ORACLE_EDITION" != "XE" ] 382 | then error "Database edition must be one of EE, SE, SE2, or XE" 383 | elif [ "$__version" == "11.2.0.4" ] && [ "$ORACLE_EDITION" != "EE" ] && [ "$ORACLE_EDITION" != "SE" ] 384 | then error "Database edition must be EE or SE for version 11.2.0.4" 385 | elif [ "$__version" == "11.2.0.2" ] && [ "$ORACLE_EDITION" != "XE" ] 386 | then error "Database edition must be XE for version 11.2.0.2" 387 | elif [ "$ORACLE_EDITION" == "SE" ] 388 | then error "Database edition SE is only available for version 11.2.0.4" 389 | fi 390 | 391 | configDBENV 392 | 393 | checkDirectory "$ORACLE_BASE" 394 | checkDirectory "$__oracle_home" 395 | 396 | if ! [[ $__oracle_home == $ORACLE_BASE/* ]] 397 | then error "The ORACLE_HOME directory $__oracle_home must be a subdirectory of the ORACLE_BASE." 398 | fi 399 | 400 | for var in ORACLE_EDITION \ 401 | ORACLE_INV \ 402 | ORACLE_BASE \ 403 | DATA \ 404 | RECO 405 | do 406 | replaceVars "$INSTALL_DIR"/"$INSTALL_RESPONSE" "$var" 407 | done 408 | replaceVars "$INSTALL_DIR"/"$INSTALL_RESPONSE" "ORACLE_HOME" "$__oracle_home" 409 | 410 | # Allow root to su - oracle: 411 | setSudo allow 412 | # Install Oracle binaries 413 | if [ -f "$(find "$INSTALL_DIR"/ -type f -iregex '.*oracle.*\.rpm.*')" ] || [ -n "$ORACLE_RPM" ] 414 | then # Install Oracle from RPM 415 | # The ORACLE_DOCKER_INSTALL environment variable is required for RPM installation to succeed 416 | export ORACLE_DOCKER_INSTALL=true 417 | if [ -z "$ORACLE_RPM" ] 418 | then ORACLE_RPM=$(find "$INSTALL_DIR"/ -type f -iregex '.*oracle.*\.rpm.*') 419 | if [[ $ORACLE_RPM =~ .*\.zip$ ]] 420 | then unzip -q "$ORACLE_RPM" 421 | ORACLE_RPM=${ORACLE_RPM%.zip} 422 | fi 423 | fi 424 | 425 | getYum; $YUM -y localinstall "$ORACLE_RPM" 426 | 427 | # Determine the name of the init file used for RPM installation 428 | # if [ "$__version" == "11.2.0.2" ] && [ "$ORACLE_EDITION" != "XE" ] 429 | # then INIT_FILE="oracle-xe" 430 | # elif [ "$__version" == "18.4" ] && [ "$ORACLE_EDITION" != "XE" ] 431 | # then INIT_FILE="oracle-xe-18c" 432 | # else INIT_FILE="oracledb_ORCLCDB-${__major_version}c" 433 | # fi 434 | 435 | if [ -z "$INIT_FILE" ] 436 | then INIT_FILE=$(find /etc/init.d/* -maxdepth 1 -type f -regex '.*/oracle[db_|-xe].*') 437 | else INIT_FILE=/etc/init.d/"$INIT_FILE" 438 | fi 439 | 440 | # If different directories are passed to the build, move the directories and recompile. 441 | OLD_HOME=$(grep -E "^export ORACLE_HOME" "$INIT_FILE" | cut -d= -f2 | tr -d '[:space:]'); export OLD_HOME 442 | OLD_BASE=$(echo "$OLD_HOME" | sed -e "s|/product.*$||g"); export OLD_BASE 443 | OLD_INV=$(grep -E "^inventory_loc" "$OLD_HOME"/oraInst.loc | cut -d= -f2); export OLD_INV 444 | 445 | if ! [[ $OLD_BASE -ef $ORACLE_BASE ]] || ! [[ $OLD_HOME -ef $__oracle_home ]] || ! [[ $OLD_INV -ef $ORACLE_INV ]] 446 | then 447 | # Directories cannot be changed in XE. It does not have the ability to relink. 448 | if [ "$ORACLE_EDITION" == "XE" ] # TODO: clone.pl is deprecated in 19c: -o "$(echo $__version | cut -c 1-2)" == "19" ] 449 | then export ORACLE_HOME="$OLD_HOME" 450 | export ORACLE_BASE="$OLD_BASE" 451 | export ORACLE_INV="$OLD_INV" 452 | fi 453 | 454 | # Move directories to new locations 455 | if ! [[ $OLD_INV -ef $ORACLE_INV ]] 456 | then mv "$OLD_INV"/* "$ORACLE_INV"/ || error "Failed to move Oracle Inventory from $OLD_INV to $ORACLE_INV" 457 | find / -name oraInst.loc -exec sed -i -e "s|^inventory_loc=.*$|inventory_loc=$ORACLE_INV|g" {} \; 458 | rm -fr "$OLD_INV" || error "Failed to remove Oracle Inventory from $OLD_INV" 459 | fi 460 | 461 | if ! [[ $OLD_HOME -ef $__oracle_home ]] 462 | then mv "$OLD_HOME"/* "$__oracle_home"/ || error "Failed to move ORACLE_HOME from $OLD_HOME to $__oracle_home" 463 | chown -R oracle:oinstall "$__oracle_home" 464 | rm -fr "$OLD_BASE"/product || error "Failed to remove $OLD_HOME after moving to $__oracle_home" 465 | sudo su - oracle -c "$__oracle_home/perl/bin/perl $__oracle_home/clone/bin/clone.pl ORACLE_HOME=$__oracle_home ORACLE_BASE=$ORACLE_BASE -defaultHomeName -invPtrLoc $__oracle_home/oraInst.loc" || error "ORACLE_HOME cloning failed for $__oracle_home" 466 | fi 467 | 468 | if ! [[ $OLD_BASE -ef $ORACLE_BASE ]] 469 | then rsync -a "$OLD_BASE"/ "$ORACLE_BASE" || error "Failed to move ORACLE_BASE from $OLD_BASE to $ORACLE_BASE" 470 | rm -rf "$OLD_BASE" || error "Failed to remove $OLD_BASE after moving to $ORACLE_BASE" 471 | fi 472 | fi 473 | 474 | else # Install Oracle from archive 475 | 476 | manifest="$(find "$INSTALL_DIR" -maxdepth 1 -name "manifest*" 2>/dev/null)" 477 | # Set variables for installation: 478 | case $ORACLE_VERSION in 479 | 18.*|19.*|2*) __dest_dir="$ORACLE_HOME" 480 | __install_dir="$ORACLE_HOME" 481 | __install_opt="-ignorePrereqFailure" 482 | __db_version="${ORACLE_VERSION%%.*}" ;; 483 | *) __dest_dir="$INSTALL_DIR" 484 | __install_dir="$INSTALL_DIR/database" 485 | __install_opt="-ignoresysprereqs -ignoreprereq" 486 | __db_version="$ORACLE_VERSION" ;; 487 | esac 488 | # Some versions have multiple files that must be unzipped to the correct location prior to installation. 489 | # Loop over the manifest, retrieve the file and checksum values, unzip the installation files. 490 | set +e 491 | while read checksum install_file 492 | do checkSum "$INSTALL_DIR/$install_file" "$checksum" 493 | sudo su - oracle -c "unzip -oq -d $__dest_dir $INSTALL_DIR/$install_file" || error "The installation file (${install_file}) was not found." 494 | done < <(process_manifest "database" "$__db_version" "${ORACLE_EDITION::2}" | awk '{print $1,$2}') 495 | 496 | # Run the installation 497 | set +e 498 | sudo su - oracle -c "export CV_ASSUME_DISTID=${CV_ASSUME_DISTID}; $__install_dir/runInstaller -silent -force -waitforcompletion -responsefile $INSTALL_DIR/$INSTALL_RESPONSE $__install_opt" 499 | set -e 500 | 501 | if [ ! "$("$__oracle_home"/perl/bin/perl -v)" ] 502 | then mv "$__oracle_home"/perl "$__oracle_home"/perl.old 503 | curl -o "$INSTALL_DIR"/perl.tar.gz http://www.cpan.org/src/5.0/perl-5.14.1.tar.gz 504 | tar -xzf "$INSTALL_DIR"/perl.tar.gz 505 | cd "$INSTALL_DIR"/perl-* 506 | sudo su - oracle -c "./Configure -des -Dprefix=$__oracle_home/perl -Doptimize=-O3 -Dusethreads -Duseithreads -Duserelocatableinc" 507 | sudo su - oracle -c "make clean" 508 | sudo su - oracle -c "make" 509 | sudo su - oracle -c "make install" 510 | 511 | # Copy old binaries into new Perl directory 512 | rm -fr "${__oracle_home:?}"/{lib,man} 513 | cp -r "$__oracle_home"/perl.old/lib/ "$__oracle_home"/perl/ 514 | cp -r "$__oracle_home"/perl.old/man/ "$__oracle_home"/perl/ 515 | cp "$__oracle_home"/perl.old/bin/dbilogstrip "$__oracle_home"/perl/bin/ 516 | cp "$__oracle_home"/perl.old/bin/dbiprof "$__oracle_home"/perl/bin/ 517 | cp "$__oracle_home"/perl.old/bin/dbiproxy "$__oracle_home"/perl/bin/ 518 | cp "$__oracle_home"/perl.old/bin/ora_explain "$__oracle_home"/perl/bin/ 519 | rm -fr "$__oracle_home"/perl.old 520 | cd "$__oracle_home"/lib 521 | ln -sf ../javavm/jdk/jdk7/lib/libjavavm12.a 522 | chown -R oracle:oinstall "$__oracle_home" 523 | 524 | # Relink 525 | cd "$__oracle_home"/bin 526 | sudo su - oracle -c "relink all" || logger x "$(cat "$__oracle_home"/install/relink.log)"; error "Relink failed" 527 | fi 528 | 529 | echo "End of binary installation" 530 | 531 | fi # End of software binary installation 532 | 533 | # Check for OPatch 534 | installPatch opatch "${ORACLE_VERSION}" 535 | # Check for patches 536 | installPatch patch "${ORACLE_VERSION}" 537 | # Print a patch summary 538 | if [ -n "$DEBUG" ] 539 | then getPatches 540 | fi 541 | 542 | # Remove oraInventory logs 543 | if [ -d "$ORACLE_INV/logs" ] 544 | then rm -fr "$ORACLE_INV"/logs/* 2>/dev/null 545 | fi 546 | 547 | # Remove DBCA logs 548 | if [ -d "$ORACLE_BASE/cfgtoollogs" ] 549 | then rm -fr "$ORACLE_BASE"/cfgtoollogs/*/* 2>/dev/null 550 | fi 551 | 552 | # Minimize the installation 553 | if [ -n "$REMOVE_COMPONENTS" ] 554 | then local __rc=${REMOVE_COMPONENTS^^} 555 | 556 | OLDIFS=$IFS 557 | IFS=, 558 | for rc in $__rc 559 | do 560 | case $rc in 561 | APEX) # APEX 562 | rm -fr "$__oracle_home"/apex 2>/dev/null ;; 563 | DBMA) # Database migration assistant 564 | rm -fr "$__oracle_home"/dmu 2>/dev/null ;; 565 | DBUA) # DBUA 566 | rm -fr "$__oracle_home"/assistants/dbua 2>/dev/null ;; 567 | HELP) # Help files 568 | rm -fr "$__oracle_home"/network/tools/help 2>/dev/null ;; 569 | ORDS) # ORDS 570 | rm -fr "$__oracle_home"/ords 2>/dev/null ;; 571 | OUI) # OUI inventory backups 572 | rm -fr "$__oracle_home"/inventory/backup/* 2>/dev/null ;; 573 | PATCH) # Patch storage 574 | rm -fr "$__oracle_home"/.patch_storage 2>/dev/null ;; 575 | PILOT) # Pilot workflow 576 | rm -fr "$__oracle_home"/install/pilot 2>/dev/null ;; 577 | SQLD) # SQL Developer 578 | rm -fr "$__oracle_home"/sqldeveloper 2>/dev/null ;; 579 | SUP) # Support tools 580 | rm -fr "$__oracle_home"/suptools 2>/dev/null ;; 581 | TNS) # TNS samples 582 | rm -fr "$__oracle_home"/network/admin/samples 2>/dev/null ;; 583 | UCP) # UCP 584 | rm -fr "$__oracle_home"/ucp 2>/dev/null ;; 585 | ZIP) # Installation files 586 | rm -fr "$__oracle_home"/lib/*.zip 2>/dev/null ;; 587 | INV) # oraInventory logs 588 | rm -fr "$ORACLE_INV"/logs/* 2>/dev/null ;; 589 | DBCA) # DBCA logs 590 | rm -fr "$ORACLE_BASE"/cfgtoollogs/*/* 2>/dev/null ;; 591 | ADMIN) # ORACLE_BASE/admin 592 | rm -fr "$ORACLE_BASE"/admin/*/*/* 2>/dev/null ;; 593 | ROH) # Read-only home files 594 | rm -fr "$ORACLE_BASE"/homes/*/log/*/*/* 2>/dev/null 595 | rm -fr "$ORACLE_BASE"/homes/*/rdbms/log/* 2>/dev/null ;; 596 | esac 597 | done 598 | IFS=$OLDIFS 599 | fi 600 | 601 | # Enable read-only Oracle Home: 602 | case $ORACLE_VERSION in 603 | 18.*|19.*|2*) if [ "${ROOH^^}" = "ENABLE" ]; then sudo su - oracle -c "$__oracle_home/bin/roohctl -enable"; unset ROOH; fi ;; 604 | esac 605 | 606 | # Revert pam.d sudo changes: 607 | setSudo revert 608 | } 609 | 610 | runsql() { 611 | if [ -n "$2" ] 612 | then spool="spool $2 append" 613 | else spool="" 614 | fi 615 | 616 | export NLS_DATE_FORMAT='YYYY-MM-DD HH24:MI:SS' 617 | unset ORACLE_PATH 618 | unset SQLPATH 619 | "$ORACLE_HOME"/bin/sqlplus -S / as sysdba << EOF 620 | set head off termout on verify off lines 300 pages 9999 trimspool on feed off serverout on 621 | whenever sqlerror exit warning 622 | ${spool} 623 | ${1} 624 | EOF 625 | 626 | if [ "$?" -ne 0 ] 627 | then error "${FUNCNAME[0]} failed calling SQL: $1" 628 | return 1 629 | fi 630 | } 631 | 632 | startListener() { 633 | if [ "$(ps -ef | grep tnslsnr | grep "$ORACLE_HOME" | grep -v grep | wc -l)" -eq 0 ] 634 | then 635 | "$ORACLE_HOME"/bin/lsnrctl start 2>/dev/null 636 | fi 637 | } 638 | 639 | stopListener() { 640 | for __oh in $(egrep -v "^#|^$" /etc/oratab | cut -d: -f2) 641 | do "$__oh"/bin/lsnrctl stop 2>/dev/null 642 | done 643 | } 644 | 645 | startDB() { 646 | if [ -n "$ORACLE_HOME" ] && [ -n "$ORACLE_SID" ] 647 | then startListener 648 | if [ -z "$OPEN_MODE" ] || [ "$OPEN_MODE" = "OPEN" ] 649 | then runsql "startup;" 650 | else runsql "startup mount;" 651 | if [ "$OPEN_MODE" != "MOUNT" ]; then runsql "alter database open read only;"; fi 652 | if [ "$OPEN_MODE" = "APPLY" ]; then runsql "alter database recover managed standby database disconnect from session;"; fi 653 | fi 654 | else error "${FUNCNAME[0]} failed to start the database: ORACLE_HOME and ORACLE_SID must be set." 655 | return 1 656 | fi 657 | } 658 | 659 | stopDB() { 660 | # Copy the oratab before shutdown to capture any changes: 661 | local __dbconfig="${DATA}"/dbconfig/"$ORACLE_SID" 662 | if [ -f /etc/oratab ] 663 | then cp /etc/oratab "$__dbconfig"/ 2>/dev/null 664 | fi 665 | runsql "shutdown immediate;" 666 | stopListener 667 | } 668 | 669 | runDBCA() { 670 | local __version=$(echo "$ORACLE_VERSION" | cut -d. -f1) 671 | # Default init parameters 672 | local INIT_PARAMS=${INIT_PARAMS:-db_create_file_dest=${DATA},db_create_online_log_dest_1=${RECO},db_recovery_file_dest=${RECO}/fast_recovery_area,audit_trail=none,audit_sys_operations=false,java_jit_enabled=false} 673 | # local INIT_PARAMS=${INIT_PARAMS:-db_recovery_file_dest=${RECO}/fast_recovery_area,audit_trail=none,audit_sys_operations=false} 674 | if ! [[ $INIT_PARAMS =~ = ]] 675 | then error "Invalid value provided for INIT_PARAMS: $INIT_PARAMS" 676 | fi 677 | 678 | # 21c database check - PDB is mandatory and Read-Only Home is the default 679 | if [ "$__version" == "21" ] || [ "$__version" == "23" ] 680 | then # Version 21; check PDB_LIST and ORACLE_PDB and assign a default if not set: 681 | if [ -z "$PDB_LIST" ] && [ -z "$ORACLE_PDB" ] 682 | then ORACLE_PDB=${ORACLE_PDB:-ORCLPDB} 683 | fi 684 | # Set PDB_COUNT to 1 if undefined: 685 | PDB_COUNT=${PDB_COUNT:-1} 686 | fi 687 | 688 | SID_LIST=${SID_LIST:-$ORACLE_SID} 689 | OLDIFS=$IFS 690 | IFS=, 691 | SID_NUM=1 692 | for ORACLE_SID in $SID_LIST 693 | do 694 | IFS=$OLDIFS 695 | local __dbcaresponse="$ORACLE_BASE"/dbca."$ORACLE_SID".rsp 696 | local __pdb_count=${PDB_COUNT:-0} 697 | # Detect custom DBCA response files 698 | cp "$INSTALL_DIR"/dbca.*.rsp "$__dbcaresponse" 2>/dev/null || cp "${DATA}"/dbca."$ORACLE_SID".rsp "$__dbcaresponse" 2>/dev/null || cp "${DATA}"/dbca.rsp "$__dbcaresponse" 2>/dev/null 699 | 700 | # Allow DB unique names: 701 | if [ -n "$DB_UNQNAME" ] && [ "$DB_UNQNAME" != "$ORACLE_SID" ] 702 | then __db_msg="$ORACLE_SID with unique name $DB_UNQNAME" 703 | INIT_PARAMS="${INIT_PARAMS},db_unique_name=$DB_UNQNAME" 704 | else DB_UNQNAME=$ORACLE_SID 705 | __db_msg="$ORACLE_SID" 706 | fi 707 | 708 | logger BAd "${FUNCNAME[0]}: Running DBCA for database $__db_msg" 709 | 710 | # Additional messages for Data Guard: 711 | if [ -n "$CONTAINER_NAME" ]; then logger x "${FUNCNAME[0]}: Container name is: $CONTAINER_NAME"; fi 712 | if [ -n "$ROLE" ]; then logger x "${FUNCNAME[0]}: Container role is: $ROLE"; fi 713 | if [ -n "$DG_TARGET" ]; then logger x "${FUNCNAME[0]}: Container DG Target is: $DG_TARGET"; fi 714 | 715 | if [ "$SID_NUM" -eq 1 ] 716 | then # Start the listener in this home 717 | startListener 718 | unset __pdb_only 719 | export SIDENV="export ORACLE_SID=$ORACLE_SID" 720 | fi 721 | addTNSEntry "$ORACLE_SID" 722 | SID_NUM=$((SID_NUM+1)) 723 | IFS=, 724 | 725 | if [ "$__version" != "11" ] && [ -n "$PDB_LIST" ] 726 | then # Not an 11g database, PDB list is defined: 727 | OLDIFS=$IFS 728 | IFS=, 729 | PDB_NUM=1 730 | PDB_ADMIN=PDBADMIN 731 | for ORACLE_PDB in $PDB_LIST 732 | do 733 | IFS=$OLDIFS 734 | if [ "$PDB_NUM" -eq 1 ] 735 | then # Create the database and the first PDB 736 | logger BAd "${FUNCNAME[0]}: Creating container database $__db_msg and pluggable database $ORACLE_PDB" 737 | createDatabase "$__dbcaresponse" "$INIT_PARAMS" TRUE 1 "$ORACLE_PDB" "$PDB_ADMIN" 738 | printf "\nexport ORACLE_PDB=%s\n" "$ORACLE_PDB" >> "$HOME"/.bashrc 739 | else # Create additional PDB 740 | logger BAd "${FUNCNAME[0]}: Creating pluggable database $ORACLE_PDB" 741 | createDatabase NONE NONE TRUE 1 "$ORACLE_PDB" "$PDB_ADMIN" 742 | fi 743 | addTNSEntry "$ORACLE_PDB" 744 | PDB_NUM=$((PDB_NUM+1)) 745 | IFS=, 746 | done 747 | IFS=$OLDIFS 748 | alterPluggableDB 749 | elif [ "$__version" != "11" ] && [ "$__pdb_count" -gt 0 ] 750 | then # Not an 11g database; PDB_COUNT > 0: 751 | PDB_ADMIN=PDBADMIN 752 | ORACLE_PDB=${ORACLE_PDB:-ORCLPDB} 753 | logger BAd "${FUNCNAME[0]}: Creating container database $__db_msg and $__pdb_count pluggable database(s) with name $ORACLE_PDB" 754 | createDatabase "$__dbcaresponse" "$INIT_PARAMS" TRUE "$__pdb_count" "$ORACLE_PDB" "$PDB_ADMIN" 755 | if [ "$__pdb_count" -eq 1 ] 756 | then printf "\nexport ORACLE_PDB=%s\n" "$ORACLE_PDB" >> "$HOME"/.bashrc 757 | addTNSEntry "$ORACLE_PDB" 758 | else printf "\nexport ORACLE_PDB=%s\n" "${ORACLE_PDB}1" >> "$HOME"/.bashrc 759 | for ((PDB_NUM=1; PDB_NUM<=__pdb_count; PDB_NUM++)) 760 | do addTNSEntry "${ORACLE_PDB}""${PDB_NUM}" 761 | done 762 | fi 763 | alterPluggableDB 764 | else # 11g database OR PDB_COUNT is not set; create a non-container database: 765 | logger BAd "${FUNCNAME[0]}: Creating database $__db_msg" 766 | createDatabase "$__dbcaresponse" "$INIT_PARAMS" FALSE 767 | printf "\nunset ORACLE_PDB\n" >> "$HOME"/.bashrc 768 | fi 769 | 770 | # Insert a line in the oratab file if the database wasn't added. 771 | if [ "$(grep -c -e "^${ORACLE_SID}\b" /etc/oratab)" -eq 0 ] 772 | then echo "${ORACLE_SID}:${ORACLE_HOME}:N" >> /etc/oratab 773 | fi 774 | 775 | done 776 | IFS=$OLDIFS 777 | 778 | logger BAd "${FUNCNAME[0]}: DBCA complete" 779 | } 780 | 781 | createDatabase() { 782 | local RESPONSEFILE=$1 783 | local INIT_PARAMS=$2 784 | local CREATE_CONTAINER=${3:-TRUE} 785 | local PDBS=${4:-1} 786 | local PDB_NAME=${5:-ORCLPDB} 787 | local PDB_ADMIN=${6:-PDBADMIN} 788 | local dbcaLogDir=$ORACLE_BASE/cfgtoollogs/dbca 789 | 790 | if [ "$RESPONSEFILE" != "NONE" ] 791 | then 792 | for var in ORACLE_BASE \ 793 | ORACLE_SID \ 794 | ORACLE_PWD \ 795 | ORACLE_CHARACTERSET \ 796 | ORACLE_NLS_CHARACTERSET \ 797 | CREATE_CONTAINER \ 798 | DATA \ 799 | RECO \ 800 | PDBS \ 801 | PDB_NAME \ 802 | PDB_ADMIN \ 803 | INIT_PARAMS 804 | do REPIFS=$IFS 805 | IFS= 806 | replaceVars "$RESPONSEFILE" "$var" 807 | done 808 | IFS=$REPIFS 809 | 810 | # If there are more than 8 CPUs default back to dbca memory calculations to pick 40% 811 | # of available memory. The minimum of 2G is for small environments and guarantees 812 | # Oracle has enough memory. Larger environments should use the available memory. 813 | if [ "$(nproc)" -gt 8 ] 814 | then sed -i -e 's|TOTALMEMORY = "2048"||g' "$RESPONSEFILE" 815 | fi 816 | 817 | # Required to prevent ORA-200 during DBCA; the full path must exist: 818 | if [ ! -z "${RECO}" ] 819 | then mkdir -p "${RECO}/fast_recovery_area/${ORACLE_SID}" || error "Could not create the FRA directory for ${ORACLE_SID}" 820 | fi 821 | 822 | "$ORACLE_HOME"/bin/dbca -silent -createDatabase -responseFile "$RESPONSEFILE" || cat "$dbcaLogDir"/"$DB_UNQNAME"/"$DB_UNQNAME".log || cat "$dbcaLogDir"/"$DB_UNQNAME".log || cat "$dbcaLogDir"/"$DB_UNQNAME"/"$PDB_NAME"/"$DB_UNQNAME".log 823 | else "$ORACLE_HOME"/bin/dbca -silent -createPluggableDatabase -pdbName "$PDB_NAME" -sourceDB "$ORACLE_SID" -createAsClone true -createPDBFrom DEFAULT -pdbAdminUserName "$PDB_ADMIN" -pdbAdminPassword "$ORACLE_PWD" || cat "$dbcaLogDir"/"$DB_UNQNAME"/"$DB_UNQNAME".log || cat "$dbcaLogDir"/"$DB_UNQNAME".log || cat "$dbcaLogDir"/"$DB_UNQNAME"/"$PDB_NAME"/"$DB_UNQNAME".log 824 | fi 825 | } 826 | 827 | createAudit() { 828 | if [ ! -d "$ORACLE_BASE/admin/$1/adump" ] 829 | then mkdir -p "$ORACLE_BASE"/admin/"$1"/adump || error "Could not create the audit directory for $1" 830 | fi 831 | } 832 | 833 | moveFiles() { 834 | if [ ! -d "${DATA}/dbconfig/$ORACLE_SID" ] 835 | then mkdir -p "${DATA}"/dbconfig/"$ORACLE_SID" 836 | fi 837 | 838 | # Begin upgrade additions 839 | # The ORACLE_HOME in the configuration directory oratab is the source of truth 840 | # for existing databases, particularly after an upgrade. 841 | if [ -f "${DATA}/dbconfig/$ORACLE_SID/oratab" ] 842 | then ORACLE_HOME="$(egrep "^${ORACLE_SID}:" "${DATA}/dbconfig/$ORACLE_SID/oratab" | egrep -v "^$|^#" | cut -d: -f2 | head -1)"; export ORACLE_HOME 843 | fi 844 | 845 | if [ -f "${DATA}/dbconfig/$ORACLE_SID/spfile${ORACLE_SID}.ora" ] 846 | then __version="$(strings "${DATA}/dbconfig/$ORACLE_SID/spfile${ORACLE_SID}.ora" | grep -e "[*.c|c]ompatible" | grep -v "#" | sed -e "s/[A-Za-z '=.*]//g" | head -c 2)" 847 | elif [ -f "${DATA}/dbconfig/$ORACLE_SID/init${ORACLE_SID}.ora" ] 848 | then __version="$(grep -e "[*.c|c]ompatible" "${DATA}/dbconfig/$ORACLE_SID/init${ORACLE_SID}.ora" | grep -v "#" | sed -e "s/[A-Za-z '=.*]//g" | head -c 2)" 849 | fi 850 | # End upgrade additions 851 | 852 | setBase 853 | 854 | local __dbconfig="${DATA}"/dbconfig/"$ORACLE_SID" 855 | 856 | for filename in "$ORACLE_BASE_CONFIG"/init"$ORACLE_SID".ora \ 857 | "$ORACLE_BASE_CONFIG"/spfile"$ORACLE_SID".ora \ 858 | "$ORACLE_BASE_CONFIG"/orapw"$ORACLE_SID" \ 859 | "$ORACLE_BASE_HOME"/network/admin/listener.ora \ 860 | "$ORACLE_BASE_HOME"/network/admin/tnsnames.ora \ 861 | "$ORACLE_BASE_HOME"/network/admin/sqlnet.ora 862 | do 863 | file=$(basename "$filename") 864 | if [ -f "$filename" ] && [ ! -f "$__dbconfig/$file" ] 865 | then mv "$filename" "$__dbconfig"/ 2>/dev/null 866 | fi 867 | if [ -f "$__dbconfig/$file" ] && [ ! -L "$filename" ] 868 | then ln -sf "$__dbconfig"/"$file" "$filename" 2>/dev/null 869 | fi 870 | done 871 | 872 | if [ -f /etc/oratab ] && [ ! -f "$__dbconfig/oratab" ] 873 | then cp /etc/oratab "$__dbconfig"/ 2>/dev/null 874 | fi 875 | cp "$__dbconfig"/oratab /etc/oratab 2>/dev/null 876 | 877 | # Find wallet subdirectories in dbconfig and relink them: 878 | if [ -f "$__dbconfig/sqlnet.ora" ] 879 | then 880 | for dirname in $(find "$__dbconfig" -mindepth 1 -type d) 881 | do dir=$(basename "$dirname") 882 | # Search the sqlnet.ora for an exactly matching subdirectory 883 | location=$(grep -e "^[^#].*\/$dir\/" "$__dbconfig"/sqlnet.ora | sed -e "s|^[^/]*/|/|g" -e "s|[^/]*$||") 884 | if [ -n "$location" ] && [ ! -d "$location" ] 885 | then # Create the location if it doesn't exist 886 | mkdir -p "$location" 887 | fi 888 | if [ -d "$location" ] && [ -f "$dirname/*" ] 889 | then # Move files from the location into the dbconfig directory 890 | mv "$location"/* "$dirname"/ 2>/dev/null 891 | fi 892 | if [ ! -L "$location" ] 893 | then # Link files from the dbconfig directory to the location 894 | ln -sf "$dirname" "$location" 2>/dev/null 895 | fi 896 | done 897 | fi 898 | } 899 | 900 | addTNSEntry() { 901 | export ALIAS=$1 902 | setBase 903 | copyTemplate "$INSTALL_DIR"/tnsnames.ora.tmpl "$ORACLE_BASE_HOME"/network/admin/tnsnames.ora append 904 | } 905 | 906 | alterPluggableDB() { 907 | "$ORACLE_HOME"/bin/sqlplus -S / as sysdba << EOF 908 | alter pluggable database all open; 909 | alter pluggable database all save state; 910 | EOF 911 | } 912 | 913 | HealthCheck() { 914 | local __open_mode="'READ WRITE'" 915 | local __tabname="v\$database" 916 | local __pdb_count=${PDB_COUNT:-0} 917 | 918 | source oraenv <<< "$(grep -E "^${ORACLE_SID}\:" /etc/oratab | cut -d: -f1 | head -1)" 1>/dev/null 919 | rc="$?" 920 | 921 | if [ "$rc" -ne 0 ] 922 | then error "Failed to get the Oracle environment from oraenv" 923 | elif [ -z "$ORACLE_SID" ] 924 | then error "ORACLE_SID is not set" 925 | elif [ -z "$ORACLE_HOME" ] 926 | then error "ORACLE_HOME is not set" 927 | elif [ ! -f "$ORACLE_HOME/bin/sqlplus" ] 928 | then error "Cannot locate $ORACLE_HOME/bin/sqlplus" 929 | elif [ "$__pdb_count" -gt 0 ] || [ -n "$PDB_LIST" ] 930 | then __tabname="v\$pdbs" 931 | fi 932 | 933 | health=$(($(unset ORACLE_PATH; unset SQLPATH; "$ORACLE_HOME"/bin/sqlplus -S / as sysdba << EOF 934 | set head off pages 0 trimspool on feed off serverout on 935 | whenever sqlerror exit warning 936 | --select count(*) from $__tabname where open_mode=$__open_mode; 937 | select case 938 | when database_role = 'PRIMARY' 939 | and open_mode = 'READ WRITE' 940 | then 1 941 | when database_role like '%STANDBY' 942 | and (open_mode like 'READ ONLY%' 943 | or open_mode = 'MOUNTED') 944 | then 1 945 | when database_role = 'FAR SYNC' 946 | and open_mode = 'MOUNTED' 947 | then 1 948 | else 0 949 | end 950 | from v\$database; 951 | -- from $__tabname; 952 | EOF 953 | )+0)) 954 | 955 | if [ "$?" -ne 0 ] 956 | then return 2 957 | elif [ "$health" -gt 0 ] 958 | then return 0 959 | else return 1 960 | fi 961 | } 962 | 963 | postInstallRoot() { 964 | # Run root scripts in final build stage 965 | logger BA "Running root scripts" 966 | if [ -n "$ORACLE_INV" ] && [ -d "$ORACLE_INV" ] && [ -f "$ORACLE_INV/orainstRoot.sh" ] 967 | then logger b "Running orainstRoot.sh script in $ORACLE_INV" 968 | "$ORACLE_INV"/orainstRoot.sh || error "There was a problem running $ORACLE_INV/orainstRoot.sh" 969 | fi 970 | if [ -n "$ORACLE_HOME" ] && [ -d "$ORACLE_HOME" ] && [ -f "$ORACLE_HOME/root.sh" ] 971 | then logger b "Running root.sh script in $ORACLE_HOME" 972 | "$ORACLE_HOME"/root.sh || error "There was a problem running $ORACLE_HOME/root.sh" 973 | fi 974 | 975 | # If this is an upgrade image, run the target root script and attach the new home. 976 | if [ -n "$TARGET_HOME" ] && [ -d "$TARGET_HOME" ] && [ -f "$TARGET_HOME/root.sh" ] 977 | then 978 | logger BA "Running root script in $TARGET_HOME" 979 | "$TARGET_HOME"/root.sh 980 | logger BA "Attaching home for upgrade" 981 | setSudo allow 982 | sudo su - oracle -c "$TARGET_HOME/oui/bin/attachHome.sh" 983 | setSudo revert 984 | fi 985 | # Additional steps to be performed as root 986 | 987 | # VOLUME_GROUP permits non-oracle/oinstall ownership of bind-mounted volumes. VOLUME_GROUP is passed as GID:GROUP_NAME 988 | if [ -n "$VOLUME_GROUP" ] 989 | then local __gid=$(echo "$VOLUME_GROUP" | cut -d: -f1) 990 | local __grp=$(echo "$VOLUME_GROUP" | cut -d: -f2) 991 | groupadd -g "$__gid" "$__grp" 992 | usermod oracle -aG "$__grp" 993 | chown -R :"$__grp" "${DATA}" 994 | chown -R :"$__grp" "${RECO}" 995 | chmod -R 775 "${DATA}" 996 | chmod -R 775 "${RECO}" 997 | chmod -R g+s "${DATA}" 998 | chmod -R g+s "${RECO}" 999 | fi 1000 | } 1001 | 1002 | runUserScripts() { 1003 | local SCRIPTS_ROOT="$1"; 1004 | 1005 | if [ -z "$SCRIPTS_ROOT" ] 1006 | then warn "No script path provided" 1007 | exit 1 1008 | elif [ -d "$SCRIPTS_ROOT" ] && [ -n "$(ls -A "$SCRIPTS_ROOT")" ] 1009 | then # Check that directory exists and it contains files 1010 | logger B "${FUNCNAME[0]}: Running user scripts" 1011 | while IFS= read -r f 1012 | do 1013 | case "$f" in 1014 | *.sh) logger ba "${FUNCNAME[0]}: Script: $f"; . "$f" ;; 1015 | *.sql) logger ba "${FUNCNAME[0]}: Script: $f"; echo "exit" | "$ORACLE_HOME"/bin/sqlplus -s "/ as sysdba" @"$f" ;; 1016 | *) logger ba "${FUNCNAME[0]}: Ignored file $f" ;; 1017 | esac 1018 | done < <(find "$SCRIPTS_ROOT"/*.{sql,sh} 2>/dev/null | sort) 1019 | 1020 | logger A "${FUNCNAME[0]}: User scripts complete" 1021 | fi 1022 | } 1023 | 1024 | changePassword() { 1025 | runsql "alter user sys identified by \"$1\"; 1026 | alter user system identified by \"$1\";" 1027 | # TODO: Loop through PDB 1028 | # runsql "alter user pdbadmin identified by \"$1\";" 1029 | } 1030 | 1031 | #----------------------------------------------------------# 1032 | # MAIN # 1033 | #----------------------------------------------------------# 1034 | ORACLE_CHARACTERSET=${ORACLE_CHARACTERSET:-AL32UTF8} 1035 | ORACLE_NLS_CHARACTERSET=${ORACLE_NLS_CHARACTERSET:-AL16UTF16} 1036 | DATA="${DATA:-$ORADATA}" 1037 | RECO="${RECO:-$ORADATA}" 1038 | 1039 | # If a parameter is passed to the script, run the associated action. 1040 | while getopts ":ehOpPRU" opt; do 1041 | case ${opt} in 1042 | h) # Check health of the database 1043 | HealthCheck || exit 1 1044 | exit 0 ;; 1045 | e) # Configure environment 1046 | configENV 1047 | exit 0 ;; 1048 | O) # Install Oracle 1049 | installOracle "$ORACLE_VERSION" "$ORACLE_HOME" 1050 | exit 0 ;; 1051 | p) # List installed patches 1052 | getPatches 1053 | exit 0 ;; 1054 | P) # Change passwords 1055 | # TODO: Get the password from the CLI 1056 | changePassword 1057 | exit 0 ;; 1058 | R) # Post install root scripts 1059 | postInstallRoot 1060 | exit 0 ;; 1061 | U) # Install Oracle upgrade home 1062 | installOracle "$TARGET_VERSION" "$TARGET_HOME" 1063 | exit 0 ;; 1064 | esac 1065 | done 1066 | 1067 | # Start the database if no option is provided 1068 | trap _sigint SIGINT 1069 | trap _sigterm SIGTERM 1070 | trap _sigkill SIGKILL 1071 | 1072 | if [ -n "$SYSTEMD" ] 1073 | then echo "Init:" 1074 | /usr/bin/init 1075 | fi 1076 | 1077 | # Check whether container has enough memory 1078 | if [ -f /sys/fs/cgroup/cgroup.controllers ] 1079 | then __mem=$(cat /sys/fs/cgroup/memory.max) 1080 | else __mem=$(cat /sys/fs/cgroup/memory/memory.limit_in_bytes) 1081 | fi 1082 | 1083 | if [ -z "$__mem" ] 1084 | then error "There was a problem getting the cgroups memory limit on the system" 1085 | elif [ "${__mem}" != "max" ] && [ "${#__mem}" -lt 11 ] && [ "$__mem" -lt 2147483648 ] 1086 | then error "The database container requires at least 2GB of memory; only $__mem is available" 1087 | fi 1088 | 1089 | if [ "$(hostname | grep -Ec "_")" -gt 0 ] 1090 | then error "The host name may not contain any '_'" 1091 | fi 1092 | 1093 | # Validate SID, PDB names 1094 | __oracle_sid=${ORACLE_SID:-ORCLCDB} 1095 | __pdb_count=${PDB_COUNT:-0} 1096 | 1097 | # Validate the SID: 1098 | if [ "${#__oracle_sid}" -gt 12 ] 1099 | then error "The SID may not be longer than 12 characters" 1100 | elif [[ "$__oracle_sid" =~ [^a-zA-Z0-9] ]] 1101 | then error "The SID must be alphanumeric" 1102 | # Check PDB settings. 1103 | elif [ -z "$ORACLE_PDB" ] && [ "$__pdb_count" -eq 0 ] && [ -z "$PDB_LIST" ] 1104 | then # No PDB name + no PDB count + no PDB list = Not a container DB 1105 | export ORACLE_SID=${__oracle_sid:-ORCL} 1106 | unset PDB_COUNT 1107 | unset PDB_LIST 1108 | elif [ -n "$PDB_LIST" ] 1109 | then # PDB list is defined; create the first PDB as the fist PDB in the list. 1110 | export ORACLE_PDB=$(echo "$PDB_LIST" | cut -d, -f1) 1111 | elif [ -n "$ORACLE_PDB" ] && [ -z "$PDB_COUNT" ] 1112 | then # No PDB count but PDB name; create a single PDB with the given name. 1113 | export ORACLE_PDB=$ORACLE_PDB 1114 | elif [ -z "$ORACLE_PDB" ] && [ "$PDB_COUNT" -gt 1 ] 1115 | then # No PDB name but PDB count > 1; default the first PDB. 1116 | export ORACLE_PDB=ORCLPDB1 1117 | else export ORACLE_PDB=$ORACLE_PDB 1118 | fi 1119 | 1120 | # Check the audit path 1121 | createAudit "$ORACLE_SID" 1122 | # Configure the user environment: 1123 | configUserENV 1124 | 1125 | # Check whether database already exists 1126 | # There's an oratab and The ORACLE_SID is in the oratab and There's an DATA for the SID OR There's an DATA for the SID 1127 | if [ -f "/etc/oratab" ] && [ "$(grep -Ec "^$ORACLE_SID\:" /etc/oratab)" -eq 1 ] && [ -d "${DATA}"/"${ORACLE_SID^^}" ] || [ -d "${DATA}"/"${ORACLE_SID}" ] 1128 | then # Before all else, move files. This puts the oratab from config into the expected location: 1129 | moveFiles 1130 | # Begin upgrade additions 1131 | # Set the environment 1132 | if [ -f "/usr/local/bin/oraenv" ] 1133 | then __oraenv=/usr/local/bin/oraenv 1134 | else __oraenv=$ORACLE_HOME/bin/oraenv 1135 | fi 1136 | 1137 | # Start the "default" database defined by ORACLE_SID: 1138 | . "$__oraenv" <<< "$ORACLE_SID" 1139 | createAudit "$ORACLE_SID" 1140 | startDB 1141 | 1142 | # Preserve the default ORACLE_SID used to call the container: 1143 | DEFAULT_SID=$ORACLE_SID 1144 | # Find other SID: 1145 | for __sid in "$(grep "$__oracle_home" /etc/oratab | grep -Ev "^#|^$" | grep -Ev "^$DEFAULT_SID\:" | cut -d: -f1)" 1146 | do 1147 | if [ -n "$__sid" ] 1148 | then . "$__oraenv" <<< "$__sid" 1149 | createAudit "$__sid" 1150 | moveFiles 1151 | startDB 1152 | fi 1153 | done 1154 | 1155 | # Restore the default ORACLE_SID environment 1156 | . "$__oraenv" <<< "$DEFAULT_SID" 1157 | # End upgrade additions 1158 | else # Create the TNS configuration 1159 | setBase 1160 | mkdir -p "$ORACLE_BASE_HOME"/network/admin 2>/dev/null 1161 | copyTemplate "$INSTALL_DIR"/sqlnet.ora.tmpl "$ORACLE_BASE_HOME"/network/admin/sqlnet.ora replace 1162 | copyTemplate "$INSTALL_DIR"/listener.ora.tmpl "$ORACLE_BASE_HOME"/network/admin/listener.ora replace 1163 | 1164 | if [ -f "$INSTALL_DIR"/tnsnames.ora ] 1165 | then cp "$INSTALL_DIR"/tnsnames.ora "$ORACLE_BASE_HOME"/network/admin/tnsnames.ora 1166 | else echo "$ORACLE_SID=localhost:1521/$ORACLE_SID" > "$ORACLE_BASE_HOME"/network/admin/tnsnames.ora 1167 | fi 1168 | 1169 | # Create a database password if none exists 1170 | if [ -z "$ORACLE_PWD" ] 1171 | then ORACLE_PWD="$(mkPass)"; export ORACLE_PWD 1172 | logger BA "Oracle password for SYS, SYSTEM and PDBADMIN: $ORACLE_PWD" 1173 | fi 1174 | 1175 | # Run DBCA 1176 | runDBCA 1177 | moveFiles 1178 | runUserScripts "$ORACLE_BASE"/scripts/setup 1179 | fi 1180 | 1181 | # Check database status 1182 | if HealthCheck 1183 | # if [ "$?" -eq 0 ] 1184 | then runUserScripts "$ORACLE_BASE"/scripts/startup 1185 | if [ -n "$DB_UNQNAME" ] 1186 | then msg="$ORACLE_SID with unique name $DB_UNQNAME" 1187 | else msg="$ORACLE_SID" 1188 | fi 1189 | # TODO: Report the correct open mode 1190 | logger BA "Database $msg is open and available." 1191 | else warn "Database setup for $ORACLE_SID was unsuccessful." 1192 | warn "Check log output for additional information." 1193 | fi 1194 | 1195 | # Tail on alert log and wait (otherwise container will exit) 1196 | logger B "Tailing alert_${ORACLE_SID}.log:" 1197 | tail -f "$ORACLE_BASE"/diag/rdbms/*/*/trace/alert*.log & 1198 | childPID=$! 1199 | wait $childPID 1200 | -------------------------------------------------------------------------------- /templates/db.dockerfile: -------------------------------------------------------------------------------- 1 | # syntax=docker/dockerfile:1.4 2 | FROM ###FROM_OEL_BASE### as db 3 | 4 | # Database defaults 5 | ARG ORACLE_VERSION=###ORACLE_VERSION### 6 | ARG ORACLE_INV=/u01/app/oraInventory 7 | ARG ORACLE_BASE=/u01/app/oracle 8 | ARG ORACLE_HOME=$ORACLE_BASE/product/###ORACLE_HOME_ARG### 9 | ###ORACLE_BASE_HOME_ARG### 10 | ###ORACLE_BASE_CONFIG_ARG### 11 | #ARG ORADATA=/u01/app/oracle/oradata 12 | ARG DATA=/u02/app/oracle/oradata 13 | ARG RECO=/u03/app/oracle 14 | ARG ORACLE_EDITION=###ORACLE_EDITION_ARG### 15 | ARG ORACLE_SID=###ORACLE_SID_ARG### 16 | ###ORACLE_PDB_ARG### 17 | ###PDB_COUNT_ARG### 18 | ###ORACLE_ROH_ARG### 19 | ###DISTRO_ARG### 20 | 21 | # Pass --build-arg DEBUG="bash -x" to run scripts in debug mode. 22 | ARG DEBUG= 23 | 24 | # DB installation defaults 25 | ARG INSTALL_RESPONSE=inst.###INSTALL_RESPONSE_ARG###.rsp 26 | ARG REMOVE_COMPONENTS="DBMA,HELP,ORDS,OUI,PATCH,PILOT,SQLD,SUP,UCP,TCP,ZIP,INV,DBCA,ADMIN,ROH" 27 | ARG FORCE_PATCH= 28 | ARG FILE_MD5SUM= 29 | 30 | # Environment settings 31 | ENV ORACLE_BASE=$ORACLE_BASE \ 32 | ORACLE_HOME=$ORACLE_HOME \ 33 | ORACLE_INV=$ORACLE_INV \ 34 | ###ORACLE_BASE_HOME_ENV### 35 | ###ORACLE_BASE_CONFIG_ENV### 36 | DATA=$DATA \ 37 | RECO=$RECO \ 38 | ORACLE_VERSION=$ORACLE_VERSION \ 39 | ORACLE_EDITION=$ORACLE_EDITION \ 40 | ORACLE_SID=$ORACLE_SID \ 41 | ###ORACLE_PDB_ENV### 42 | ###PDB_COUNT_ENV### 43 | ###ORACLE_ROH_ENV### 44 | ###DISTRO_ENV### 45 | ATTACH_HOME=$ATTACH_HOME \ 46 | DEBUG=$DEBUG \ 47 | PATH=$ORACLE_HOME/bin:$ORACLE_HOME/OPatch/:/usr/sbin:$PATH \ 48 | CLASSPATH=$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib \ 49 | LD_LIBRARY_PATH=$ORACLE_HOME/lib:/usr/lib \ 50 | TNS_ADMIN=$ORACLE_HOME/network/admin 51 | 52 | # Copy DB install files 53 | COPY --chown=oracle:oinstall $MANAGE_ORACLE $SCRIPTS_DIR/ 54 | COPY --chown=oracle:oinstall ./config/inst.* $INSTALL_DIR/ 55 | COPY --chown=oracle:oinstall ./config/manifest $INSTALL_DIR/ 56 | COPY --chown=oracle:oinstall ./database/ $INSTALL_DIR/ 57 | 58 | # Install DB software binaries 59 | RUN ###MOS_SECRET### chmod ug+x $SCRIPTS_DIR/$MANAGE_ORACLE && \ 60 | $DEBUG $SCRIPTS_DIR/$MANAGE_ORACLE -O 61 | 62 | FROM ###FROM_OEL_BASE### 63 | 64 | # Build defaults 65 | ARG BUILD_DATE= 66 | ARG BUILD_VERSION=1.0 67 | 68 | # Database defaults 69 | ARG ORACLE_VERSION=###ORACLE_VERSION### 70 | ARG ORACLE_INV=/u01/app/oraInventory 71 | ARG ORACLE_BASE=/u01/app/oracle 72 | ARG ORACLE_HOME=$ORACLE_BASE/product/###ORACLE_HOME_ARG### 73 | ###ORACLE_BASE_HOME_ARG### 74 | ###ORACLE_BASE_CONFIG_ARG### 75 | ARG DATA=/u02/app/oracle/oradata 76 | ARG RECO=/u03/app/oracle 77 | ARG ORACLE_EDITION=###ORACLE_EDITION_ARG### 78 | ARG ORACLE_SID=###ORACLE_SID_ARG### 79 | ###ORACLE_PDB_ARG### 80 | ###PDB_COUNT_ARG### 81 | ###ORACLE_ROH_ARG### 82 | ###DISTRO_ARG### 83 | 84 | # Pass --build-arg DEBUG="bash -x" to run scripts in debug mode. 85 | ARG DEBUG= 86 | 87 | # Label the image: 88 | LABEL org.label-schema.schema-version="1.0" 89 | LABEL org.label-schema.url="http://oraclesean.com" 90 | LABEL org.label-schema.version="$BUILD_VERSION" 91 | LABEL org.label-schema.build-date="$BUILD_DATE" 92 | LABEL org.label-schema.vcs-url="https://github.com/oraclesean" 93 | LABEL org.label-schema.name="###DB_REPO###-${ORACLE_VERSION}-${ORACLE_EDITION}" 94 | LABEL org.label-schema.description="Extensible Oracle $ORACLE_VERSION database" 95 | LABEL org.label-schema.docker.cmd="docker run -d --name -e ORACLE_SID= ###DOCKER_RUN_LABEL### ###DB_REPO###-${ORACLE_VERSION}-${ORACLE_EDITION}" 96 | LABEL maintainer="Sean Scott " 97 | LABEL database.version="$ORACLE_VERSION" 98 | LABEL database.edition="$ORACLE_EDITION" 99 | ###SOFTWARE_LABEL### 100 | LABEL volume.data="$DATA" 101 | LABEL volume.reco="$RECO" 102 | LABEL volume.diagnostic_dest="$ORACLE_BASE/diag" 103 | LABEL port.listener.listener1="1521" 104 | LABEL port.oemexpress="5500" 105 | LABEL port.http="8080" 106 | 107 | # Environment settings 108 | ENV ORACLE_BASE=$ORACLE_BASE \ 109 | ORACLE_HOME=$ORACLE_HOME \ 110 | ###ORACLE_BASE_HOME_ENV### 111 | ###ORACLE_BASE_CONFIG_ENV### 112 | DATA=$DATA \ 113 | RECO=$RECO \ 114 | ORACLE_VERSION=$ORACLE_VERSION \ 115 | ORACLE_EDITION=$ORACLE_EDITION \ 116 | ORACLE_SID=$ORACLE_SID \ 117 | ###ORACLE_PDB_ENV### 118 | ###PDB_COUNT_ENV### 119 | ###ORACLE_ROH_ENV### 120 | ###DISTRO_ENV### 121 | ATTACH_HOME=$ATTACH_HOME \ 122 | DEBUG=$DEBUG \ 123 | PATH=$ORACLE_HOME/bin:$ORACLE_HOME/OPatch/:/usr/sbin:$PATH \ 124 | CLASSPATH=$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib \ 125 | LD_LIBRARY_PATH=$ORACLE_HOME/lib:/usr/lib \ 126 | TNS_ADMIN=$ORACLE_HOME/network/admin 127 | 128 | USER oracle 129 | COPY --chown=oracle:oinstall ./config/dbca.* $INSTALL_DIR/ 130 | COPY --chown=oracle:oinstall ./config/*.tmpl $INSTALL_DIR/ 131 | COPY --chown=oracle:oinstall $MANAGE_ORACLE $SCRIPTS_DIR/ 132 | COPY --chown=oracle:oinstall --from=db $ORACLE_INV $ORACLE_INV 133 | COPY --chown=oracle:oinstall --from=db $ORACLE_BASE $ORACLE_BASE 134 | 135 | USER root 136 | RUN $DEBUG $SCRIPTS_DIR/$MANAGE_ORACLE -R 137 | 138 | USER oracle 139 | WORKDIR /home/oracle 140 | 141 | VOLUME ["$DATA"] 142 | VOLUME ["$RECO"] 143 | VOLUME [ "$ORACLE_BASE/diag" ] 144 | ###SYSTEMD_VOLUME### 145 | EXPOSE 1521 5500 8080 146 | HEALTHCHECK --interval=1m --start-period=5m CMD $SCRIPTS_DIR/$MANAGE_ORACLE -h >/dev/null || exit 1 147 | CMD exec $DEBUG $SCRIPTS_DIR/$MANAGE_ORACLE 148 | -------------------------------------------------------------------------------- /templates/db.dockerignore: -------------------------------------------------------------------------------- 1 | # Ignore files 2 | Dockerfile* 3 | .docker* 4 | .git* 5 | README.md 6 | # Ignore all directories 7 | ** 8 | # Include management file 9 | !manageOracle.sh 10 | # Include template files 11 | !/config/*.tmpl 12 | !/config/manifest 13 | # Include software installation and patch files 14 | -------------------------------------------------------------------------------- /templates/oraclelinux.dockerfile: -------------------------------------------------------------------------------- 1 | ###FROM_BASE### 2 | 3 | # Directory defaults 4 | ARG SCRIPTS_DIR=/opt/scripts 5 | ARG INSTALL_DIR=/opt/install 6 | ARG ORACLE_PATH=/home/oracle 7 | 8 | # Database defaults 9 | ARG ORACLE_VERSION=###ORACLE_BASE_VERSION### 10 | 11 | # Build defaults 12 | ARG RPM_LIST="git less strace sudo tree vi which bash-completion" 13 | ARG RPM_SUPPLEMENT="rlwrap" 14 | ARG MIN_SPACE_GB=###MIN_SPACE_GB_ARG### 15 | ARG BUILD_DATE= 16 | ARG BUILD_VERSION=1.0 17 | ARG MANAGE_ORACLE=manageOracle.sh 18 | # Pass --build-arg DEBUG="bash -x" to run scripts in debug mode. 19 | ARG DEBUG= 20 | 21 | # Labels 22 | LABEL org.label-schema.schema-version="1.0" 23 | LABEL org.label-schema.url="http://oraclesean.com" 24 | LABEL org.label-schema.version="$BUILD_VERSION" 25 | LABEL org.label-schema.build-date="$BUILD_DATE" 26 | LABEL org.label-schema.vcs-url="https://github.com/oraclesean" 27 | LABEL org.label-schema.name="###LINUX_IMAGE###" 28 | LABEL org.label-schema.description="oraclelinux with Oracle Database ###PREINSTALL_TAG### prerequisites" 29 | LABEL maintainer="Sean Scott " 30 | 31 | ENV ORACLE_PATH=$ORACLE_PATH \ 32 | INSTALL_DIR=$INSTALL_DIR \ 33 | SCRIPTS_DIR=$SCRIPTS_DIR \ 34 | MANAGE_ORACLE=$MANAGE_ORACLE \ 35 | DEBUG=$DEBUG 36 | 37 | COPY $MANAGE_ORACLE $SCRIPTS_DIR/ 38 | 39 | # Build base image: 40 | RUN chmod ug+x $SCRIPTS_DIR/$MANAGE_ORACLE && \ 41 | $DEBUG $SCRIPTS_DIR/$MANAGE_ORACLE -e && \ 42 | rm -fr /tmp/* /var/cache/yum 43 | -------------------------------------------------------------------------------- /templates/oraclelinux.dockerignore: -------------------------------------------------------------------------------- 1 | # Ignore files 2 | Dockerfile* 3 | .docker* 4 | .git* 5 | README.md 6 | # Ignore all directories 7 | ** 8 | # Include management file 9 | !manageOracle.sh 10 | --------------------------------------------------------------------------------