Problem
You need a test Oracle database easy and fast without much of the server configuration steps which usually involved during normal Oracle Database installation procedure.
Solution
To avoid the preinstallation steps required to configure a database server, you may run an Oracle database as a container using Podman or Docker on Linux. Oracle Linux 8 and Podman is used for this exercise.
1. This exercise assumes an existing Oracle Linux 8 host. Follow the details outlined in Oracle Linux 8 -- Minimal Installation In a VirtualBox VM to set up one.
2. Install container tools
# dnf module install container-tools:ol8
Verify podman
# podman info
Optionally install podman-docker to alias docker commands to podman commands for convenience
# dnf install podman-docker
3. Optionally change the location where images will be downloaded and stored.
$HOME/.config/containers/storage.conf
[storage]
driver = "overlay"
graphroot = "/media/sf_Shared/oelinux83/containers/storage"
driver = "overlay"
graphroot = "/media/sf_Shared/oelinux83/containers/storage"
4. Pull the image of the Oracle Database 19.3 from https://container-registry.oracle.com
$ podman login container-registry.oracle.com
$ podman pull container-registry.oracle.com/database/enterprise:latest
During pull /var/tmp/ folder will be used as temp storage. You can change it with the TMPDIR environment variable.
Verify the image:
$ podman images
5. Create a container:
$ podman create --name <container_name> \
-p <host_port>:1521 -p <host_port>:5500 \
-e ORACLE_PWD=<your_database_password> \
-e INIT_SGA_SIZE=1024 \
-e INIT_PGA_SIZE=512 \
container-registry.oracle.com/database/enterprise:latest
-e ORACLE_PWD=<your_database_password> \
-e INIT_SGA_SIZE=1024 \
-e INIT_PGA_SIZE=512 \
container-registry.oracle.com/database/enterprise:latest
Note. You need to provide both the values, INIT_SGA_SIZE and INIT_PGA_SIZE or neither of them
Open specified ports on host through firewall:
# firewall-cmd --permanent --zone=public --add-port=1521/tcp --add-port=5500/tcp
# firewall-cmd --reload6. Start the container:
$ podman start <container_name>
Monitor the container instantiation with:
$ podman logs -f <container_name>
It will take some time for database provisioning
7. Test connection to the newly created database as a container:
From the host:
$ podman exec -it <container_name> sqlplus / as sysdba
From a client:
$ sqlplus system/<pwd>@<host>:1521/ORCLCDB
$ sqlplus system/<pwd>@<host>:1521/orclpdb1
Note.
When connecting from a Windows client host, you might need to disable the out-of-band break messages, in case you get ORA-12637: Packet receive failed or ORA-01017: invalid username/password:
For SQL*Net OCI clients add DISABLE_OOB=ON to the sqlnet.ora file
For JDBC Thin clients use
jdbc:oracle:thin:@tcp://<host>:<port>/<service>?oracle.net.disableOob=true
jdbc:oracle:thin:@tcp://<host>:<port>/<service>?oracle.net.disableOob=true
Now the database is accessible and ready for use.
For more information and reference, check the link
No comments:
Post a Comment