Showing posts with label Oracle Installation. Show all posts
Showing posts with label Oracle Installation. Show all posts

Sunday, February 12, 2023

Install Oracle Database using docker in Mac M1

1:26 PM Posted by Dilli Raj Maharjan , , No comments

 


   

    The new Mac with Apple Silicon is ARM 64-bit architecture and does not directly support x86_64 or AMD 64-bit applications. There are multiple ways to make an x86_64 bit application run with the arm processor. There is no easy and straightforward way to install Oracle Database using docker in mac with M1/M2 chip. Following is the step-by-step guide to install the Oracle database using docker in a mac M1 processor.


Install Homebrew and other required packages.

    Homebrew is a package manager for macOS. It is one of the first tools that need to install on your mac to install docker for x86_64 containers. It is used to install (and remove) software programs for the terminal, or CLI. Almost every useful open-source package is available through Homebrew. Installing Homebrew is pretty easy. Execute the command below in the terminal window to install Homebrew.

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

    Set environment variables to include brew binary in the PATH environment variable. Execute the following command in the terminal

export PATH=/opt/homebrew/bin:$PATH

    Uninstalled any docker package installed by App Store or using dmg files. It will avoid any crossover with the software. Install the following brew packages. Here, Docker is an open platform for developing, shipping, and running applications using Docker containers. Similarly, Docker Compose is a tool that was developed to help define and share multi-container applications. Colima is a container runtime on MacOS (and Linux) with minimal setup. Colima is almost a drop-in replacement for Docker Desktop. Colima directly supports the ARM chip and it can start up the VM that will run the x86_64 containers. Qemu is an emulator for x86 and arm chips.

$ brew install colima
$ brew reinstall qemu
$ brew install docker
$ brew install docker-compose

    Start a VM to run an x86_64 docker container.  Execute command in the terminal. The command below starts a VM that uses 4 CPUs, and 12G of memory, and supports the x86_64 architecture. This should allow me to download and run an x86_64 container.

colima start -c 4 -m 12 -a x86_64

Validate the status of the VM that was started.

colima list

Once docker everything is ready, export a running docker x86_64 container with the Oracle database running. I tried to install the Oracle database using
Oracle's official docker repo but encountered some java related issues. The second time, I installed OEL 7.9 and tried to install Oracle database software and Oracle database but it failed again with the Java issue. I will troubleshoot the issue later but for this post, I am saving my running Intel-based x86_64 docker container image to a file and loading a file to the docker with an M1 chip.

    Due to a license issue, I cannot share my Oracle Database docker Image file. I am assuming ora19c.gz is a file where I have loaded Oracle docker Image.


Syntax to load the docker image to a file.

docker save oracle/database:19.3.0-ee | gzip  > ora19c.gz

    Once the docker image is saved to the file with the name ora19c.gz. Ship the file to the Mac book Maching with M1 chip. Load the image file copy with the command below.

docker load < ora19c.gz


Create and run a new container from an image oracle.

docker run -d -t -i --privileged --name=oracle19c --hostname=oracle19c -p 1522:1521 -v /Users/raj:/mnt ora19c oracle/database:19.3.0-ee


Verify docker container is running.

docker ps 


Execute /bin/bash command in a running docker container.

docker exec -it -u oracle oracle19c /bin/bash


Starting Oracle Database container later.


Verify if colima is started, if not start with the command below.

/opt/homebrew/bin/colima list
/opt/homebrew/bin/colima start



Start Oracle Database container.

docker start oracle19c


Execute /bin/bash in the running oracle database container.


docker exec -it -u oracle oracle19c /bin/bash








Wednesday, July 1, 2020

Install Oracle Database 19c in docker container

9:07 PM Posted by Dilli Raj Maharjan , No comments



Docker is a set of platform as a service (PaaS) product that uses OS-level virtualization to deliver software in packages called containers. Containers are isolated from one another and bundle their own software, libraries, and configuration files; they can communicate with each other through well-defined channels. All containers are run by a single operating system kernel and therefore use fewer resources than virtual machines. The software that hosts the containers is called Docker Engine.  It was first started in 2013 and is developed by Docker, Inc.

All versions of Oracle databases are now available as a container in Oracle official Github.

Before starting the installation, install the Docker on your computer. I have already downloaded and installed Docker for Mac. Make sure your Docker app is up and running before start installation.

Following is the step by step guide to install Oracle Database 19c in a docker container.

Open URL https://github.com/oracle/docker-images in the browser and click on Clone.



Click on copy icon to copy the web URL.



Open terminal and change directory to one where you want to clone this git URL. 
Type git clone https://github.com/oracle/docker-images to clone docker images from Oracle.



Once docker files are fully cloned it displayes 100% done.



Change directory to docker-images. There are a lot of directories for Oracle software docker image files.
cd docker-images



Change Directory to OracleDatabase and SingleInstance. There is a directory for RAC also but we are installing the Single Instance Oracle 19c database. 
cd OracleDatabase
cd SingleInstance



Change directory to Dockerfiles and you will notice the database versions there. Change directory to 19.3.0 for Oracle 19c installation.
cd dockerfiles
cd 19.3.0



Download Oracle database version 19c from Oracle official site. Copy Oracle 19c source file to the current directory. Do not extract file over here. Just copy the compressed source file.
cp ~/Documents/Software/Oracle/Oracle_19c/LINUX.X64_193000_db_home.zip .


