Oracle, podman - stanislawbartkowski/wikis GitHub Wiki

Introduction

Several simple steps to start Oracle on podman/docker

Oracle account

https://profile.oracle.com/myprofile/account/create-account.jspx

Download Oracle image

podman login container-registry.oracle.com

podman pull container-registry.oracle.com/database/enterprise:latest

podman images

REPOSITORY                                         TAG         IMAGE ID      CREATED       SIZE
container-registry.oracle.com/database/enterprise  latest      7ac2cb474399  2 months ago  8.19 GB

External volume

mkdir /var/oracle

chmod 777 /var/oracle

Firewall

Open a port if necessary

firewall-cmd --permanent --add-port 1521/tcp

systemctl reload firewalld

Create a container

podman run --name oracle -p 1521:1521 -d -e ORACLE_PWD=secret -v /var/oracle:/opt/oracle/oradata:Z container-registry.oracle.com/database/enterprise:latest

It takes up to 10 minutes to create a container and database.

Follow the progress:

podman logs oracle

..............
IMITED  EXTENT MANAGEMENT LOCAL  SEGMENT SPACE MANAGEMENT  AUTO
ORCLPDB1(3):ALTER DATABASE DEFAULT TABLESPACE "USERS"
ORCLPDB1(3):Completed: ALTER DATABASE DEFAULT TABLESPACE "USERS"
2021-12-21T17:21:01.316802+00:00
ALTER SYSTEM SET control_files='/opt/oracle/oradata/ORCLCDB/control01.ctl' SCOPE=SPFILE;
2021-12-21T17:21:01.339266+00:00
ALTER SYSTEM SET local_listener='' SCOPE=BOTH;
ALTER PLUGGABLE DATABASE ORCLPDB1 SAVE STATE
Completed: ALTER PLUGGABLE DATABASE ORCLPDB1 SAVE STATE

Check

podman exec -it oracle bash

sqlplus / as sysdba

SQL> show user
USER is "SYS"
SQL> 

Test external access

Oracle hostname thinkde, password secret.

sqlplus system@//thinkde:1521/ORCLPDB1

SQL*Plus: Release 19.0.0.0.0 - Production on Tue Dec 21 18:23:58 2021
Version 19.3.0.0.0

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

Enter password: 
Last Successful login time: Tue Dec 21 2021 18:18:18 +01:00

Connected to:
Oracle Database 21c Enterprise Edition Release 21.0.0.0.0 - Production
Version 21.3.0.0.0

SQL> 

Create an user and password

create user testdb identified by secret; GRANT ALL PRIVILEGES TO testdb;

Test access by additional user

sqlplus testdb/secret@//thinkde:1521/ORCLPDB1

SQL*Plus: Release 19.0.0.0.0 - Production on Tue Dec 21 18:28:32 2021
Version 19.3.0.0.0

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


Connected to:
Oracle Database 21c Enterprise Edition Release 21.0.0.0.0 - Production
Version 21.3.0.0.0

SQL>