But what if you have Standard Edition database:
SQL> shutdown immediate; SQL> startup mount; SQL> alter database flashback on; alter database flashback on * ERROR at line 1: ORA-00439: feature not enabled: Flashback Database
In Standard Edition you don’t have Flashback Database feature, but you can still create restore points and perform incomplete recoveries to restore point.
Create test table and insert status row.
SQL> create table admin.test_restore (datum date, komentar varchar2(100)); Table created. SQL> insert into admin.test_restore values (sysdate, 'Before Restore Point'); 1 row created. SQL> commit; Commit complete.
Create restore point here.
SQL> create restore point RP_UPGRADE; Restore point created. SQL> select scn, to_char(time,'dd.mm.yyyy hh24:mi:ss') time, name 2 from v$restore_point; SCN TIME NAME ---------- ------------------- --------------------- 580752 27.02.2015 10:31:19 RP_UPGRADE
Notice how name of restore point is associated with SCN of the database.
Now you can perform potentially dangerous operations like database upgrades, table modifications, truncating data and like.
I will enter some status data for later checks.
SQL> insert into admin.test_restore values (sysdate, 'After Restore Point'); 1 row created. SQL> insert into admin.test_restore values (sysdate, 'Upgrade actions performed'); 1 row created. SQL> commit; Commit complete.
Check table.
SQL> alter session set nls_date_format='dd.mm.yyyy hh24:mi:ss'; Session altered. SQL> select datum, komentar from admin.test_restore order by datum; DATUM KOMENTAR ------------------- ------------------------------ 27.02.2015 10:30:39 Before Restore Point 27.02.2015 10:31:45 After Restore Point 27.02.2015 10:31:55 Upgrade actions performed
Suppose we had some problems and want to "rewind" database to restore point. In EE we would perform flashback database to restore point but in SE we will use different approach.
Shutdown database and startup mount.
RMAN> shutdown immediate; using target database control file instead of recovery catalog database closed database dismounted Oracle instance shut down RMAN> startup mount; connected to target database (not started) Oracle instance started database mounted Total System Global Area 471830528 bytes Fixed Size 2254344 bytes Variable Size 247466488 bytes Database Buffers 213909504 bytes Redo Buffers 8200192 bytes
Restore and recover database until restore point RP_UPGRADE.
RMAN> restore database until restore point RP_UPGRADE; Starting restore at 27.02.2015 10:36:26 allocated channel: ORA_DISK_1 channel ORA_DISK_1: SID=247 device type=DISK channel ORA_DISK_1: starting datafile backup set restore channel ORA_DISK_1: specifying datafile(s) to restore from backup set channel ORA_DISK_1: restoring datafile 00001 to +DATA1/ora11gr2/datafile/system.291.872722799 channel ORA_DISK_1: restoring datafile 00002 to +DATA1/ora11gr2/datafile/sysaux.292.872722847 channel ORA_DISK_1: restoring datafile 00003 to +DATA1/ora11gr2/datafile/undotbs1.278.872722879 channel ORA_DISK_1: restoring datafile 00004 to +DATA1/ora11gr2/datafile/users.296.872722925 channel ORA_DISK_1: reading from backup piece +FRA1/ora11gr2/backupset/2015_02_27/nnndf0_tag20150227t102559_0.1164.872763961 channel ORA_DISK_1: piece handle=+FRA1/ora11gr2/backupset/2015_02_27/nnndf0_tag20150227t102559_0.1164.872763961 tag=TAG20150227T102559 channel ORA_DISK_1: restored backup piece 1 channel ORA_DISK_1: restore complete, elapsed time: 00:01:35 Finished restore at 27.02.2015 10:38:02 RMAN> recover database until restore point RP_UPGRADE; Starting recover at 27.02.2015 10:38:45 using channel ORA_DISK_1 starting media recovery media recovery complete, elapsed time: 00:00:01 Finished recover at 27.02.2015 10:38:49
Open database with resetlogs option.
RMAN> sql 'alter database open resetlogs'; sql statement: alter database open resetlogs
Final check.
SQL> alter session set nls_date_format='dd.mm.yyyy hh24:mi:ss'; Session altered. SQL> select datum, komentar 2 from admin.test_restore 3 order by datum; DATUM KOMENTAR ------------------- -------------------------------------------------- 27.02.2015 10:30:39 Before Restore Point
We "rewound" database to state that existed before RP_UPGRADE restore point is created.
This was incomplete recovery and RP_UPGRADE restore point was used just to mark location in time.
There is a way how to fix that with the normal flashback database http://blog.dba.bg/index.php/kkovachki/resolved-oracle-standard-edition-11#more134
ReplyDeleteNice trick Krasimir using EE home to flashback database and creating RP to enable creation of flashback logs ;)
ReplyDeleteThanks for sharing.
btw
Have you used this trick for any production database?
Followed the same steps and seeing this error when trying to restored for all the data files. any suggestions?
ReplyDeleterestore database until restore point TEST_UPGRADE;
RMAN>
Starting restore at 06-MAR-17
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=2 device type=DISK
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of restore command at 03/06/2017 11:04:14
RMAN-06026: some targets not found - aborting restore
RMAN-06023: no backup or copy of datafile 49 found to restore
RMAN-06023: no backup or copy of datafile 48 found to restore
Hello,
ReplyDeletedo you have backup of your database created prior restore point?
You cannot rewind database using flashback logs on SE edition.
Regards,
Marko