[Oracle] How to configure Oracle DB in docker container.

juniordevops.pl 4 lat temu

How to run Oracle database in a docker container with little configurations.

First of all, we must download docker image, command:

docker login docker pull store/oracle/database-enterprise:12.2.0.1

first command login us, second will pull the image.

Run docker container:

docker run -d -it --network=host -e DB_SID=mydb -e DB_MEMORY=1 --name oracle-db store/oracle/database-enterprise:12.2.0.1

A short explanation of what additional flags do. We set up how many memory container should use, and what SID name will be. SID name is simply a database name. Many different SID names can point to the same database.

Now we can try to connect DB. Install locally sqlplus or use one that is installed inside container, isn’t important. Only different will be connection string. If you use own client, you must use the command:

sqlplus 'sys/Oradoc_db1@(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(Host=localhost)(Port=1521))(CONNECT_DATA=(SID=mydb)))'

Def:

The Oracle Listener is a process listening for incoming database connections. This process is only needed on the database server side. The listener is controlled via the lsnrctl utility. Configuration is done via the listener.ora file

It is better to change password for sys user:
Enter inside docker container:

docker exec -it oracle-db "/bin/bash"

then use sqlplus command and login (login: system, password: Oradoc_db1) and change password using query:

alter user sys identified by <new-password>;
Idź do oryginalnego materiału