Subscribe to Posts by Email

Subscriber Count

    701

Disclaimer

All information is offered in good faith and in the hope that it may be of use for educational purpose and for Database community purpose, but is not guaranteed to be correct, up to date or suitable for any particular purpose. db.geeksinsight.com accepts no liability in respect of this information or its use. This site is independent of and does not represent Oracle Corporation in any way. Oracle does not officially sponsor, approve, or endorse this site or its content and if notify any such I am happy to remove. Product and company names mentioned in this website may be the trademarks of their respective owners and published here for informational purpose only. This is my personal blog. The views expressed on these pages are mine and learnt from other blogs and bloggers and to enhance and support the DBA community and this web blog does not represent the thoughts, intentions, plans or strategies of my current employer nor the Oracle and its affiliates or any other companies. And this website does not offer or take profit for providing these content and this is purely non-profit and for educational purpose only. If you see any issues with Content and copy write issues, I am happy to remove if you notify me. Contact Geek DBA Team, via geeksinsights@gmail.com

Pages

Oracle Container Registry – Docker for Oracle Databases

Hello All,

This post is about how to use Docker and utilize oracle container registry i.e oracle official docker hub.

Until now,I am using open source/public docker images from dockerhub, Today I had a final look on Oracle Container Registry which having Official Oracle Docker Images with different products like FMW,Database,Goldengate,Java, Coherence,Weblogic.

These two locations we can find Oracle Docker Images

  1. https://container-registry.oracle.com
  2. https://store.docker.com/search?certification_status=certified&q=oracle&source=verified&type=image

And there is github official repository as well.

  1. https://github.com/oracle/docker-images

Those who are not familiar with docker, its just simple. All of us are using Oracle Virtual Box/VM etc for Virtualization, how ever  if you want to use a virtual box first you need to install the OS on virtual machine, in Docker, your host OS is shared among all other containers (aka virtual images) or the docker image will have its own OS too. All you need Install docker, download image, run the image. Thats it. :). I will write a post on managing docker separately .

Let's have a quick install and look at container-registry.

Install docker for windows using following link (You need to have virtualisation enabled in your machine)

https://store.docker.com/editions/community/docker-ce-desktop-windows

Then log into https://container-registry.oracle.com with your single sign on account.

containerregistry1

 

containerregistry2

As you see above Coherance, Databases, Java,Middleware,MySQL, OS and Openstack are the current categogies and docker images available. Click on the Databases.

 

There you find the enterprise,standard, instant client for oracle database. click on any enterprise or standard, you will be asked to accept terms and conditions, You click on continuebutton, on the right of the following screen. I already accepted hence I do not have it to show you

 

containerregistrydb1

 

Currently with Oracle database the following limitations are there

  1. This Docker image release supports only single database instance.
  2. Dataguard feature is not supported.

When you click on the enterprise again you will be open with documentation how you can use this image.

 

containerregistrydb2

 

The highlighted are the two commands really you need to do to get a database up and running. (You must have a decent internet connection to download the 2.5gb of database image).

At this point, you have installed docker and you have container-registry account.

Open a command prompt and pull the docker image first. It will prompt you to login your sso account. While pulling the image if you receive access denied error that means you have not accepted the terms and conditions in browser, accept it and then pull again.

 

Once you pulled the images, run using,

docker pull container-registry.oracle.com/database/enterprise

donwload-enterprise-docker

For standard edition use ,

docker pull container-registry.oracle.com/database/standard

donwload-standard-docker

This will take time to download, once downloaded, run the image with, Just run the docker image without options,

Just run without options

docker run -d -it --name orcl12c container-registry.oracle.com/database/enterprise:12.2.0.1

Login to docker for sqlplus

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

Run the image to ensure the database is accessible outside container -p is used

docker run -d -it --name orcl12c -P container-registry.oracle.com/database/enterprise:12.2.0.1

If you want to set options and few other params for databases run the following block, This will use this options, SID, PDB Name, Password and Characterset , lets run this one

docker run --name orcl12cr2 -p 1521:1521 -p 5500:5500 -e ORACLE_SID=ORCL12C -e ORACLE_PDB=PDB1  -e ORACLE_PWD=admin123 -e ORACLE_CHARACTERSET=AL32UTF8 -  container-registry.oracle.com/database/enterprise:12.2.0.1

Screen output

Setup Oracle Database
Oracle Database 12.2.0.1 Setup
Sat Dec 9 11:07:23 UTC 2017

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
untarDB.sh is done at 59 sec

config DB ......
log file is : /home/oracle/setup/log/configDB.log
Sat Dec 9 11:08:22 UTC 2017
Start Docker DB configuration
Call configDBora.sh to configure database
Sat Dec 9 11:08:22 UTC 2017
Configure DB as oracle user
Setup Database directories ...

SQL*Plus: Release 12.2.0.1.0 Production on Sat Dec 9 11:08:22 2017

Copyright (c) 1982, 2016, Oracle. All rights reserved.

Connected to an idle instance.

SQL>
File created.

SQL> ORACLE instance started.

Total System Global Area 1342177280 bytes
Fixed Size 8792536 bytes
Variable Size 352323112 bytes
Database Buffers 973078528 bytes
Redo Buffers 7983104 bytes
Database mounted.
Database opened.
SQL>
Database altered.

