6 2 Flashback Database and Restore Points
6 2 Flashback Database and Restore Points
SQL> startup
############################################
$ sqlplus mytest/test_123@pdb1
SQL> commit;
--alternative
SQL> select * from (select name from test_tab1 where id=1)
as of timestamp to_date(just_before_update_time,dd.mm.yyyy hh24:mi:ss);
SQL> commit;
-- Activate Flashback
#######OPTIONS##########
--set the length of the desired flashback window in minutes(3 days for this
command)
SQL> alter system set DB_FLASHBACK_RETENTION_TARGET=4320 scope=both;
########################
--Flashback Table
$ sqlplus mytest/test_123@pdb1
--Flashback Database
¤t_scn& :
--connect pdb1
$ sqlplus mytest/test_123@pdb1
--Restore Points
#######OPTIONS##########
--create a clean PDB restore point. If a clean restore point cannot be created,
then an error is returned.
SQL> create clean restore point crp_pdb1;
########################
$ sqlplus / as sysdba
--close PDB1
SQL> alter pluggable database pdb1 close;
--create a clean PDB restore point (when the PDB is closed and has no pending
transactions). If the restore point cannot be created, then an error is displayed.
SQL> create clean restore point crp_pdb_from_cdb for pluggable database pdb1;
--connect CDB
$ sqlplus / as sysdba
SQL> shutdown immediate;