Sunday, October 11, 2020

Flashback restore point

Step1:Startup database and Create Table 

[oracle@trichy ~]$ sqlplus / as sysdba

 SQL*Plus: Release 12.2.0.1.0 Production on Sun Oct 11 22:41:53 2020

 Copyright (c) 1982, 2016, Oracle.  All rights reserved.

 Connected to an idle instance.

 SQL> startup

ORACLE instance started.

 Total System Global Area 2046820352 bytes

Fixed Size     8622480 bytes

Variable Size   587206256 bytes

Database Buffers  1442840576 bytes

Redo Buffers     8151040 bytes

Database mounted.

Database opened.

SQL> create table product(id int,name varchar2(20));

 Table created.

 SQL> insert into product values(111,'inba');

 1 row created.

 SQL> insert into product values(222,'siva');

 1 row created.

 SQL> insert into product values(333,'shan');

 1 row created.

 SQL> commit;

 Commit complete.

 SQL> select * from product;

 ID NAME

---------- --------------------

       111 inba

       222 siva

       333 shan

 Step2:To create Restore point

 SQL> desc V$RESTORE_POINT;

 Name    Null?    Type

 ----------------------------------------- -------- ----------------------------

 SCN     NUMBER

 DATABASE_INCARNATION#     NUMBER

 GUARANTEE_FLASHBACK_DATABASE     VARCHAR2(3)

 STORAGE_SIZE     NUMBER

 TIME     TIMESTAMP(9)

 RESTORE_POINT_TIME     TIMESTAMP(9)

 PRESERVED     VARCHAR2(3)

 NAME     VARCHAR2(128)

 PDB_RESTORE_POINT     VARCHAR2(3)

 CLEAN_PDB_RESTORE_POINT     VARCHAR2(3)

 PDB_INCARNATION#     NUMBER

 CON_ID

 SQL> create restore point  respt_inba  guarantee flashback database;

 Restore point created.

 Step3:To drop the Table

 SQL> drop table product purge;

 Table dropped.

 SQL> select * from product;

select * from product

              *

ERROR at line 1:

ORA-00942: table or view does not exist

 SQL> shut immediate

Database closed.

Database dismounted.

ORACLE instance shut down.

SQL>

Step4:To recover the table using restore point

 SQL> startup mount

ORACLE instance started.

 Total System Global Area 2046820352 bytes

Fixed Size     8622480 bytes

Variable Size   587206256 bytes

Database Buffers  1442840576 bytes

Redo Buffers     8151040 bytes

Database mounted.

SQL> flashback database to restore point respt_inba;

 Flashback complete.

 SQL> alter database open resetlogs;

 Database altered.

 SQL> select * from product;

 ID NAME

---------- --------------------

       111 inba

       222 siva

       333 shan

 Screen shots

                                                               





 

 

 

 

No comments:

Post a Comment

ASM

Rename Asm DiskGroup Name On Oracle 12c

  Step1:Startup asm with created asm pfile. startup pfile=$ORACLE_HOME/dbs/init+ASM.ora; Step2:Dismount all disks.  alter diskgroup all dism...