Wednesday, April 3, 2024

Install free Docker Oracle database

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:

For further details see the "Running scripts after setup and on startup" section belotall Oracle sqplus clienInI$ 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 - connect to Docker container as sysdba
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.

Connect via sqlplus
sqlplus dave@localhost:1521/FREE

SQL*Plus: Release 21.0.0.0.0 - Production on Wed Apr 3 19:47:37 2024
Version 21.13.0.0.0

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

Enter password: 

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> 

sqlplus dave@localhost:1521/FREE

SQL*Plus: Release 21.0.0.0.0 - Production on Wed Apr 3 19:47:37 2024
Version 21.13.0.0.0

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

Enter password: 

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> 


No comments:

Post a Comment