This time I want to tell something about Oracle database upgrades and what to do if something goes wrong during the upgrade. In that case the database needs to be reset to the time before the upgrade started. The Database Upgrade Assistant and also the Autoupgrade Tool can create a guaranteed restore point for that. That means, even with Flashback Database not enabled, the database will generate flashback logs beginning with the creation of that restore point. These flashback logs will get deleted only when the guaranteed restore point is dropped. For Standard Edition 2, Autoupgrade does not create a restore point and there is a reason for that. I tried that before doing a manual upgrade and these are my results.
First, I checked the database and created a guaranteed restore point.
[oracle@vm123 ~]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.4.0 Production on Wed Feb 10 08:08:16 2021
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Release 11.2.0.4.0 - 64bit Production
SQL> col name format a60
SQL> set lines 200
SQL> select flashback_on from v$database;
FLASHBACK_ON
------------------------------------------------------
NO
SQL> create restore point upgrade_db guarantee flashback database;
Restore point created.
SQL> select flashback_on from v$database;
FLASHBACK_ON
------------------------------------------------------
RESTORE POINT ONLY
SQL> select * from v$flashback_database_logfile;
NAME LOG# THREAD# SEQUENCE# BYTES FIRST_CHANGE# FIRST_TIME TYPE
------------------------------------------------------------ ---------- ---------- ---------- ---------- ------------- ------------------- ---------------------------
/u01/app/oracle/fra/ORCL112B/flashback/o1_mf_j271mq1h_.flb 1 1 1 1073741824 46358813 2021-02-10 08:08:44 NORMAL
/u01/app/oracle/fra/ORCL112B/flashback/o1_mf_j271mzof_.flb 2 1 1 1073741824 0 RESERVED
SQL> select NAME, TIME, GUARANTEE_FLASHBACK_DATABASE, PRESERVED from v$restore_point;
NAME TIME GUARANTEE PRESERVED
------------------------------------------------------------ --------------------------------------------------------------------------- --------- ---------
UPGRADE_DB 10.02.21 08:08:38,000000000 YES YES
You see, even in Standard Edition I can create a restore point and V$DATBASE reflects this and tells us, that Flashback is enabled just for the guaranteed restore point. Also we have some flashback logs being created to hold the data neccessary for doing the flashback. So everything looks fine at this point.
But what will happen, when I try to rewind my database to that restore point? Let’s have a look.
[oracle@vm123 ~]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.4.0 Production on Wed Feb 10 08:16:00 2021
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Release 11.2.0.4.0 - 64bit Production
SQL> select NAME, TIME, GUARANTEE_FLASHBACK_DATABASE, PRESERVED from v$restore_point;
NAME TIME GUARANTEE PRESERVED
------------- ------------------------------ --------- ---------
UPGRADE_DB 10.02.21 08:08:38,000000000 YES YES
SQL> select flashback_on from v$database;
FLASHBACK_ON
------------------------------------------------------
RESTORE POINT ONLY
SQL> select status from v$instance;
STATUS
------------------------------------
MOUNTED
SQL> flashback database to restore point upgrade_db;
flashback database to restore point upgrade_db
*
ERROR at line 1:
ORA-00439: feature not enabled: Flashback Database
So even if we have everything in place to do the Flashback operation, the database denies that. And that is, because Flashback Database is an Enterprise Edition feature. The fact, that we can easily create a guaranteed restore point in a Standard Edition database is a little misleading, be aware of that. In my opinion it would be better to get the error message right when creating such a restore point like when we try to enable Flashback Database in general.
SQL> alter database flashback on;
alter database flashback on
*
ERROR at line 1:
ORA-00439: feature not enabled: Flashback Database
In case you have a single strategy for upgrading your databases and have both Enterprise and Standard Edition in place, do not rely on the successful creation of a restore point as your fallback. Do differentiate between both Editions and choose your backup wisely.