List all the available files on the directory. Validate Oracle19c source file has been copied successfully.



Select the content of db_inst.rsp response file. Use the following command to exclude blank lines and comments from the response file. We can see that only Oracle software will be installed. Oracle Base location, Oracle Home location, and Oracle Edition will be set via environment variables.
grep -v ^# db_inst.rsp | grep -v ^$



List the content of dbca.rsp.tmpl file. Use the command below to exclude blank lines and comments from the dbca response file. A container database with one pluggable database will be installed using this dbca response file. Pluggable database name, Oracle sid, and sys password will be set via environment variables.
grep -v ^# dbca.rsp.tmpl | grep -v ^$



Change directory to parent directory and execute buildDockerImage.sh executable binary with -v and -e option. Specify the version number with v option and -e for enterprise edition image.



Building Image in progress #####



Building Image in progress ###############



Once Oracle Software Installation is complete it will display the message as Successfully setup Software. Few pre-requisites before Oracle software installation failed so there are warning messages with the successful setup.



Finally Oracle image build is complete and tagged as name oracle/database:19.3.0-ee



Execute docker run to start docker container with Oracle 19c image. During its first run, it will create a database using dbca so it may take 15-20 min to complete dbca task. The following are the options used and their description. 

docker run \
--name oracle19c \
-p 1521:1521 \
-p 5500:5500 \
-e ORACLE_PDB=orcl \
-e ORACLE_PWD=password \
-e ORACLE_MEM=2000 \
-v /opt/oracle/oradata \
-d \
oracle/database:19.3.0-ee

run   : Command docker to run specified Image.
-p.    : Publish port in the form of local port:docker container port.
-e     : Set environment variable
-v     : Bind mount a volume
-d     : Detach. Run container in background and print container ID
oracle/database:19.3.0-ee : Name of image.



If you list the currently running docker container you may notice the health of the container is starting. The database creation process is in progress now.



While checking the docker log we can notice oracle dbca is in progress. Docker log can be checked from the command line as well as from the Docker dashboard. We can see dbca outputs in the docker log file.

Checking the docker log from the command line. We can noticed listener status and dbca ongoing.




Checking log via Docker GUI. We can notice database configuration is on progress.

Oracle 19c database configuration in progress. #####



Oracle 19c database configuration in progress. ##########



# Oracle Database installation complete.



Logged in to the container with the command below and check the listener status. We can notice the listener is up and running.
docker exec -it oracle19c /bin/bash


lsnrctl status


Provide username, password, Service Name, and click on Test. It will return success if the installation completes successfully.



 Now we can execute Oracle SQL commands in the SQLDeveloper workspace.

 


List current running docker containers.








docker ps



Stopping Docker container.


Starting Docker container.


Execute /bin/bash for docker container.



Tuesday, February 6, 2018

Install Oracle 12c R2 RAC database

8:03 AM Posted by Dilli Raj Maharjan No comments

Once Oracle Grid Infrastructure 12c R2 installation completes successfully. 
Extract the Oracle Database source at appropriate location. Change directory to the source and execute 
./runInstaller


Below is the landing page once you execute the runInstaller.


Uncheck option I wish to receive security updates via My Oracle Support. Click on Next > to continue.

Warning message will be pop up Click on Yes to continue. 


Select Create and configure a database and Click on Next > to continue.


Select Server class and Click on Next > to continue.


Select Oracle Real Application Cluster database installation. Click on Next > to continue.


Select Admin managed and Click on Next > to continue.


Make sure that rac01 and rac02 are selected and Click on Next > to continue.


Select Advanced Install option. Click on Next > to continue.


Select Enterprise Edition (7.5GB) Click on Next > to continue.


Browse and choose appropriate Oracle base and Software location. Click on Next > to continue.


Choose required database template. Click on Next > to continue.


Specify database identifiers and choose either database need to create as container database. If yes then provide pluggable database name. Click on Next > to continue.


Enabling Automatic Memory Management may result error if physical memory is greater than 4GB. Following error message will be displayed in that case.





Make sure you do not enable Automatic memory management. Click on Character sets tab to change character sets.

Choose required character set. Click on Sample schemas tab if you need sample schemas.


Select Install sample schemas in the database option if we need sample schemas to be installed on database.  Click on Next > to continue.


Select appropriate Database Storage Options.  Click on Next > to continue.


If we have EM cloud control already installed on our environment then we can specify the details of EM cloud control. Otherwise make sure this option is not selected.  Click on Next > to continue.


If we need to enable recovery options then select this option and specify the storage location for recovery.  Click on Next > to continue.


Select required disk group name to install Oracle database.  Click on Next > to continue.



Enter password for administrative accounts.  Click on Next > to continue.


Provide appropriate OS groups.  Click on Next > to continue.


Prerequisite Checks in progress.

Prerequisite failed due to insufficient total swap space. In my case swap space is not sufficient. I have option to increase swap space or Ignore it. Click on Ignore All to ignore.

Once prerequisite failed has been ignored, click on Next > to continue.

 
Warning message will be pop up. Click on Yes to continue.


Summary screen will be displayed. Click on Install to begin installation.


Installation on progress. #####


Installation on progress. ##########


Execute Configuration Scripts window will be pop up. Execute script on rac01 and rac02.




Once script execution completes Click on OK to continue.



Once installation completes Click on Close to close the window.