Oracle Grid Infrastructure upgrades include Oracle Clusterware and Oracle Automatic Storage Management upgrades (Oracle ASM). Oracle Grid Infrastructure upgrades can be rolling upgrades, in which a subset of nodes are brought down and upgraded while other nodes remain active.
In this post, we briefly describe the approach for upgrading oracle grid infrastructure along with the RAC database from 12c to 19c.
Grid Instrstrucure Upgrade Steps 12c to 19c
Source & Destination Details:
Source Version: 12.2.0.1
Target Version: 19.3.0.0
12c GRID HOME: /u01/app/12c/grid
19c GRID HOME: /u01/app/19c/grid/
12c Database Home: /u01/app/oracle/product/12c/db_1
19c Database Home: /u01/app/oracle/product/19c/db_1
DB Name: TESTDB
Steps to Upgrade Grid Infrastructure 12c to 19c
1. Review the pre-upgrade checklist.
2. Download 19c Grid software.
3. Run the Orachk readiness assessment.
4. Run the cluster verification utility.
5. Dry-run upgrade.
6. Upgrade Grid.
7. Verify Grid upgrade.
Step 1. Pre-Upgrade Checklist
According to the Oracle Document, you must apply the 28553832 patches otherwise it is you must apply the latest PSU patch in the 12c Grid home directory as a prerequisite.
$ ./opatch lsinventory |grep -i 28553832
28553832, 20883009, 21678268
Step 2. Download the Grid Software
You can download the 19c Grid Create a directory on both the RAC (Real Application Cluster) nodes:
mkdir -p /u01/app/grid/19c/grid
chown -R grid:oinstall /u01/app/grid/19c/grid
chmod -R 775 /u01/app/grid/19c/grid
Copy the 19c grid software to the first node of RAC and unzip it:
cd /u01/software/ -- downloaded software location
unzip LINUX.X64_193000_grid_home.zip -d /u01/app/grid/19c/grid (19c grid home)
Step 3. Run the orachk tool as grid owner (oracle)
Orachk tool will generate a report for recommendation, that need to be taken care before upgrading.
cd /u01/app/grid/19c/grid/suptools/orachk
./orachk –u -o pre
Analyze the html report for any recommendations.
Step 4. Run cluvfy utility to pre-check any errors
On 1st node only run the pre-upgrade script from the new home and generate a fix script if generated. as grid user.
su - grid
cd /u01/app/19c/grid -- 19c grid home
./runcluvfy.sh stage -pre crsinst -upgrade -rolling -src_crshome /u01/app/12c/grid -dest_crshome /u01/app/19c/grid -dest_version 19.3.0.0.0 -fixup -verbose
Note: Make sure the cluvfy is executed successfully. If any error occurs, take action before going to the GRID 12c upgrade.
Step 5. Using Dry-Run Upgrade Mode to Check System Upgrade Readiness
Oracle introduced this new feature in 19c Grid. You can execute a dry-run upgrade before the actual upgrade. Dry-run upgrades verify all the steps similar to a real upgrade without making any real changes. On 1st node run grid setup dry run from the new home. Starting from 19c we have the option to run dry run before we actually upgrade. Run the following commands:
cd /u01/app/19c/grid
gridsetup.sh -dryRunForUpgrade
Action: Click “Upgrade Oracle Grid Infrastructure”
Action: Insert grid password and click the Test button to check that ssh connectivity is successfully established.
Action: Click the Next
Action: Click the Next button
Action: Click Submit button
Action: Run the root script only on the local node.
NOTE – Don’t run this on the remote node. Run only on the local node
/u01/app/19c/grid/crs/config/rootconfig.sh
After executing rootconfig.sh successfully completed the OK button.
The dry run upgrade is successful. Let’s proceed with the actual upgrade.
Step 6: Actual Upgrade Grid Infrastructure
— Run as grid owner (oracle)
unset ORACLE_BASE
unset ORACLE_HOME
unset ORACLE_SID
cd /u01/app/19c/grid
./gridSetup.sh
Action: Click the Next button
Action: Provide the grid password and click the Test button to check the ssh connectivity whether is okay or not and then click the Next button.
Action: Click the Next button
Action: Click the Next button
Action: Click the Submit button
Action: Now run the rootupgrade.sh first on the local node. Once it is successful on the local node, then proceed to the remote node.
su -
$ /u01/app/19c/grid/rootupgrade.sh
Output:
The following environment variables are set as:
ORACLE_OWNER= grid
ORACLE_HOME= /u01/app/19c/grid
.........
2023/01/04 13:00:30 CLSRSC-595: Executing upgrade step 18 of 18: 'PostUpgrade'.
2023/01/04 13:00:37 CLSRSC-325: Configure Oracle Grid Infrastructure for a Cluster ... succeeded
We have successfully upgraded the grid to the 19c version.
Step 7: Post-check after upgrading the grid infrastructure
$ crsctl query crs activeversion
Oracle Clusterware active version on the cluster is [19.0.0.0.0]
$ crsctl query crs softwareversion
Oracle Clusterware version on node [dc-vt-testdb1] is [19.0.0.0.0]
$ crsctl query crs activeversion
Oracle Clusterware active version on the cluster is [19.0.0.0.0]
$ crsctl query crs softwareversion
Oracle Clusterware version on node [node2] is [19.0.0.0.0]
$ crsctl check crs
CRS-4638: Oracle High Availability Services is online
CRS-4537: Cluster Ready Services is online
CRS-4529: Cluster Synchronization Services is online
CRS-4533: Event Manager is online
$ crsctl stat res -t -init
$ crsctl stat res -t
a. Upgrade the grid bash profile with a new grid home
# vi .bash_profile
export ORACLE_HOME=/u01/app/19c/grid
execute bash_profile from the grid user
. .bash_profile
Grid upgradation is completed successfully.
Database Upgradation Steps For RAC
Step 1: Create a new 19c oracle database home and provide permission for both nodes
mkdir -p /u01/app/oracle/product/19c/db_1
chown -R oracle:oinstall /u01/app/oracle/product/19c/db_1
chmod -R 775 /u01/app/oracle/product/19c/db_1
Step 2: We download the oracle database 19c software and uploaded zip file into the new 19c home location (one node of RAC)
cd /backup
unzip Oracle_19.3_Linux_x86-64_DB_V982063-01.zip -d /u01/app/oracle/product/19c/db_1
Step 3: Install oracle 19c software only in one node of RAC environment for upgradation
$ ./runInstaller - Install software only 1st node only
Launching Oracle Database Setup Wizard...
Action: Select Set Up Software Only and click the Next button
Action: Insert oracle password to check the ssh connectivity and when it is found okay click the Next button.
Action: Click the Next button
Action: Here carefully check the home location it will be 19c home and click Next
Action: Click Next
Action: Click Install
Action: Execute root.sh script in the local node first once it is completed successfully then run in the second node. When both are executed smoothly click the Next button.
oracle database software-only install is successfully completed.
Step 4: Check the Invalid Objects if there have any invalid objects compile them before the upgrade.
As a prerequisite, it Is recommended to check for invalid objects in the database. In our case,
there are no invalid objects.
$ sqlplus / as sysdba
SQL*Plus: Release 12.2.0.1.0 Production on Thu Jan 5 16:12:57 2023
Copyright (c) 1982, 2016, Oracle. All rights reserved.
Connected to:
Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production
$ SQL> select count(*) from dba_objects where status='INVALID';
COUNT(*)
----------
0
Step 5: Create the required directory where store the upgradation script
mkdir -p /u01/spool/preupgrade -- 1st Node only
chown -R oracle:oinstall /u01/spool/preupgrade
chmod -R 775 /u01/spool/preupgrade
Step 6: Execute the Pre-upgrade script in 1st node only
In the below screenshot, we have executed the preupgrade.jar from the 19c Oracle Home. The
preupgrade.jar output provides pre and post-upgradation recommendation fixup SQL script. The pre
and post-upgradation fixup SQL scripts can be located in the directory location as created above. In the
output, we also get the command to run the pre and post-fixup steps.
/orasoft/app/oracle/product/12c/db_1/jdk/bin/java -jar /orasoft/app/oracle/product/19c/db_1/rdbms/admin/preupgrade.jar FILE DIR /orasoft/spool/preupgrade/
Note: Carefully view the pre-upgrade log and take care of the issues.
Step 7: GATHER DICTIONARY STATS
Before the upgrade process, gather stats. One of the recommendations is to export the stats as well.
sqlplus / as sysdba
SQL> EXECUTE DBMS_STATS.GATHER_DICTIONARY_STATS;
PL/SQL procedure successfully completed.
Step 8: Purge Recycle Bin
Before the upgrade process, empty the recycle bin. SQL> purge dba_recyclebin;
DBA Recyclebin purged.
Step 9: RUN PREUPGRADE FIXUP SQL
SQL> @/orasoft/spool/preupgrade/preupgrade_fixups.sql
Step 10: Verify Archive Destination Size
Ensure you have enough free space in db_recovery_file_dest and make changes to the parameter
db_recovery_file_dest_size if needed increase size.
SQL> archive log list;
SQL> show parameter db_recovery_file_dest
Step 11: Stop Database Listener and Check the Flashback Status
# srvctl stop LISTENER - run from grid user
SQL> select flashback_on from v$database;
FLASHBACK_ON
------------------
NO
Enable flashback database using the following procedure
SQL> ALTER SYSTEM SET DB_RECOVERY_FILE_DEST_SIZE=20G;
SQL> ALTER SYSTEM SET DB_RECOVERY_FILE_DEST='+ORAFLASH';
SQL> alter database flashback on;
Step 12: Create a restore point before the upgrade issue
SQL> create restore point PRE_UPGRADE guarantee flashback database;
NAME
-----------------------------------------------------------------------------------------------
PRE_UPGRADE
Step 13: Oracle database upgrade for RAC environment.
Shutdown database of both nodes, copy spfile/create pfile and password file to new 19c oracle home
COPY [SPFILE/PASSWORD] FILES FROM 12C TO 19C ORACLE HOME create pfile and store it in 19c home
sqlplus / as sysdba
create pfile=’ /u01/app/oracle/product/19c/db_1/dbs/initTESTDB1.ora’ from spfile;
Shutdown database & listener
srvctl stop LISTENER -- from grid user
srvctl stop database -d TESTDB -o immediate -- from oracle user
Step 14: Start database in upgrade from 19c home
vi .bash_profile
export ORACLE_HOME=/u01/app/oracle/product/19c/db_1
$ which sqlplus
/u01/app/oracle/product/19c/db_1/bin/sqlplus
sqlplus / as sysdba
SQL> startup upgrade
SQL> select status from v$instance;
Status
---------------------------------------
OPEN MIGRATE
Now run dbupgrade from 19c home
cd $ORACLE_HOME/bin
$ ./dbupgrade -- 1st node only & 2nd node will be down state
output:
Phases [0-107] End Time: [2023_01_08 17:01:44]
------------------------------------------------------
Grand Total Time: 1910s
LOG FILES: (/u01/app/oracle/product/19c/db_1/cfgtoollogs/TESTDB/upgrade20230108162941/catupgrd*.log)
Upgrade Summary Report Located in:
/u01/app/oracle/product/19c/db_1/cfgtoollogs/TESTDB/upgrade20230108162941/upg_summary.log
Grand Total Upgrade Time: [0d:0h:31m:50s]
Step 15: Post-Upgrade Activities
After the upgrade start the database from 19c home
sqlplus / as sysdba
Step 16: Post upgrade run utlrp.sql to compile an invalid object
cd $ORACLE_HOME/rdbms/admin
SQL> @utlrp.sql
Step 17: Run the post-upgrade script
cd /u01/spool/preupgrade
SQL> @postupgrade_fixups.sql
Step 18: Upgrade timezone
SQL> select version from v$timezone_file;
VERSION
---------------
26
cd $ORACLE_HOME/rdbms/admin
SQL> @utltz_upg_check.sql
When it executed without any error run the below sql script
SQL> @utltz_upg_apply.sql
Now Run the script utlusts.sql
Now run the script catuppst.sql
SQL> @catuppst.sql
Rerun post upgrade fixup sql to check where exit any error or not
SQL> @postupgrade_fixups.sql
Now check the invalid object
SQL> select count(*) from dba_objects where status='INVALID';
COUNT(*)
----------------
0
Upgradation is completed successfully so delete the restore point that created before upgrade
SQL> select name from v$restore_point;
NAME
--------------------------------
PRE_UPGRADE
SQL> drop restore point PRE_UPGRADE;
Set compatible parameter
SQL> show parameter compatible
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
compatible string 12.2.0
SQL> alter system set compatible='19.0.0' scope=spfile sid='*';
VERIFY DBREGISTRY – FINAL CHECK
SQL> col COMP_ID for a10
SQL> col COMP_NAME for a40
SQL> col VERSION for a15
SQL> set lines 200 pages 100
SQL> select COMP_ID,COMP_NAME,VERSION,STATUS from dba_registry;
Now set a new database home for the second node of RAC and startup database for the second node
After completing the migration upgrade oracle home for RAC
Oracle database new home upgradation in oracle RAC infrastructure using the following command
srvctl config database -d TESTDB -- Show the database configuration
su – oracle
cd $ORACLE_HOME/bin
./srvctl upgrade database -d databasename -oraclehome 19c_new_home
Ex: ./srvctl upgrade database -d TESTDB -oraclehome /u01/app/oracle/product/19c/db_1
./srvctl status database -d TESTDB -- Check status of database
./srvctl stop database -d TESTDB -o immediate -- stop database of the cluster
./srvctl start database -d TESTDB -- Start database of cluster
The database has been successfully upgraded to 19c.
SQL> select name, open_mode, version from v$database, v$instance;
NAME OPEN_MODE VERSION
--------- -------------------- -----------------
TESTDB READ WRITE 19.0.0.0.0
Post a Comment
0 Comments