FLASHBACK DATABASE – RESTORE POINT

FRA=> /u01/disk/clonetst/FRA
shut immediate;
 startup mount;
alter system set db_recovery_file_dest='/u01/disk/clonetst/FRA' SCOPE=both;
 alter system set db_recovery_file_dest_size=10G SCOPE=both;
 alter database archivelog; --- IF NOT IN ARCHIVE MODE
 alter database flashback on;
alter database open;
alter system set db_flashback_retention_target=2880; --- NEED CHOOSE THE BEST OPTION FOR YOUR ENVIRONMENT
clonetst > select flashback_on from v$database;
FLASHBACK_ON
 ------------------
 YES
clonetst > select * from v$restore_point;
no rows selected
-- Test Data
create table cmagno.teste_flashback
 (num number,
 sys_date date,
 info varchar2(1000));
clonetst > create restore point BEFORE_INSERT_DATA guarantee flashback database;
Restore point created.
1* select * from v$restore_point
 SYS @ clonetst > /
SCN DATABASE_INCARNATION# GUA         STORAGE_SIZE TIME                           RESTORE_POINT_TIME   PRE NAME
 -------------------- --------------------- --- -------------------- ------------------------------ -------------------- --- ------------------------------
 47103817886                     2 YES             52428800 15/02/16 16:57:01,000000000                         YES BEFORE_INSERT_DATA
insert into cmagno.teste_flashback values (1,sysdate,'LINE 1 AFTER RESTORE POINT');
 insert into cmagno.teste_flashback values (2,sysdate,'LINE 2 AFTER RESTORE POINT');
 insert into cmagno.teste_flashback values (3,sysdate,'LINE 3 AFTER RESTORE POINT');
 COMMIT;
clonetst > SELECT * FROM cmagno.teste_flashback;
NUM SYS_DATE INFO
 ---------- -------- --------------------------------------------------
 1 15/02/16 LINE 1 AFTER RESTORE POINT
 2 15/02/16 LINE 2 AFTER RESTORE POINT
 3 15/02/16 LINE 3 AFTER RESTORE POINT
SYS @ clonetst > SHUT IMMEDIATE
 Database closed.
 Database dismounted.
 ORACLE instance shut down.
 SYS @ clonetst > startup mount;
 ORACLE instance started.
Total System Global Area  588746752 bytes
 Fixed Size                  2255472 bytes
 Variable Size             369100176 bytes
 Database Buffers          209715200 bytes
 Redo Buffers                7675904 bytes
 Database mounted.
SYS @ clonetst > flashback database to restore point BEFORE_INSERT_DATA;
Flashback complete.
SYS @ clonetst > alter database open resetlogs;
Database altered.
SYS @ clonetst > SELECT * FROM cmagno.teste_flashback;
no rows selected
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s