You are probably reading this blog because your application depends on Oracle database. Most enterprises in the world depend on Oracle database to run their business. If you are a developer using Oracle database and getting started with Docker, you must be wondering how can you use a containerized Oracle database.
In my last blog, I outlined how you can use a Dockerized Tomcat /Tom EE with an Oracle database. In this blog, I will describe how you can use Dockerized Oracle database for your development or test activities.
If you want to get started with Docker, review their getting started guide.
Getting Docker Images
Oracle provides Docker images for Oracle Database and you don't have to build using Dockerfile. You can get Oracle Database Docker images either from Docker store or Oracle Container Registry.
In this blog, I will outline the steps required for the Docker image downloaded from Oracle Container Registry.
Login to Container-Registry
You can log in to the Oracle Container Registry as follows:
docker login container-registry.oracle.com
Username :
Password:
The Oracle Container Registry provides option to download images for Oracle Standard or Enterprise Edition (12.2.0.1).
Note that the download may take several minutes or up to couple of hours based on your internet bandwidth.
Download Oracle Database EE
If you want to download the docker image for Oracle Database Enterprise Edition, you can use the Docker pull command as follows:
docker pull container-registry.oracle.com/database/enterprise:12.2.0.1
You will get output as below if the your command is successful:
12.2.0.1: Pulling from database/enterprise
cbb9821ba51c: Downloading [> ] 1.599MB/81.5MB
9bd4d110366e: Downloading [> ] 1.067MB/143MB
af8b29651e27: Download complete
4c242ab1add4: Download complete
7bda1e55bd08: Downloading [> ] 1.599MB/2.737GB
Download Oracle Database SE
In my example, I am going to use Oracle Database Standard Edition. You can download the image for Oracle DB SE as below:
docker pull container-registry.oracle.com/database/standard
You will see output as below:
Using default tag: latest
latest: Pulling from database/standard
Digest: sha256:fad41f7b4b885f13943872218a73c7f051e2caed0b5d5620d8f6f1287cf44918
Status: Image is up to date for container-registry.oracle.com/database/standard:latest
Download Issues
You will get authentication errors if you have not logged to the Docker registry.
Ensure that you accepted the Oracle license agreement in the Oracle Container Registry, otherwise you will get an error message as below:
Error response from daemon: pull access denied for database/standard, repository does not exist or may require 'docker login'
Checking Docker Images
You can check Docker images available by using the following command:
docker images | grep oracle
container-registry.oracle.com/java/serverjre 8 daea2cf635d1 5 weeks ago 280MB
container-registry.oracle.com/database/instantclient latest fda46de41de3 4 months ago 407MB
container-registry.oracle.com/database/standard latest faa877d7fbdd 7 months ago 5.16GB
DB Config file
The Oracle DB container requires a configuration file where you can specify few parameters such as Database SID, Password, etc.
Here is the db.properties file that I used. As you can see I changed the default password and the domain for my database.
DB_SID=ORCL
## db passwd
## default : Oracle
DB_PASSWD=welcome1
## db domain
## default : localdomain
DB_DOMAIN=us.oracle.com
## db bundle
## default : basic
## valid : basic / high / extreme
## (high and extreme are only available for enterprise edition)
DB_BUNDLE=basic
Starting Database Container
You can start the Database container by using the command as shown below. If you have not downloaded the database image, then database image will be automatically pulled from the container repository.
docker run -d --env-file db.properties -p 1521:1521 -p 5500:5500 --name orcldb --net appnet --shm-size="4g" -v /Users/dpanda/orderapp2/orcl:/u04/app container-registry.oracle.com/database/standard
The container will start and database will be ready to use within few minutes.
Reviewing Key Parameters
Let’s review some of the key parameters I specified.
· The --shm-size="4g" parameter sets the size of shared memory i.e. /dev/shm for the container to 4GB.
· The --name orcldb parameter sets the name of the container to orcldb. You can login to the container with that name or other containers can communicate to this container in that name when using SQLNet or JDBC. You can use this name to stop or remove the container.
· The -v /Users/dpanda/orderapp2/orcl:/u04/app option lets the container map the /u04/app drive to the local volume (/Users/dpanda/orderapp2/orcl) of my MAC. This mapping allows the database to create the redo logs into my local drive. Also this will enable me run the SQL scripts that I have in my local drive to run inside the container.
You can check the status of the running containers by using the docker ps command as below:
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
9101006044e9 container-registry.oracle.com/database/standard "/bin/sh -c '/bin/..." 2 minutes ago Up 2 minutes 0.0.0.0:1521->1521/tcp, 0.0.0.0:5500->5500/tcp orcldb
fccce8035b91 orderapp "catalina.sh run" 46 hours ago Up 46 hours 0.0.0.0:8080->8080/tcp
As you can see, the orcldb container running my Oracle database started up 2 minutes ago.
Executing Commands in the Container
Now that the container is running you can run commands inside the container by executing docker exec command
You can login to the container as below and check whether things are set properly.
Note that these are purely optional steps and are not required.
1. Login to the Container
docker exec -it orcldb /bin/bash
[root@9101006044e9 /]#
2. Switch Linux user to oracle user from root
su – oracle
Last login: Sat Jan 13 05:50:33 UTC 2018 on pts/0
3. You can check few things such as Oracle Environment Variables
echo $ORACLE_SID
ORCL
echo $ORACLE_HOME
/u01/app/oracle/product/12.1.0/dbhome_1
sqlplus sys/welcome1 as sysdba
SQL*Plus: Release 12.1.0.2.0 Production on Sat Jan 13 07:03:14 2018
Copyright (c) 1982, 2014, Oracle. All rights reserved.
Connected to:
Oracle Database 12c Standard Edition Release 12.1.0.2.0 - 64bit Production
SQL>
Accessing the Oracle Enterprise Manager Database Console
You can access the EM Console as https://localhost:5500/em
You can login with the user id as sys or system and password you specified in the db.properties file while starting the container.
After you login you will see the Database Home Page as below. You can see the name of your container as your database host.
Your Dockerized Oracle Database is now ready for use!
Try exploring until I next time ! We will see how you can run use SQLPlus with the Dockerized database.
35 comments:
Nice observation and good article,thankyo for sharing your knowledge,keep posting such information that's helpful to others
Devops online training
Best Devops online training
Devops online training in Hyderabad
Devops online training in india
Very useful article,thanks
Tents For Sale Peg and Pole TentsTents For Sale in Durban
Stretch Tents for Sale in Durban Buy Stretch TentsStretrch Tents Fabric
Stretch Tents SizesVIP Toilets For SaleTiffany Chairs
Thank you for this informative post.
Docker Online Training
Kubernetes Online Training
Kubernetes Training in Hyderabad
Docker and Kubernetes Training in Hyderabad
I'm very happy to search out this information processing system. I would like to thank you for this fantastic read!!
Docker Training in Hyderabad
Kubernetes Training in Hyderabad
Docker and Kubernetes Training
Docker and Kubernetes Online Training
Thanks For Sharing a very Nice Informative Information which I very Beneficial for everyone Otherwise if anyone Want to Setup / activate Ms Office So Please visit the Website- https://msofficeset-up.com/
Here is the best Software Company for MS Office Set up
www.office.com/activate
office.com/activate
This is a very interesting article to read. Thanks for sharing the information. Great post.
DevOps Training
DevOps Online Training
Really useful information. Thank you so much for sharing.It will help everyone.Keep Post.
DevOps Training in Chennai | DevOps Training in anna nagar | DevOps Training in omr | DevOps Training in porur | DevOps Training in tambaram | DevOps Training in velachery
Your good knowledge and kindness in playing with all the pieces were very useful. DevOps Training in Bangalore | Certification | Online Training Course institute | DevOps Training in Hyderabad | Certification | Online Training Course institute | DevOps Training in Coimbatore | Certification | Online Training Course institute | DevOps Online Training | Certification | Devops Training Online
I applaud the publication of your article on how to get devops environment in less. It's a good reminder to look on the DevOps training.
https://www.acte.in/php-training-in-chennai
https://www.acte.in/machine-learning-training-in-chennai
https://www.acte.in/iot-training-in-chennai
https://www.acte.in/blockchain-training-in-chennai
https://www.acte.in/openstack-training-in-chennai
With an agenda built by CIOs, for CIOs, The Evanta Global Santa Monica CIO Executive Summit provides a platform for IT leaders to network, learn, and collaborate.
https://www.windzr.com/events
nice thanks for sharing,......................!
Ansible online training
Appium online training
AWS online training
Cool stuff you have got and you keep update all of us.
Best UI/UX Design Services
This is a truly good site post. Not too many people would actually, the way you just did. I am really impressed that there is so much information about this subject that have been uncovered and you’ve done your best, with so much class. If wanted to know more about green smoke reviews, than by all means come in and check our stuff.
Product Development Company in UAE
Pretty nice post. I just stumbled upon your weblog and wanted to say that I have really enjoyed browsing your blog posts.
Best Artificial Intelligence Company
Useful post Thanks for sharing it that’s truly valuable knowledge about similar topic. Amazing. Have a more successful day. Amazing write-up always finds something interesting.
Personality Development Classes
Hey ,
Great Job . You Know what ?
I read a lot of blog posts and I never heard of such a topic. I love the subject you have done about bloggers. Very simple. I am also writing a blog related to the malta work permit. You can also see this.
Iamlinkfeeder
Iamlinkfeeder
Iamlinkfeeder
Iamlinkfeeder
Iamlinkfeeder
Iamlinkfeeder
Iamlinkfeeder
Iamlinkfeeder
Iamlinkfeeder
Iamlinkfeeder
What an awesome post! This is so crammed with helpful data I can hardly wait to burrow profound and begin using the assets you have given me. your abundance is invigorating
you've done something extraordinary for yourself this time
This is presumably the awesome, brief bit by bit direct I've at any point seen on the most proficient method to construct a fruitful blog. I'm likewise composing blog about the kindly audit it. french language institute in delhi .
David Forbes is president of Alliance Marketing Associates IncIamLinkfeeder IamLinkfeeder IamLinkfeeder IamLinkfeeder IamLinkfeeder IamLinkfeeder IamLinkfeeder IamLinkfeeder IamLinkfeeder IamLinkfeeder
We are used to the fact that we know only religious and public holidays and celebrate only them.Iamlinkfeeder Iamlinkfeeder Iamlinkfeeder Iamlinkfeeder Iamlinkfeeder Iamlinkfeeder Iamlinkfeeder Iamlinkfeeder Iamlinkfeeder
Annabelle loves to write and has been doing so for many years.Cheapest and fastest Backlink Indexing Best GPL Store TECKUM IS ALL ABOUT TECH NEWS AND MOBILE REVIEWS
Friend, this web site might be fabulous, i just like it.
online Quran class
Friend, this web site might be fabulous, i just like it.
women brands in Pakistan
You composed this post cautiously which is beneficial for us. I got some different information from your article and I will suggest reading this article who needs this info. Thanks for sharing it. SMM Panel
Top SMM Panel
Really, I enjoy your site with effective and useful information. It is included very nice post with a lot of our resources. Thanks for share. I enjoy this post. Trusted Tax Accountants in Tarneit
BAS Agent Services in Australia
Welcome to CapturedCurrentNews – Latest & Breaking India News 2021
Hello Friends My Name Anthony Morris.latest and breaking news drupepower.com
Nice Post.essay rewriter croydon
selenium automation testing salary in India ranges between ₹ 3.9 Lakhs to ₹ 14.5 Lakhs with an average annual salary of ₹ 7.0 Lakhs. Salary estimates are based on 99 salaries received from Selenium Automation Testers. High Confidence means the data is based on a large number of responses.
SMM panel Indonesia provides a full variety of social media marketing services to businesses and people in the Indonesian market.
I really enjoy the blog article. Much thanks again.
Keerthi55
Wow! This website is absolutely fabulous; I'm loving every bit of it.
Girl Best Online Clothing Store
Jhumki is meticulously adorned with intricate filigree work, detailed engravings, and ornate patterns that showcase the exceptional craftsmanshi bahubali earrings design artisans. Each Jhumki is often embellished with an array of tiny beads,
Branded brcelet is every event Bangles 2024 small amount range prices.
ladies Green sunglasses
Band silver rings
Post a Comment