Stay at Home!! Be Safe!! Take Care!!

Thanks all my viewers for your support, I am an Oracle Ace now. For Any queries, please mail us at support@funoracleapps.com

Downgrading Oracle Database Without Executing catdwgrd.sql or Backup plan to downgrade oracle db

No comments

Downgrading Oracle Database Without Executing catdwgrd.sql or Backup plan to downgrade


When we are upgrading the database, we need to ensure that we have a backup plan to downgrade in case of failure. We can create a guaranteed  restore point.

My Source version: 10.2.0.4
Target version to upgrade 11.2.0.3

Configure Flashback database in the Source version

The Flashback Database feature provides a way to quickly revert entire Oracle database to the state it was in at a past point in time.

To use the Flashback database feature the database must be running in archivelog mode.

Enable flashback feature in the database when it was running in the source release.

Set the environment variables to point to the source Oracle Home (10.2.0.4) and perform a 'startup mount'

SQL> startup mount
ORACLE instance started.

Total System Global Area  918552576 bytes
Fixed Size                  2025072 bytes
Variable Size             239077776 bytes
Database Buffers          675282944 bytes
Redo Buffers                2166784 bytes
Database mounted.

Turn on flashback

SQL> alter database flashback on;

Database altered

Create guaranteed restore point

SQL> CREATE RESTORE POINT before_upgrade GUARANTEE FLASHBACK DATABASE;

Restore point created.

Run the following query to view all guaranteed restore points created.

SQL> SELECT NAME, SCN, TIME, DATABASE_INCARNATION# DI,GUARANTEE_FLASHBACK_DATABASE,
     STORAGE_SIZE FROM V$RESTORE_POINT WHERE GUARANTEE_FLASHBACK_DATABASE='YES';

NAME             SCN     TIME                 DI         GUA     STORAGE_SIZE
----------       --- ------------       -------------    ---    ------------
BEFORE_UPGRADE  34552155 23-JUN-20  10.58.42.000000000 AM  YES    312672256

Query the dba_registry view to see the component status and version before upgrade

SQL> select comp_name, status, version from dba_registry;

COMP_NAME
--------------------------------------------------------------------------------
STATUS      VERSION
----------- ------------------------------
Oracle Database Catalog Views
VALID       10.2.0.4.0

Oracle Database Packages and Types
VALID       10.2.0.4.0


Shutdown the database

SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
 

Upgrade the database to the target version(Dont change compatibility parameter to higher version while upgrade)

Set the environment variables to point to the target Oracle Home (11.2.0.4) to which the database will be upgraded to.

compatible-10.2.0.4

Please note that changing COMPATIBLE initialization parameter at this stage will prevent use of the downgrade procedure or the ability to flash back the database to a point prior to this.

Startup the database in upgrade mode using the 11.2.0.4 Oracle Home

SQL> startup upgrade (using 11.2.0.4 Oracle Home)
ORACLE instance started.

Total System Global Area  918552576 bytes
Fixed Size                  2077008 bytes
Variable Size             234884784 bytes
Database Buffers          675282944 bytes
Redo Buffers                6307840 bytes
Database mounted.
Database opened.

Run the upgrade script (catupgrd.sql)

SQL> @?/rdbms/admin/catupgrd.sql


Validate any invalid objects after upgrade if any

SQL> @?/rdbms/admin/utlrp.sql

Query the dba_registry view to see the component status and version after upgrade

SQL> select comp_name, version, status from dba_registry;

COMP_NAME
--------------------------------------------------------------------------------
VERSION STATUS
------------------------------ -----------
Oracle Database Catalog Views
11.2.0.4.0 VALID

Oracle Database Packages and Types
11.2.0.4.0 VALID
 

Downgrading database to previous version using Flashback database

Note that data from any transactions that occur after the point in time to which the database is recovered are lost. Flashback Database is an excellent tool for backing out the database upgrade, Using Flashback Database with sufficient space and creating a guaranteed restore point immediately prior to the upgrade is the fastest method to fallback as compared to a restore operation or a database downgrade.

Using flashback database rather than the conventional downgrade procedure is far quicker. This is only practical when only the database upgrade has been done and no application data changes have occurred.

The steps for flashing back the database after upgrade or after a failed upgrade are

Set the environment variables to the 11.2.0.4 Oracle Home

Shut down the upgraded database

SQL> shutdown immediate

Startup mount the 11.2.0.4 database using the 11.2.0.4 Oracle Home and flashback the database to the guaranteed restore point which was created prior to the upgrade.

SQL> startup mount

SQL> flashback database to restore point before_upgrade;

SQL> shutdown immediate

Set the environment variable to point to the old Oracle Home (10.2.0.4)

SQL> startup mount

SQL> alter database open resetlogs;

query the dba_registry view to see the database component status and version

SQL> select comp_name, version, status from dba_registry;

COMP_NAME
--------------------------------------------------------------------------------
VERSION STATUS
------------------------------ -----------
Oracle Database Catalog Views
10.2.0.4.0 VALID

Oracle Database Packages and Types
10.2.0.4.0 VALID



No comments :

Post a Comment