Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I connect to docker Oracle instance using OracleSQL Developer?

I pulled image

docker pull store/oracle/database-enterprise:12.2.0.1 from here https://hub.docker.com/u/brekhinaleks/content/sub-6f22957e-9628-4ac6-a935-1c0cab2f648e

And execute

docker run -d -it --name ETL store/oracle/database-enterprise:12.2.0.1

➜  ~ docker run -d -it --name ETL store/oracle/database- 
enterprise:12.2.0.1
aaca9926e1653027c24610cdde97f542f3ca2551f224942e84c80daea355642b
➜  ~ docker logs ETL
Setup Oracle Database
Oracle Database 12.2.0.1 Setup
Tue Jun 25 15:35:35 UTC 2019

Check parameters ......
log file is : /home/oracle/setup/log/paramChk.log
paramChk.sh is done at 0 sec

untar DB bits ......
log file is : /home/oracle/setup/log/untarDB.log

But i can't connect to DB enter image description here

like image 638
AbrA Avatar asked Sep 03 '25 01:09

AbrA


2 Answers

If you got this message : Status : Failure -Test failed: IO Error: The Network Adapter could not establish the connection just follow this step :

before starting make sure your are ruining the docker image using port forwarding :

docker run -d -p 1521:1521 --name Oracle store/oracle/database-enterprise:12.2.0.1

->1 :

docker exec -it Oracle bash -c "source /home/oracle/.bashrc; sqlplus /nolog"

-> 2 :

connect sys/Oradoc_db1@ORCLCDB as sysdba 

-> 3 give permission to sys user or any user you want to use on your Sql developer :

grant all privileges to sys ;

enter image description here

like image 90
Yasssine ELALAOUI Avatar answered Sep 05 '25 06:09

Yasssine ELALAOUI


None of the above method worked for me. I was able to connect by using the actual ip of the container.

I run the container as docker run -it -p 1512:1512 store/oracle/database-enterprise:12.2.0.1-slim

Then I would get a bash console to play round

docker exec -it CONTAINER_ID bash

Inside the container I look up the ip

$ ip a

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
46: eth0@if47: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP 
    link/ether 02:42:ac:11:00:02 brd ff:ff:ff:ff:ff:ff link-netnsid 0
    inet 172.17.0.2/16 brd 172.17.255.255 scope global eth0

Finally I use the address of the non loopback interface to connect using SQL Developer

like image 23
fedemengo Avatar answered Sep 05 '25 07:09

fedemengo