Showing posts with label Oracle 19c. Show all posts
Showing posts with label Oracle 19c. Show all posts

Sunday, February 12, 2023

Install Oracle Database using docker in Mac M1

 


   

    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








Sunday, September 4, 2022

Move or Rename Oracle 19c home

      




        I installed Oracle database 19.3 in my lab with Oracle Home /u01/app/oracle/product/19.3.0. I have applied RU patches and now my Oracle database version become 19.7.0. Though the existing home did not produce any error to me it looks lit bit odd so I planned to move Oracle home to /u01/app/oracle/product/19.7.0. 

       I tried the MOS document titled How to move RAC Database ORACLE_HOME from one location to another one (Doc ID 1438719.1) but clone.pl is no longer the best option for 19c. I read a few posts and finally, the following steps worked for me.


Check if Oracle database and shut down Oracle database if it is running. Stop listener process too.

shutdown immediate
lsnrctl stop



Create a new Oracle Home with Linux mkdir command.

mkdir /u01/app/oracle/product/19.7.0


Change directory to existing Oracle Home and execute runInstaller to create gold Image.

cd $ORACLE_HOME
./runInstaller -silent  -createGoldImage -destinationLocation /u01/app/oracle/product/19.7.0


Change directory to new Oracle HOme and unzip the Gold Image.

cd /u01/app/oracle/product/19.7.0
unzip db_home_2021-08-30_05-04-53AM.zip



Create a directory dbhome_1 and move all of the content to dbhome_1. We can create the dbhome_1 directory in the earlier steps and directory extract the Gold Image to the directory.




Once the extract is completed copy the response file and modify it. Once the file is modified option values look something like the below.


Execute runInstaller. Since I am using OEL 8 I need to export CV_ASSUME_DISTID env variables before running runInstaller.

export CV_ASSUME_DISTID=OEL7.6
./runInstaller -ignorePrereq -waitforcompletion -silent \
-responseFile ~/db_install.rsp \
SECURITY_UPDATES_VIA_MYORACLESUPPORT=false \
DECLINE_SECURITY_UPDATES=true



Check Inventory.

cat /u01/app/oraInventory/ContentsXML/inventory.xml




Change Environment variables.

vi ~/.bash_profile


Remove old ORACLE_HOME

cd /u01/app/oracle/product/19.3.0/dbhome_1/deinstall
./deinstall



Finally, delete the older ORACLE HOME.

rm /u01/app/oracle/product/19.3.0


















Friday, September 2, 2022

CRS-6706: Oracle Clusterware Release patch level ('') does not match Software patch level (''). Oracle Clusterware cannot be started.




If you noticed CRS-6706 error while starting cluster after patching as below. The error is due to the rootcrs.sh -prepatch not run successfully before patching. The user ran rootcrs.sh -unlock and apply the patch manually. Please follow the steps below to resolve it.

An error was noticed during cluster start.

crsctl start crs




Execute the command below as user root. The command below will sync the patch locally.

cd $GI_HOME/bin
./clscfg -localpatch


Run the command below as user root to lock the crs

cd $GI_HOME/crs/install
./rootcrs.sh -lock



Start Oracle cluster with the command below.

cd $GI_HOME/bin
./crsctl start crs



Check crs with the command below.

cd $GI_HOME/bin
./crsctl stat res -t




.





Sunday, August 29, 2021

Applying PSU Oracle database 19c

    



    Since Oracle database version 12.2.0.1, Oracle has changed patching model from Patch Set Updates(PS) and Proactive Bundle Patches(BP) to Release Updates(RU) and Release Update Revisions(RUR). Release updates changes the second number from the database version. Following are the steps by step guide to apply RU and upgrading database from 19.3.0.0.0 to 19.7.0.0.0.

       Go to MOS document below and download Oracle RU and opatch utility. It is always good idea to download latest version of the opatch from MOS site. Search for patch number 6880880 to download the latest version of opatch. If you are not able to download the latest version of opatch then go to Patch README.html file and make sure the version of patch you have match the least required version of opatch. 

Primary Note for Database Proactive Patch Program (Doc ID 888.1)

Once you have downloaded the patches. Extract them
unzip p30869156_190000_Linux-x86-64.zip
unzip p6880880_190000_LINUX.zip

List of the patches downloaded from MOS site.

Extracted DB and OJVM combo patch.

Extracted Opatch utilities.


Tree view of the README.html file. Make sure you read the README.html file in details for pre-requisites and the steps to apply patches.



Check existing opatch version in the database server.
cd $ORACLE_HOME/OPatch
./opatch version



Copied latest version of opatch and checked version. But there were errors.
cd $ORACLE_HOME
mv OPatch/ OPatch.001
mv /mnt/Ora19c_Patches/OPatch .


Checked java version and it was 1.8.0_302.



 While searching in an Internet for the solution I finally found the way to fix it by adding option jdk at the end of the command as -jdk $ORACLE_HOME/jdk.
cd $ORACLE_HOME/OPatch
./opatch version -jdk $ORACLE_HOME/jdk



Shutdown the database prior to applying patch.



Change directory to DB patch. In my case directory 30869156 contains the DB Patches.
cd 30869156


Export PATH environment variables to include the location of the latest version of opatch. Validate the opatch location using which linux command.
export PATH=$ORACLE_HOME/OPatch:$PATH
which opatch



Check if there is any conflicting interim patches installed in the database with command below.
opatch prereq CheckConflictAgainstOHWithDetail -ph ./ -jdk $ORACLE_HOME/jdk



Once conflict check is passed apply PSU with command below.
opatch apply -jdk $ORACLE_HOME/jdk



Login to database and start database and pdb(s) if applicable.
sqlplus /nolog
conn / as sysdba
startup
alter pluggable database all open;
quit



Applied datapatch with verbose option but noticed error ORA-20001.


Error ORA-20001: Latest xml inventory is not loaded into table



Search on an Internet and modified hidden parameter _disable_directory_link_check to TRUE. It did not worked for me :(
alter system set "_disable_directory_link_check"=TRUE scope=spfile;
shutdown immediate
startup
alter pluggable database all open;



Next solution tried is to created directory OPATCH_LOG_DIR and OPATCH_SCRIPT_DIR. It did not worked for me :( :(
create or replace directory OPATCH_LOG_DIR as
'/u01/app/oracle/product/19.3.0/dbhome_1/QOpatch';
create or replace directory OPATCH_SCRIPT_DIR as
'/u01/app/oracle/product/19.3.0/dbhome_1/QOpatch';



While reading site https://mikedietrichde.com/2020/07/31/upgrade-fails-with-ora-20001-during-datapatch-run/ I came to know about the inventory table OPATCH_XML_INV. I checked the table and noticed the error was due to the opatch.
select * from OPATCH_XML_INV;



I opened the file qopiprep.bat file in the location mentioned above and added option jdk in the command opatch.
cd $ORACLE_HOME/QOpatch
vi qopiprep.bat




I accessed the inventory table once again and it worked.
select * from OPATCH_XML_INV;



Applied datapatch  with verbose option and it succeed.
cd $ORACLE_HOME/OPatch
./datapatch -verbose


Once datapatch is completed shutdown database to apply OJVM Patch.
conn / as sysdba
shutdown immediate
exit



Change directory to OJVM patch. Check if any conflicting patch is installed for OJVM patch.


Apply OJVM Patch



Start database in upgrade mode


Apply datapatch with verbose option



Shutdown and start database in normal mode.



Query DBA Patch registry.



Execute opatch lspatches command to list the patches applied.