This note illustrates how we can perform a rolling upgrade from Oracle 11g Release 1 to Oracle 11g Release 2 using a Transient Logical Standby database. This approach will miminise the downtime required for an upgrade which can potentially run into several hours down to just the time required to perform a switchover which could be a few minutes in most cases.
A rolling upgrade using a Transient Logical Standby database at a very high level will involve three main stages or steps:
1) Temporarily convert a physical standby database to a logical standby database using the new KEEP IDENTITY clause
2) Perform a database upgrade of the logical standby database
3) Return the logical standby database back to its identity or original status as a physical standby database once the upgrade is complete
The assumption here is that ….
1)We already have configured a Physical Standby Database using Data Guard best practices and both Primary and Standby databases are in sync and Redo Transport and Redo Apply are working properly.
2)Data Guard Broker if configured is disabled
3) Standby database is operating in Maximum Availability or Maximum Protection mode
4) Flashback Database is enabled
Steps
Create a Guaranteed Restore Point on original PrimarySQL> create restore point pre_upgrade_1 guarantee flashback database; Restore point created.
Create a guaranteed restore point on original Standby database
Create the Log Miner dictionary on the original primary database
SQL> exec dbms_logstdby.build; PL/SQL procedure successfully completed.
Convert the original physical standby database to logical standby database
Start SQL Apply on the new logical standby database and monitor the dictionary build
Prepare the Logical Standby database for upgrade
Peform the upgrade of the Logical Standby database to 11g Release 2 using DBUA or by using the manual steps.
While the upgrade is in progress, users are still connected to the original 11g Release 1 primary database. Let us make some DDL as well as DML changes on this database.SQL> conn sh/sh Connected. SQL> update customers set cust_city='Perth'; 55500 rows updated. SQL> commit; Commit complete. SQL> create table mycustomers as select * from customers; Table created. SQL> update mycustomers set cust_city='New York'; 55500 rows updated. SQL> commit; Commit complete.
After the upgrade is complete, we will now start SQL Apply on the upgraded Logical Standby database
On Origial Primary SQL> alter system set log_archive_dest_state_2=enable scope=memory; System altered. On Upgraded Logical Standby database SQL> alter database start logical standby apply immediate;
Perform a Switchover to the Upgraded 11g Release 2 standby database on Original Primary SQL>
Perform some checks
Make some changes on the upgraded 11g Release 2 databaseSQL> conn sh/sh Connected. SQL> update mycustomers set cust_city='Tokyo'; 55500 rows updated. SQL> update customers set cust_city='Hong Kong'; 55500 rows updated. SQL> commit; Commit complete.
Re-transformation into Physical Standby database
Start the new logical standby database in the 11g Release 2 Oracle Home and convert it to a physical standby database.
dba1:/u01/oracle/product/11.2/dbs> cp /u02/oradata/product/dbs/orapwdba1 .
dba1:/u01/oracle/product/11.2/dbs> cp /u02/oradata/product/dbs/spfiledba1.ora .SQL> startup mount ORACLE instance started. Total System Global Area 521936896 bytes Fixed Size 2208368 bytes Variable Size 159387024 bytes Database Buffers 352321536 bytes Redo Buffers 8019968 bytes Database mounted. SQL> alter database convert to physical standby; Database altered. SQL> shutdown immediate; ORA-01507: database not mounted ORACLE instance shut down. SQL> startup mount ORACLE instance started. Total System Global Area 521936896 bytes Fixed Size 2208368 bytes Variable Size 159387024 bytes Database Buffers 352321536 bytes Redo Buffers 8019968 bytes Database mounted.
At this stage we will get an error if we try and open the database as the database is of a lower version and has not been upgraded as yet.SQL> alter database open; alter database open * ERROR at line 1: ORA-01092: ORACLE instance terminated. Disconnection forced ORA-00704: bootstrap process failure ORA-39700: database must be opened with UPGRADE option Process ID: 393392 Session ID: 191 Serial number: 3
Start Redo Apply on the converted physical databaseOn New Primary SQL>
Monitor Redo Apply
Then we will see …..RFS[1]: Identified database type as 'physical standby': Client is LGWR SYNC pid 1134740 Primary database is in MAXIMUM AVAILABILITY mode Changing standby controlfile to RESYNCHRONIZATION level Standby controlfile consistent with primary RFS[1]: Selected log 4 for thread 1 sequence 111 dbid 2023850869 branch 713959355 Fri Mar 19 10:39:12 2010 RFS[2]: Assigned to RFS process 1736934 RFS[2]: Identified database type as 'physical standby': Client is ARCH pid 1990894 RFS[2]: Selected log 5 for thread 1 sequence 110 dbid 2023850869 branch 713959355 RFS[2]: New Archival REDO Branch(resetlogs_id): 713959355 Prior: 713439030 RFS[2]: Archival Activation ID: 0x78aa01e2 Current: 0x0 RFS[2]: Effect of primary database OPEN RESETLOGS RFS[2]: Managed Standby Recovery process is active RFS[2]: Incarnation entry added for Branch(resetlogs_id): 713959355 (dba1) Fri Mar 19 10:39:13 2010 Setting recovery target incarnation to 3
Then we will see the the media recovery in progress. This will apply all the redo which contains the changes related to the upgrade of the database to 11g Release 2, so that once the media recovery is complete, we will see that the physical standby database has indeed been upgraded to 11g Release 2.Fri Mar 19 11:01:06 2010 Managed Standby Recovery starting Real Time Apply Parallel Media Recovery started with 4 slaves RFS[3]: Identified database type as 'physical standby': Client is ARCH pid 1990894 Fri Mar 19 11:01:22 2010 RFS[4]: Assigned to RFS process 1835206 RFS[4]: Identified database type as 'physical standby': Client is ARCH pid 794694 RFS[3]: Opened log for thread 1 sequence 7 dbid 2023850869 branch 713959355 RFS[4]: Opened log for thread 1 sequence 8 dbid 2023850869 branch 713959355 Archived Log entry 79 added for thread 1 sequence 7 rlc 713959355 ID 0x78aa01e2 dest 2: Archived Log entry 80 added for thread 1 sequence 8 rlc 713959355 ID 0x78aa01e2 dest 2: ...... ...... RFS[44]: Assigned to RFS process 561242 RFS[44]: Identified database type as 'physical standby': Client is ARCH pid 794694 RFS[44]: Opened log for thread 1 sequence 99 dbid 2023850869 branch 713959355 Archived Log entry 119 added for thread 1 sequence 99 rlc 713959355 ID 0x78aa01e2 dest 2: Archived Log entry 120 added for thread 1 sequence 97 rlc 713959355 ID 0x78aa01e2 dest 2: RFS[44]: Opened log for thread 1 sequence 100 dbid 2023850869 branch 713959355 Archived Log entry 121 added for thread 1 sequence 100 rlc 713959355 ID 0x78aa01e2 dest 2: ...... ...... Media Recovery Log /u02/oradata/dba1/arch/arch1_10_713959355.log Fri Mar 19 11:42:53 2010 Media Recovery Log /u02/oradata/dba1/arch/arch1_11_713959355.log Media Recovery Log /u02/oradata/dba1/arch/arch1_12_713959355.log Fri Mar 19 11:43:09 2010 Media Recovery Log /u02/oradata/dba1/arch/arch1_13_713959355.log Media Recovery Log /u02/oradata/dba1/arch/arch1_14_713959355.log ...... ...... Media Recovery Log /u02/oradata/dba1/arch/arch1_24_713959355.log Media Recovery Log /u02/oradata/dba1/arch/arch1_25_713959355.log Fri Mar 19 11:45:02 2010 Media Recovery Log /u02/oradata/dba1/arch/arch1_26_713959355.log Media Recovery Log /u02/oradata/dba1/arch/arch1_27_713959355.log Fri Mar 19 11:45:19 2010 Media Recovery Log /u02/oradata/dba1/arch/arch1_28_713959355.log ..... ..... Media Recovery Log /u02/oradata/dba1/arch/arch1_104_713959355.log Media Recovery Log /u02/oradata/dba1/arch/arch1_105_713959355.log Media Recovery Log /u02/oradata/dba1/arch/arch1_106_713959355.log Media Recovery Log /u02/oradata/dba1/arch/arch1_107_713959355.log Media Recovery Log /u02/oradata/dba1/arch/arch1_108_713959355.log Media Recovery Log /u02/oradata/dba1/arch/arch1_109_713959355.log Media Recovery Log /u02/oradata/dba1/arch/arch1_110_713959355.log Fri Mar 19 13:19:50 2010 Media Recovery Log /u02/oradata/dba1/arch/arch1_111_713959355.log Media Recovery Log /u02/oradata/dba1/arch/arch1_112_713959355.log Media Recovery Log /u02/oradata/dba1/arch/arch1_113_713959355.log Media Recovery Log /u02/oradata/dba1/arch/arch1_114_713959355.log Media Recovery Waiting for thread 1 sequence 115 (in transit) Recovery of Online Redo Log: Thread 1 Group 6 Seq 115 Reading mem 0 Mem# 0: /u02/oradata/dba1/flash_recovery_area/DBA1/onlinelog/o1_mf_6_5sm961z3_.log
SQL> @?/rdbms/admin/utlu112s.sql . Oracle Database 11.2 Post-Upgrade Status Tool 03-19-2010 13:28:43 . Component Status Version HH:MM:SS . Oracle Server . VALID 11.2.0.1.0 00:44:46 JServer JAVA Virtual Machine . VALID 11.2.0.1.0 00:10:56 Oracle Workspace Manager . VALID 11.2.0.1.0 00:01:28 OLAP Analytic Workspace . VALID 11.2.0.1.0 00:01:18 OLAP Catalog . VALID 11.2.0.1.0 00:02:36 Oracle OLAP API . VALID 11.2.0.1.0 00:01:28 Oracle Enterprise Manager . VALID 11.2.0.1.0 00:38:10 Oracle XDK . VALID 11.2.0.1.0 00:01:31 Oracle Text . VALID 11.2.0.1.0 00:01:22 Oracle XML Database . VALID 11.2.0.1.0 00:06:22 Oracle Database Java Packages . VALID 11.2.0.1.0 00:01:13 Oracle Multimedia . VALID 11.2.0.1.0 00:15:21 Spatial . VALID 11.2.0.1.0 00:09:56 Oracle Expression Filter . VALID 11.2.0.1.0 00:00:31 Oracle Rules Manager . VALID 11.2.0.1.0 00:00:24 Oracle Application Express . VALID 3.2.1.00.10 00:26:39 Gathering Statistics . 00:17:09 Total Upgrade Time: 03:02:12
No comments:
Post a Comment