You are on page 1of 2

Chapter ### 12

SQL> create table hr.employees2 as select * from hr.employees;


SQL> alter table hr.employees2 enable row movement; ( allow oracle to if
required any rwo id to changed can do)
SQL> update hr.employees set salary=20000
SQL> update hr.employees2 set salary=20000
SQL> commit;

SQL> select first_name,salary from hr.employees;

SQL> flashback table hr.employees2 to timestamp to_timestamp('17-02-2018


10:22:00','DD-MM-YYYY HH24:MI:SS');

SQL> select first_name,salary from hr.employees;


SQL> select first_name,salary from hr.employees2;
SQL> update employees a
set a.salary=(select b.salary from employees2 b where
a.employee_id=b.employee_id);
SQL> commit;
SQL> update employees2 set salary=0
SQL> Commit;
SQL> flashback table employees2 to timestamp to_timestamp('13-Jul-2017
17:17:00','DD-Mon-YYYY HH24:MI:SS');
SQL> alter table employees2 enable row movement;

SQL> flashback table employees2


to timestamp to_timestamp('13-Jul-2017 17:17:00','DD-Mon-YYYY HH24:MI:SS');

#### Flash Back Database:

* flashback mode must be on (Flashback Logs(all changes copy to flashback


logs from redo logs)

SQL> shutdown immediate;


SQL> startup mount
SQL> alter system set db_flashback_retention_target = 2880;
SQL> alter database flashback on;
SQL> alter database open;
SQL> select name,flashback_on from v$database (you can check status of database)

SQL > create table hr.test24 as select * from hr.employees;

SQL> drop table hr.test24;


SQL> shutdown abort;
SQL> startup mount

SQL> flashback database to timestamp to_timestamp('19-02-2019 20:25:00','DD-MM-


YYYY HH24:MI:SS');
SQL> alter database open read only;
sQL > select * from hr.test24;(verify your required stage)

SQL> shutdown abort;


SQL> startup mount;
SQL> alter database open resetlogs; 1495341877
Note: flashback recovery only for logical curreption not for phiysical

############ Creating Normal and Guaranteed Restore Points


######### To create a restore point:
SQLPLUS
SQL> CREATE RESTORE POINT before_upgrade2;
(normal restore point)
SQL> CREATE RESTORE POINT before_upgrade GUARANTEE
FLASHBACK DATABASE; ( create a guaranteed restore point)
############ Listing Restore Points

RMAN > LIST RESTORE POINT before_upgrade;


RMAN > LIST RESTORE POINT ALL;

########## list of all currently defined restore points

SQL> SELECT NAME, SCN, TIME,


DATABASE_INCARNATION#,GUARANTEE_FLASHBACK_DATABASE,STORAGE_SIZE FROM
V$RESTORE_POINT;

########## Dropping Restore Points

SQL> DROP RESTORE POINT before_app_upgrade;

You might also like