Showing posts with label LISTENER. Show all posts
Showing posts with label LISTENER. Show all posts

Friday, March 18, 2022

ORACLE 12c DATABASES UPGRADE TO 19c (COMMAND LINE)

 

ORACLE DATABASES UPGRADE 

 

In this article I have followed the steps to directly upgrade database in a single instance from 12c to 19c because direct upgrade to 19c is possible from database versions 11.2.0.4/12.1.0.2/12.2.0.1/18c.

 

 



Oracle database upgrade major steps can be summarised as follow.

·         Download and install oracle 19c software only 

·         Run preupgrade.jar

·         Before upgrade steps

·         Database upgradation

·         After upgrade steps

 

OUR TESTING ENVIRONMENT




DATABASE UPGRADE CERTIFICATION MATRIX

The upgrade path depends on the current database version. Some upgrades are easy and direct, while others require more time and effort. In direct upgrade we use the Database Upgrade Assistant (DBUA) or command-line upgrade script to upgrade the database to Oracle Database 19c. Direct upgrade is supported when the source database is running one of the releases shown in the following table.



OS CERTIFICATION MATRIX

In our testing environment we are running RHEL 7.9 Operating system, so we used the below certification matrix to confirm that oracle database 19c is supported on RHEL 7.5+ / RHEL 8






19c BINARIES INSTALLATION

Download the oracle database 19c software and upload downloaded zip file into the oracle database server.

Create Oracle Home for 19c database using following command

mkdir -p /u01/app/oracle/product/19.0.0/dbhome_1

unzip the 19c software file in 19c oracle home using following command

unzip LINUX.X64_193000_DB_HOME.zip -d /u01/app/oracle/product/19.0.0/dbhome_1

 

./runInstaller

 

Install the Oracle 19c Database software (We can do this Step before upgrade and we will use different Oracle Home location from your Oracle 12c Home.)

 

 In install step 1 we will choose the second option as it will just install the s/w and not create any DB



In install step 2 we choose first option as s/w installation will be for NON RAC environment


 In install step 3 we choose the first option as oracle s/w is enterprise edition (EE)



 In install step 4 we will specify the ORACLE BASE location



 In install step 5 we will define the groups privileges(choose the defaults)



In install step 6 we will not choose anything



In install step 7 we do the prerequisite checks (fix the checks then only proceed to next step)




 In install step 7 we do the prerequisite checks (here we can skip the check as it is just a warning)




 In install step 8 we see the summary of all that we have chosen during the install wizard.



 In install step 9 we can see the installation progress



In install step
9 run the root.sh script as root user (don’t skip it)



 

In install step 10 we can see database software installation was successful.



 

DATABASE RMAN BACKUP

As a prerequisite it Is recommended to take the full backup of the database. We used the below shell script to take the RMAN backup of database (datafiles/controlfiles/spfile) and archive logs files.

 

ORACLE_BASE=/u01/app/oracle

ORACLE_HOME/u01/app/oracle/product/12.2.0.1/db_1

BACKUP_LOCATION=/u01/oracle/backup/shoaibncdb12c

export ORACLE_BASE

export ORACLE_HOME

export ORACLE_SID=SHOAIBCDB

export BACKUP_LOCATION

LOG_FILE=${BACKUP_LOCATION}/backup_db.log

$ORACLE_HOME/bin/rman msglog=${LOG_FILE} << EOF

connect target /

run {

allocate channel d1 type disk;

allocate channel d2 type disk;

allocate channel d3 type disk;

backup database format ‘/u01/oracle/backup/shoaibncdb12c/database_%d_%u_%s’;

release channel d1;

release channel d2;

release channel d3;

}

sql 'alter system archive log current’;

run {

allocate channel a1 type disk;

allocate channel a2 type disk;

allocate channel a3 type disk;

backup archivelog all format ‘/u01/oracle/backup/shoaibncdb12c/arch_%d_%u_%s’;

release channel a1;

release channel a2;

release channel a3;

}

run {

allocate channel c1 type disk;

backup current controlfile for standby format ‘/u01/oracle/backup/shoaibncdb12c/Control_%d_%u_%s’;

release channel c1;

}

exit;

EOF

 

 

LOOK FOR INVALID OBJECTS

As a prerequisite it Is recommended to check for the invalid objects in the container database. In our case there are no invalid objects.


 

MAKE THE REQUIRED DIRECTORY

As a prerequisite we will create a directory location to keep all the upgrade logs and files




PREUPGRADE

In below screenshot we have executed the preupgrade.jar from the 19c Oracle Home. The preupgrade.jar output provides pre and post upgradation recommendation fixup steps. The pre and post upgradation fixup steps located in the directory location as created above. In the output we also get the command to run the pre and post fixup steps.

 




 

VIEW PRE UPGRADE LOG

 











VERIFY TABLESPACE SIZE

 



 

GATHER DICTIONARY STATS

 Before the upgrade process, gather stats. One of the recommendations is to export the stats as well.

 



 

PURGE RECYCLE BIN

Before the upgrade process, empty the recycle bin.

 



RUN PREUPGRADE FIXUP SQL













VERIFY ARCHIVE DEST SIZE

Ensure you have enough free space in db_recovery_file_dest and make changes to db_recovery_file_dest_size if needed.

 





 

STOP LISTENER




 CREATE FLASHBACK GUARANTEED RESTORE POINT

 












SHUTDOWN DATABASE

 



COPY [SPFILE/PASSWORD] FILES TO 19C ORACLE HOME




EDIT ORATAB – MAKE 19C ORACLE HOME ACTIVE

 



START DATABASE IN UPGRADE FROM 19C HOME




RUN DBUPGRADE FROM 19C HOME














AFTER UPGRADE SIMPLY START THE DATABASE FROM 19C HOME





AFTER UPGRADE CHECK THE REGISTRY





POST UPGRADE RUN UTLRP.SQL




RUN POST UPGRADE FIXUP SQL




 UPGRADE TIMEZONE


 





RUN UTLUSTS.SQL

 


 

RUN CATUPPST.SQL







































RERUN POST UPGRADE FIXUP SQL






CHECK INVALID COUNTS



DROP RESTORE POINT



SET COMPATIBLE PARAMETER




VERIFY DBREGISTRY – FINAL CHECK




I hope this upgrade of non container database from 12c to 19c will help the oracle dba jr. :)


ORACLE 12c DATABASES UPGRADE TO 19c (COMMAND LINE)

  ORACLE DATABASES UPGRADE    In this article I have followed the steps to directly upgrade database in a single instance from 12c to 19c ...