FLASHBACK RAC DATABASE WITHOUT STANDBY DATABASE


RAC Database -> Flashback to Different Restore Points

Precheck
=============
SQL>  select name,time from v$restore_point;
NAME                                               TIME
---------------------------------------------------------------------------
BEFORE_UPGRADE                21-FEB-18 04.37.05.000000000 PM

Flashback is off with guarantee flashback database

SQL> select log_mode,flashback_on from v$database;

LOG_MODE                             FLASHBACK_ON
------------------------------------ ------------------------------------------------------
ARCHIVELOG                           RESTORE POINT ONLY

I am going to create a restore point before changing further  

Create a restore point RP02
========================
SQL> create restore point RP02 guarantee flashback database;
Restore point created.

Doing some change to the database [Create a table test03 – After RP02 and before RP03]

SQL> create table test03 (col1 number) tablespace users;
Table created.

SQL> insert into test03 values ('03');
1 row created.

SQL> commit;
Commit complete.

Create another restore point RP03
==============================
SQL> create restore point RP03 guarantee flashback database;
Restore point created.

[Create a table test04 – After RP03 ]

SQL>  create table test04 (col1 number) tablespace users;
Table created.

SQL>  insert into test03 values ('04');
1 row created.

SQL> commit;  
Commit complete.


Stop both instance s and start only one instance in mount mode

oracle@racdb01:DMON11:/software/12cUPGRADE/DMON1
$ srvctl status database -d DMON1_01
Instance DMON11 is running on node racdb01
Instance DMON12 is running on node racdb02
oracle@racdb01:DMON11:/software/12cUPGRADE/DMON1
$ srvctl stop database -d DMON1_01
oracle@racdb01:DMON11:/software/12cUPGRADE/DMON1
$ srvctl start instance -i DMON11 -d DMON1_01 -o mount
oracle@racdb01:DMON11:/software/12cUPGRADE/DMON1

Connect using sqlplus and flashback database to restore point RP03
$ sq

SQL*Plus: Release 12.2.0.1.0 Production on Wed Feb 21 18:59:41 2018

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 instance_name,status from gv$instance;

INSTANCE_NAME            STATUS
------------------------------------
DMON11          MOUNTED

Do flashback
SQL> flashback database to restore point RP03;

Flashback complete.

SQL> alter database open resetlogs;

Database altered.

SQL> host
aliases:+ASM1 DMON11



Start database using srvctl

oracle@racdb01:DMON11:/software/12cUPGRADE/DMON1
$ srvctl stop database -d DMON1_01
oracle@racdb01:DMON11:/software/12cUPGRADE/DMON1
$ srvctl start database -d DMON1_01
oracle@racdb01:DMON11:/software/12cUPGRADE/DMON1

Connect using sqlplus and flashback database to restore point RP02

$ sq

SQL*Plus: Release 12.2.0.1.0 Production on Wed Feb 21 19:03:20 2018

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 test03;

  COUNT(*)
----------
         1
SQL> select count(*) from test04;
select count(*) from test04
                     *
ERROR at line 1:
ORA-00942: table or view does not exist

So correct – there were test03 table exist but not test04.

NOW Going to flashback to restore point RP02 before table test02 creation

Stop both instance s and start only one instance in mount mode

$ srvctl stop database -d DMON1_01
oracle@racdb01:DMON11:/software/12cUPGRADE/DMON1
$  srvctl start instance -i DMON11 -d DMON1_01 -o mount
oracle@racdb01:DMON11:/software/12cUPGRADE/DMON1
$ sq
SQL*Plus: Release 12.2.0.1.0 Production on Wed Feb 21 19:06:01 2018

SQL> select instance_name,status from gv$instance;

INSTANCE_NAME                                    STATUS
------------------------------------------------ ------------------------------------
DMON11                                           MOUNTED

SQL> flashback database to restore point RP02;

Flashback complete.
SQL>  alter database open resetlogs;

Database altered.
SQL> select count(*) from test03;
select count(*) from test03
                     *
ERROR at line 1:
ORA-00942: table or view does not exist

So restore to different restore point is fine.

$ srvctl stop database -d DMON1_01
oracle@racdb01:DMON11:/software/12cUPGRADE/DMON1
$ srvctl start database -d DMON1_01
oracle@racdb01:DMON11:/software/12cUPGRADE/DMON1
$ srvctl status database -d DMON1_01
Instance DMON11 is running on node racdb01
Instance DMON12 is running on node racdb02

SQL>  select name,time from v$restore_point;

NAME                                                                    TIME
---------------------------------------------------------------------------
BEFORE_UPGRADE                                    21-FEB-18 04.37.05.000000000 PM
RP02                                                          21-FEB-18 06.53.32.000000000 PM
RP03                                                          21-FEB-18 06.55.37.000000000 PM


Dropping Restore points
SQL> drop restore point RP03 ;
Restore point dropped.

SQL> drop restore point RP02;
Restore point dropped.


Comments

Popular posts from this blog

Oracle DataGuard – How to resize Redo Log and Standby Redo Log

Exadata - Smart Scan Testing

Exadata Flash Cache - Management