DEV Community

Cover image for Install Oracle 12C with Docker
Chinthaka Bandara
Chinthaka Bandara

Posted on • Updated on

Install Oracle 12C with Docker

Installing oracle database is a very tedious task. But with the help of Docker Containers, it can be easily done. With this solution, it gives developers the flexibility to work with multiple databases without the hassle.

Prerequisites

  1. Docker Installation
  2. Docker Hub Account
  3. Oracle Account (for downloading SQL Developer)

Head into Oracle Database Enterprise Edition & agree to terms & conditions.

Installation

Open Windows Terminal & run the following commands

  • Login to Docker Hub
docker login
Enter fullscreen mode Exit fullscreen mode
  • Download Oracle Image
docker pull store/oracle/database-enterprise:12.2.0.1
Enter fullscreen mode Exit fullscreen mode
  • Run Image
docker run -d -p 1521:1521 --name oracle store/oracle/database-enterprise:12.2.0.1
Enter fullscreen mode Exit fullscreen mode
  • Connect to container
docker exec -it oracle bash -c "source /home/oracle/.bashrc; sqlplus /nolog"
Enter fullscreen mode Exit fullscreen mode

Once the above command executes it will connect you to the SQL Plus terminal. Execute following commands to create the user to work on

connect sys as sysdba;
Enter fullscreen mode Exit fullscreen mode

Above command will prompt you to enter the password. Enter Oradoc_db1 as default password

Next, run the below commands one by one

alter session set "_ORACLE_SCRIPT"=true;
create user <username> identified by <password>;
GRANT ALL PRIVILEGES TO <username>;

Enter fullscreen mode Exit fullscreen mode

Now we can connect to the above created Oracle schema using Oracle SQL Developer

Use the following values when login

Property Value
Username entered user
Password entered password
Hostname localhost
Port 1521
Service Name ORCLCDB.localdomain

Happy Coding 😀

Top comments (1)

Collapse
 
datmt profile image
Mạnh Đạt

Thanks a lot for the write up. It helped me a lot. However, it seems the docker image isn't available on docker hub anymore.
I wrote a tutorial here also shows how to get the image from Oracle docker registry:
datmt.com/backend/how-to-install-o...