Quantcast
Channel: DevOps tips & tricks
Viewing all articles
Browse latest Browse all 181

Install free Docker Oracle database

$
0
0
HOWTO
Login to Oracle Docker Registry (OCR)  web and create auth token 


Login to  OCR 
Use auth token created on OCR web 
$ docker login container-registry.oracle.com

Download Oracle free db image
$ docker pull container-registry.oracle.com/database/free:latest
latest: Pulling from database/free
089fdfcd47b7: Pull complete 
43c899d88edc: Pull complete 
47aa6f1886a1: Pull complete 
f8d07bb55995: Pull complete 
c31c8c658c1e: Pull complete 
b7d28faa08b4: Pull complete 
1d0d5c628f6f: Pull complete 
db82a695dad3: Pull complete 
25a185515793: Pull complete 
Digest: sha256:5ac0efa9896962f6e0e91c54e23c03ae8f140cf6ed43ca09ef4354268a942882
Status: Downloaded newer image for container-registry.oracle.com/database/free:latest
container-registry.oracle.com/database/free:latest

Start container
$ docker run -it  -d --name oracle  -e ORACLE_PWD=weblogic123 -p1521:1521 container-registry.oracle.com/database/free
6855a46bc9dab584a190950695866692a1d0b911876924b8f98ad48664de3845


$ docker ps
CONTAINER ID   IMAGE                                         COMMAND                  CREATED          STATUS                             PORTS                                       NAMES
93b8809b1204   container-registry.oracle.com/database/free   "/bin/bash -c $ORACL…"   41 seconds ago   Up 38 seconds (health: starting)   0.0.0.0:1521->1521/tcp, :::1521->1521/tcp   oracle




How to Use Custom Configuration Parameters for the Database on Docker

The Oracle Database Docker image enables you to customize the configuration of your database, and to provide initialization parameters for when the database starts.

Oracle Database server container also provides configuration parameters that can be used when starting the container. The following example provides the syntax for a detailed docker run command supporting all custom configurations, with variable values in Italics font, which you can replace with values for your deployment:

docker run -d --name container_name \ -p host_port:1521 -p host_port:5500 \ -e ORACLE_SID=cdb-system-identifer \ -e ORACLE_PDB=pdb-name \ -e ORACLE_PWD=oracle-user-password \ -e INIT_SGA_SIZE=cdb-database-sga-memory-in-mb \ -e INIT_PGA_SIZE=cdb-database-pga-memory-in-mb \ -e ORACLE_EDITION=ee-or-se-database-edition \ -e ORACLE_CHARACTERSET=character-set \ -e ENABLE_ARCHIVELOG=[true|false] -v [host-mount-point:]/opt/oracle/oradata \ container-registry.oracle.com/database/enterprise:21.3.0 Parameters: --name: The name of the container. (Default: auto-generated -p: The port mapping of the host port to the container port. Two ports are exposed: 1521 (Oracle Listener), 5500 (OEM Express) -e ORACLE_SID: The Oracle Database SID that should be used.(Default:ORCLCDB) -e ORACLE_PDB: The Oracle Database PDB name that should be used. (Default: ORCLPDB1) -e ORACLE_PWD: The Oracle Database SYS, SYSTEM and PDBADMIN password. (Default: auto-generated) -e INIT_SGA_SIZE: The total memory in MB that should be used for all SGA components (Optional) -e INIT_PGA_SIZE: The target aggregate PGA memory in MB that should be used for all server processes attached to the instance (Optional) -e ORACLE_EDITION: The Oracle Database Edition [enterprise|standard]. (Default: enterprise) -e ORACLE_CHARACTERSET: The character set that you want used when creating the database. (Default: AL32UTF8) -e ENABLE_ARCHIVELOG The ARCHIVELOG mode. By default, set to false. If set to true, then ARCHIVLOG mode is enabled in the database (for fresh database creation only) -v /opt/oracle/oradata The data volume that you want used for the database. Must be writable by the oracle user (uid: 54321) inside the container If omitted, then the database will not be persisted over container recreation. -v /opt/oracle/scripts/startup | /docker-entrypoint-initdb.d/startup Optional: A volume with custom scripts to be run after database startup. For further details see the section "Running scripts after setup and on startup" section below. -v /opt/oracle/scripts/setup | /docker-entrypoint-initdb.d/setup Optional: A volume with custom scripts that you want run after database setup. For further details see the "Running scripts after setup and on startup" section below.

Install Oracle sqplus client
$ sudo dnf install oracle-instantclient-basic-21.13.0.0.0-1.el8.x86_64.rpm
  $ sudo dnf install oracle-instantclient-sqlplus-21.13.0.0.0-1.el8.x86_64.rpm 


Connect to Oracle Docker db
$ docker exec -it oracle sqlplus / as sysdba

SQL*Plus: Release 23.0.0.0.0 - Production on Wed Apr 3 10:28:37 2024
Version 23.3.0.23.09

Copyright (c) 1982, 2023, Oracle.  All rights reserved.


Connected to:
Oracle Database 23c Free Release 23.0.0.0.0 - Develop, Learn, and Run for Free
Version 23.3.0.23.09

SQL> 

Create Oracle db user
SQL> alter session set "_ORACLE_SCRIPT"=true;

Session altered.

SQL> CREATE USER dave IDENTIFIED BY weblogic123;

User created.

SQL> GRANT CONNECT, RESOURCE, DBA TO dave;

Grant succeeded.


Viewing all articles
Browse latest Browse all 181

Trending Articles