DEV Community

Cover image for Oracle database and Docker
Ștefan Vîlce
Ștefan Vîlce

Posted on • Edited on

Oracle database and Docker

Oracle DBA 12 Container and Docker

For my job I had to install an Oracle database on my Windows. And I thought that perhaps it is much better to get this database in a container. Because I need many databases to handle with.

And this solution with containers gives me the independence I need for every each of them. And I can play with different versions of Oracle whithout having problems.

I have decided to write this post because it was kind of difficult to find something really helpfull on internet.

I had Docker already installed on my PC Windows. And then I run this:

docker run -d -p 8080:8080 -p 1521:1521 --name OracleDB store/oracle/database-enterprise:12.2.0.1-slim

In my Docker Dashboard i got this:
Docker Dashboard woth Oracle 12 database
As you can see there is the newest container in my Docker, OracleDB. I got the Oracle 12 slim for this project.
With this command
docker ps
i get this
docker container ID
So, i could see that the container ID is: 5d365b3daa70. Then i run:
docker exec -it 5d365b3daa70 /bin/bash
and then
sqlplus / as sysdba
sqlplus terminal

Here I can run this:

alter session set "_ORACLE_SCRIPT"=true;
create user newDB identified by newDB;
GRANT CONNECT, RESOURCE, DBA TO newDB;

And then I run this:

select value from v$parameter where name='service_names';

I open the sql developer and connect to this schema:
sql developer connection

Now I can start create tables in this schema, newDB.

What's next

I'll try to get the same thing but with Oracle 19.

Top comments (0)