SQL>
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
spfile string /u01/app/oracle/product/12.2.0
/dbhome_1/dbs/spfileORCLCDB.or
a
SQL>
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
encrypt_new_tablespaces string CLOUD_ONLY
SQL>
User altered.

SQL>
User altered.

SQL> Disconnected from Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production
update password

Enter password for SYS:
create pdb : ORCLPDB1

SQL*Plus: Release 12.2.0.1.0 Production on Sat Dec 9 11:08:42 2017

Copyright (c) 1982, 2016, Oracle. All rights reserved.

Connected to:
Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production

SQL> 2 3 4 5
Pluggable database created.

SQL>
Pluggable database altered.

SQL>
Pluggable database altered.

SQL> Disconnected from Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production
Reset Database parameters

SQL*Plus: Release 12.2.0.1.0 Production on Sat Dec 9 11:08:52 2017

Copyright (c) 1982, 2016, Oracle. All rights reserved.

Connected to:
Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production

SQL>
System altered.

SQL> Disconnected from Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production

LSNRCTL for Linux: Version 12.2.0.1.0 - Production on 09-DEC-2017 11:08:52

Copyright (c) 1991, 2016, Oracle. All rights reserved.

Starting /u01/app/oracle/product/12.2.0/dbhome_1/bin/tnslsnr: please wait...

TNSLSNR for Linux: Version 12.2.0.1.0 - Production
System parameter file is /u01/app/oracle/product/12.2.0/dbhome_1/admin/ORCLCDB/listener.ora
Log messages written to /u01/app/oracle/diag/tnslsnr/a3d65060e96e/listener/alert/log.xml
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=0.0.0.0)(PORT=1521)))
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=0.0.0.0)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 12.2.0.1.0 - Production
Start Date 09-DEC-2017 11:08:53
Uptime 0 days 0 hr. 0 min. 1 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /u01/app/oracle/product/12.2.0/dbhome_1/admin/ORCLCDB/listener.ora
Listener Log File /u01/app/oracle/diag/tnslsnr/a3d65060e96e/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=0.0.0.0)(PORT=1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
The listener supports no services
The command completed successfully

DONE!
Remove password info
Docker DB configuration is complete !
configDB.sh is done at 90 sec

Done ! The database is ready for use .
# ===========================================================================
# == Add below entries to your tnsnames.ora to access this database server ==
# ====================== from external host =================================
ORCLCDB=(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=<ip-address>)(PORT=<port>))
(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=ORCLCDB.localdomain)))
ORCLPDB1=(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=<ip-address>)(PORT=<port>))
(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=ORCLPDB1.localdomain)))
#
#ip-address : IP address of the host where the container is running.
#port : Host Port that is mapped to the port 1521 of the container.
#
# The mapped port can be obtained from running "docker port <container-id>"
# ===========================================================================
ORCLPDB1(3):Database Characterset for ORCLPDB1 is AL32UTF8
ORCLPDB1(3):Opatch validation is skipped for PDB ORCLPDB1 (con_id=0)
2017-12-09T11:08:52.480340+00:00
ORCLPDB1(3):Opening pdb with no Resource Manager plan active
Pluggable database ORCLPDB1 opened read write
Completed: alter pluggable database ORCLPDB1 open
alter pluggable database all save state
Completed: alter pluggable database all save state
2017-12-09T11:08:52.666801+00:00
ALTER SYSTEM SET encrypt_new_tablespaces='DDL' SCOPE=BOTH;
2017-12-09T11:09:40.915047+00:00
TABLE SYS.WRP$_REPORTS: ADDED INTERVAL PARTITION SYS_P287 (2900) VALUES LESS THAN (TO_DATE(' 2017-12-10 01:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))
TABLE SYS.WRP$_REPORTS_DETAILS: ADDED INTERVAL PARTITION SYS_P288 (2900) VALUES LESS THAN (TO_DATE(' 2017-12-10 01:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))
2017-12-09T11:09:41.026256+00:00
Thread 1 advanced to log sequence 5 (LGWR switch)
Current log# 2 seq# 5 mem# 0: /u04/app/oracle/redo/redo002.log
TABLE SYS.WRP$_REPORTS_TIME_BANDS: ADDED INTERVAL PARTITION SYS_P291 (2899) VALUES LESS THAN (TO_DATE(' 2017-12-09 01:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))

Find the tns details using

docker port oracleDB

C:\Users\gandhi>docker port orcl12cr2
1521/tcp -> 0.0.0.0:1521
5500/tcp -> 0.0.0.0:5500

Then connect using sqlplus, but in order to work connection outside of container works you must run the container with -P or -p option and the default sys password is Oracdoc_db1

sqlplus sys/Oradoc_db1@ORCLCDB as sysdba

dockersqlplus

Let's look at environment, the filesystem and enviornment variables inside the container

docker exec -it orcl12cr2 bash

env

 

Let's check the alert log, docker has option logs, which shows alert log, and also you can tail it using -f and since how many mins you want ,

docker logs orcl12cr2 -f --since 10m

alertlogcheck

For your knowledge purpose , /home/oracle/setup/ contains all the files that docker use for setup etc.

Hope you liked it, Dockers provides much quicker provisioning and provides flexibility and feasibility for a devops model in database domain.

Next post we will be seeing Oracle Container for MySQL and Weblogic

-Thanks

Suresh

 

2 comments to Oracle Container Registry – Docker for Oracle Databases