Oracle Flashback Database and Restore Points 说明

一.FlashbackDatabase 和 Restore Points 说明

官网的链接如下:

http://download.oracle.com/docs/cd/E18283_01/backup.112/e10642/flashdb.htm

关于FlashbackDatabase 的内容,我之前的blog里有说明:

Oracle Flashback 技术 总结

http://blog.csdn.net/tianlesoftware/article/details/4677378

这里提到这两者,是因为这两者的功能和类似。官方的说明如下:

OracleFlashback Databaseand restore points are related data protectionfeatures that allow you to rewind data back in time tocorrect any problems caused by logical data corruption or user errors within adesignated time window.

These featuresprovide a more efficient alternative to point-in-time recovery and does notrequire a backup of the database to be restored first. The effects are similartodatabasepoint-in-time recovery (DBPITR).

Flashback Database and restore points are not only effectivein traditional database recovery situations but can also be useful duringdatabase upgrades, application deployments and testing scenarios when test databasesmust be quickly created and recreated. FlashbackDatabase also provides an efficient alternative to rebuilding a failed primarydatabase after a Data Guard failover.

Flashback Database 和 restore points 都可以提供一个基于时间点的回滚,类似与RMAN 的 point-in-time recovery,但是这两种方法与RMAN 的区别是在恢复的速度上, 当我们在database upgrade 或者 快速创建测试环境的时候就可以使用这种技术,因为等我们升级遇到问题或者测试完成,还可以恢复我们之前的时间点。

Restore pointsprovide capabilities related to Flashback Database and other media recoveryoperations. In particular, a guaranteed restore point created at an systemchange number (SCN) ensures that you can use Flashback Database to rewind thedatabase to this SCN. You can use restore points andFlashback Database independently or together.

Restore Points 和 Flashback Database 可以分开使用也可以一起使用。

FlashbackDatabase is accessible through the RMANcommandFLASHBACKDATABASEor the SQLstatementFLASHBACKDATABASE. You can use either command to quickly recover the database from logical data corruption or user errors.

The following examples return the database to a specified SCN or restore point:

FLASHBACKDATABASE TO RESTORE POINT 'before_upgrade';

FLASHBACK DATABASETO SCN 202381;

1.1 Flashback Database

Flashback Database is accessible through theRMAN command and SQL statementFLASHBACKDATABASE. You can use either command to quickly recover the database fromlogical data corruptions or user errors.

Flashback Database is similar to conventional point-in-time recoveryin its effects. It enables you to return a database to its state at a time inthe recent past. Flashback Database is much faster thanpoint-in-time recovery because it does not require restoring datafiles frombackup and requires applying fewer changes from the archived redo logs.

--Flashback database 不需要restore database,所以它恢复的速度比较块。

You can use Flashback Database to reverse most unwanted changes to a database if thedatafiles are intact. You can return a database to its state in apreviousincarnation,and undo the effects of anALTERDATABASE OPEN RESETLOGSstatement."Rewindinga Database with Flashback Database"explains how to usetheFLASHBACKDATABASEcommand to reverse database changes.

Flashback Database uses its own logging mechanism, creatingflashbacklogsand storing them in thefastrecovery area. You can only use Flashback Database if flashback logs areavailable. To take advantage of this feature, you must set up your database inadvance to create flashback logs.

--Flashback Database 与Point-in-time recover 的机制不同,它是基于Flashback logs,默认情况下,没有启用Flashback Database,当启用之后,会创建Flashback log,并存放在FastRecovery Area。 启用该弄能会给DB带来一定的负担,所以一把不启用该功能。

To enable Flashback Database, you configure a fast recovery area and set aflashbackretention target. This retention target specifies how far back you canrewind a database with Flashback Database.

From that timeonwards, at regular intervals, the database copies images of each altered blockin every datafile into the flashback logs. These block images can later bereused to reconstruct the datafile contents for any moment at which logs werecaptured.

--当启用Flashback Database 之后,DB 会每个一段时间copy一份datafile 中修改的block的镜像到FRA中。 如果需要使用FlashbackDatabase 进行rewind 操作,就会使用这些images 文件。

When you useFlashback Database to rewind a database to a past target time, the commanddetermines which blocks changed after the target time and restores them fromthe flashback logs. The database restores the version of each block that is immediatelyprior to the target time. The database then uses redo logs to reapply changesthat were made after these blocks were written to the flashback logs.

--Flashback Database 机制每隔一段时间就会创建一次images,这里记录了block的改变的转台,当进行闪回时,先恢复到对应target time,即我们的之前的某个镜像上,然后根据redo log,重新应用redo log,将数据恢复到我们指定的闪回的时间点上。

Redo logs ondisk or tape must be available for the entire time period spanned by theflashback logs. For example, if the flashback retention target is 1 week, thenyou must ensure that online and archived redo logs that contain all changes forthe past week are accessible. In practice, redo logs are typically needed muchlonger than the flashback retention target to support point-in-time recovery.

1.2 Flashback Database Window

The range of SCNs for which there is currently enough flashback log data to supporttheFLASHBACKDATABASEcommand is called theflashbackdatabase window. The flashback database window cannot extend further backthan the earliest SCN in the available flashback logs.

You cannot back up flashback logs to locations outside thefast recovery area. To increase the likelihood thatenough flashback logs are retained to meet the flashback database window, youcan increase the space in your fast recovery area (see"InitializationParameters for the Fast Recovery Area").

If the fast recovery area is not large enough to hold the flashback logs and files such asarchived redo logs and other backups needed for the retention policy, then thedatabase may delete flashback logs from the earliest SCNs forward to make roomfor other files. Consequently, the flashback databasewindow can be shorter than the flashback retention target, depending onthe size of the fast recovery area, other backups that must be retained, andhow much flashback logging data is needed. The flashback retention target is atarget, not a guarantee that Flashback Database is available.

If you cannot useFLASHBACK DATABASEbecause the flashback database window is notlong enough, then you can use database point-in-time recovery (DBPITR) in mostcases to achieve a similar result. Guaranteed restorepoints are the only way to ensure that you can use Flashback Database to returnto a specific point in time or guarantee the size of the flashback window.

1.3 Limitations of Flashback Database

Because Flashback Database works by undoing changes to the datafilesthat exist at the moment when you run the command, it has the followinglimitations:

(1)Flashback Database can onlyundo changes to a datafile made by Oracle Database. It cannot be used to repairmedia failures, or to recover from accidental deletion of datafiles.

(2)You cannot use FlashbackDatabase to undo a shrink datafile operation. However, you can take theshrunken file offline, flash back the rest of the database, and then laterrestore and recover the shrunken datafile.

(3)You cannot use FlashbackDatabase alone to retrieve a dropped datafile. If you flash back a database toa time when a dropped datafile existed in the database, only the datafile entryis added to the control file. You can only recover the dropped datafile byusing RMAN to fully restore and recover the datafile.

(4)If the database control file isrestored from backup or re-created, all accumulated flashback log informationis discarded. You cannot useFLASHBACK DATABASEto return to a pointin time before the restore or re-creation of a control file.

(5)When using Flashback Databasewith a target time at which aNOLOGGINGoperation was in progress,block corruption is likely in the database objects and datafiles affected bytheNOLOGGINGoperation. For example, if you perform adirect-pathINSERToperation inNOLOGGINGmode, and thatoperation runs from 9:00 to 9:15 on April 3, 2005, and you later use FlashbackDatabase to return to the target time 09:07 on that date, the objects anddatafiles updated by the direct-pathINSERTmay be left with blockcorruption after the Flashback Database operation completes.

If possible,avoid using Flashback Database with a target time or SCN that coincides withaNOLOGGINGoperation. Also, perform a full or incremental backup ofthe affected datafiles immediately after anyNOLOGGINGoperation toensure recoverability to points in time after the operation. If you expect touse Flashback Database to return to a point in time during an operation such asa direct-pathINSERT, consider performing the operationinLOGGINGmode.

1.4 Normal RestorePoints

Creating anormalrestore pointassigns a restore point name to an SCN or specific pointin time. Thus, a restore point functions as a bookmark or alias for this SCN.Before performing any operation that you may have to reverse, you can create anormal restore point. The control file stores the nameof the restore point and the SCN.

--对于Normal Restore Points, point的名称和SCN 保存在控制文件里。

If you use flashback features or point-in-time recovery, then you can use the name of therestore point instead of a time or SCN. The following commands support this useof restore points:

(1)TheRECOVERDATABASEandFLASHBACK DATABASEcommands in RMAN

(2)TheFLASHBACKTABLEstatement in SQL

Creating anormal restore point eliminates manually recording an SCN in advance ordetermine the correct SCN after the fact by using features such as FlashbackQuery.

Normal restore points are lightweight. The control file can maintain a record of thousands of normalrestore points with no significant effect on database performance. Normal restore points eventually age out of the control fileif not manually deleted, so they require no ongoing maintenance.

--Normal restore points 信息保存在控制文件中,属轻量级别,即使我们没有手工的删除这些points 信息,控制文件也会有删除这些信息,所以对于Normal restore points,我们不要其他的维护操作。

Restore Point 同Flashback Database 一样,也会产生image 文件,在没有启用FD的情况下,只在开始时创建一次image,并保存在FRA中。 这点下文有说明。

控制文件保留Restore Points 的2点注意:

(1)The most recent 2048 restorepoints are always kept in the control file, regardless of their age.

(2)Any restore point more recentthan the value ofCONTROL_FILE_RECORD_KEEP_TIMEis retained,regardless of how many restore points are defined.

1.5 Guaranteed Restore Points

Like a normalrestore point, aguaranteedrestore pointserves as an alias for an SCN in recovery operations. A principal difference is that guaranteed restore pointsnever age out of the control file and must be explicitly dropped. Ingeneral, you can use a guaranteed restore point as an alias for an SCN with anycommand that works with a normal restore point. Except as noted, theinformation about where and how to use normal restore points applies toguaranteed restore points as well.

--Guaranteed restore points 的信息也是保存在控制文件里的,本质的不同是Guaranteedrestore points 不会自动的删除,必须手工的清除这些信息。

A guaranteed restorepoint ensures that you can use Flashback Database to rewind a database to itsstate at the restore point SCN, even if the generation offlashbacklogsis disabled. If flashback logging is enabled, then a guaranteedrestore point enforces the retention of flashback logs required for FlashbackDatabase to any SCN after the earliest guaranteed restore point. Thus, ifflashback logging is enabled, you can rewind the database to any SCN in thecontinuum rather than to a single SCN only.

--如果我们创建了Guaranteed restore point,那么即使我们没有启用Flashback Database,那么我也可以恢复到我们创建的point。 但如果我们同时启用了Flashback Database,那么guaranteed restorepoint 会强制保留从那个point 依赖的flashback log 文件。 这样我们就会rewind从我们创建point 以来的任一个SCN。

一句话表示,就是在不启用FlashbackDatabase 的情况下, Guaranteed restore point 只能rewind到我们创建的点对应的SCN.

If the recoveryarea has enough disk space to store the needed logs, then you can use aguaranteed restore point to rewind a whole database to a known good state daysor weeks ago. As with Flashback Database, even the effectsofNOLOGGINGoperations like direct load inserts can be reversed withguaranteed restore points.

1.6 Guaranteed Restore Points versus Storage Snapshots

Inpractice, guaranteed restore points provide a usefulalternative to storage snapshots. Storage snapshots are often used to protect adatabase before risky operations such as large-scale database updates orapplication patches or upgrades. Rather than creating a snapshot orduplicatedatabaseto test the operation, you can create a guaranteed restorepoint on a primary orphysicalstandby database. You can then perform the risky operation with thecertainty that the required flashback logs are retained.


1.7 Logging for Flashback Database and Guaranteed RestorePoints

Logging forFlashback Database and guaranteed restore points involves capturing images ofdatafile blocks before changes are applied.TheFLASHBACKDATABASEcommand can use these images to returnthe datafiles to their previous state.

The chiefdifferences between normal flashback logging and logging for guaranteed restorepoints are related to when blocks are logged and whether the logs can bedeleted in response to space pressure in the fast recovery area. Thesedifferences affect space usage for logs and database performance.

Yourrecoverability goals partially determine whether to enable logging forflashback database, or use guaranteed restore points, or both. The implicationsin performance and in space usage for these features, separately and when usedtogether, should also factor into your decision.

1.7.1 Guaranteed RestorePoints and Fast Recovery Area Space Usage

The following rules govern creating, retaining, overwriting and deleting of flashback logs inthe fast recovery area:

(1)If the fast recovery area hasenough space, then a flashback log is created whenever necessary to satisfy theflashback retention target.

(2)If a flashback log is oldenough that it is no longer needed to satisfy the flashback retention target,then a flashback log is reused.

(3)If the database must create anew flashback log and the fast recovery area is full or there is no disk space,then the oldest flashback log is reused instead.

(4)automatically deleted by thefast recovery area to make space for other files. In this case, any flashbacklogs that would require the use of that redo log file for the useofFLASHBACKDATABASEare also deleted.

(5)No file in the fast recoveryarea is eligible for deletion if it is required to satisfy a guaranteed restorepoint. Thus, retention of flashback logs and other files required to satisfythe guaranteed restore point, in addition to files required to satisfy thebackup retention policy, can cause the fast recovery area to fill completely.Consult"Respondingto a Full Fast Recovery Area"if your fast recovery area becomesfull.

When you createa guaranteed restore point, with or without enabling full flashback databaselogging, you must monitor the space available in your fast recovery area."ManagingSpace for Flashback Logs in the Fast Recovery Area"explains howto monitor fast recovery area disk space usage.

1.7.2 Logging for Guaranteed Restore Points with FlashbackLogging Disabled

Assume that youcreate a guaranteed restore point when logging for Flashback Database isdisabled. In this case, the first time a datafile block is modified after thetime of the guaranteed restore point, the database stores an image of the blockbefore the modification in the flashback logs. Thus, the flashback logspreserve the contents of every changed data block at the time that theguaranteed restore point was created. Later modifications to the same block donot cause the contents to be logged again unless another guaranteed restorepoint was created after the block was last modified.

--当我们创建了一个Guaranteed Restore Points,并且我们没有启动Flashback Database,那么在这种情况下,DB 会也会创建一个block 的镜像,并存在FRA空间里,这个和FlashbackDatabase 的一致,那么不同的时,Flashback Database 会每隔一段时间创建一个block的image,而RestorePoints 只在开始时创建一次,那么恢复的时候也就只能恢复到这个时间点。

这里要注意一点,我们创建Restore Point的名称和对应的SCN是保存在控制文件里的,这点前面有说明。

This method of logging has the following important consequences:

(1)FLASHBACKDATABASEcanre-create the datafile contents at the time of a guaranteed restore point bymeans of the block images.

(2)For workloads that repeatedlymodify the same data, disk space usage can be less than normal flashbacklogging. Less space is needed because each changed block is only logged once.Applications with low volume inserts may benefit from this disk space saving.This advantage is less likely for applications with high volume inserts orlarge batch inserts. The performance overhead of logging for a guaranteedrestore point without flashback database logging enabled can also be lower.

Assume that yourprimary goal is the ability to return your database to the time at which theguaranteed restore point was created. In this case, it is usually moreefficient to turn off flashback logging and use only guaranteed restore points.For example, suppose that you are performing an application upgrade on adatabase host over a weekend. You could create a guaranteed restore point atthe start of the upgrade. If the upgrade fails, then reverse the changes withtheFLASHBACKDATABASEcommand.

在不启用Flashback Database 的情况下,我们创建Guaranteed Restore Points,只创建一次image,那么会节省很多的FRA空间,这种方法在对数据库进行升级的时候很有用,在升级之前我们创建一次Guaranteed Restore Point,然后升级DB,如果升级失败,我们回退,如果升级生成,我们删除Restore Point。

1.7.3 Logging forFlashback Database with Guaranteed Restore Points Defined

If you enableFlashback Database and define one or more guaranteed restore points, then thedatabase performs normal flashback logging. In this case, the recovery arearetains the flashback logs required to flash back to any arbitrary time betweenthe present and the earliest currently defined guaranteed restore point.Flashback logs are not deleted in response to space pressure if they arerequired to satisfy the guarantee.

Flashback logging causes some performance overhead. Depending upon the pattern ofactivity on your database, it can also cause significant space pressure in thefast recovery area. Thus, you should monitor space used in the fast recoveryarea.

1.8 Prerequisites for Flashback Database and Guaranteed Restore Points

To ensuresuccessful operation of Flashback Database and guaranteed restore points, youmust first set a number of key database options.

1.8.1 Flashback Database

Configure the following database settingsbefore enabling Flashback Database:

(1)Your database must be runninginARCHIVELOGmode, because archived logs are used in the FlashbackDatabase operation.

(2)You must have a fast recoveryarea enabled, because flashback logs can only be stored in the fast recoveryarea.

(3)For Oracle Real ApplicationClusters (Oracle RAC) databases, the fast recovery area must be in a clusteredfile system or in ASM.

1.8.2 Guaranteed Restore Points

To use guaranteed restore points, thedatabase must satisfy the following additional prerequisite: theCOMPATIBLEinitializationparameter must be set to 10.2.0 or greater


二.Flashback Database 和 Restore Points 语法

2.1 Using Flashback Database

This section describes the basic commands for Flashback Database. It also lists guidelinesto ensure optimal performance of Flashback Database.

2.1.1 Enabling Flashback Database

Follow these are the steps to enableFlashback Database.

To enable flashback logging:

(1)Ensure thedatabase instance is open or mounted. If the instance is mounted, then thedatabase must be shut down cleanly unless it is a physical standby database.Other Oracle RAC instances can be in any mode.

(2)Optionally,set theDB_FLASHBACK_RETENTION_TARGETto the length of the desiredflashback window in minutes:

ALTER SYSTEM SETDB_FLASHBACK_RETENTION_TARGET=4320; # 3 days

BydefaultDB_FLASHBACK_RETENTION_TARGETis set to 1 day (1440 minutes).

(3)Enable theFlashback Database feature for the whole database:

ALTER DATABASE FLASHBACK ON;

(4)Optionally,disable flashback logging for specific tablespaces.

By default,flashback logs are generated for all permanent tablespaces. You can reduceoverhead by disabling flashback logging for specific tablespaces as in thefollowing example:

ALTER TABLESPACEtbs_3 FLASHBACK OFF;

You can reenable flashback logging for atablespace later with this command:

ALTER TABLESPACEtbs_3 FLASHBACK ON;

If you disable Flashback Database for atablespace, then you must take its datafiles offline beforerunningFLASHBACKDATABASE.

When you enableFlashback Database while the database is open, there is a very small chance thecommand may not be able to obtain the memory it needs. If the command failsbecause of that reason, retry the command after a while or retry after ashutdown and restart of the instance.

When you enableFlashback Database on aphysicalstandby database, you can flash back a standby database. Flashback Databaseof standby databases has a number of applications in the Data Guardenvironment. SeeOracleData Guard Concepts and Administrationfor details.

2.1.2 Disabling Flashback Database Logging

On one of thedatabase instances that is either in mount or open state, issue the following command:

ALTER DATABASEFLASHBACK OFF;

2.2 Using Normal and Guaranteed Restore Points

This sectiondescribes the various commands and monitoring capabilities you use with normaland guaranteed restore points.

2.2.1 Creating Normal and Guaranteed Restore Points

To create normal or guaranteed restorepoints, use theCREATERESTORE POINTSQL statement, providing a name for the restore pointand specifying whether it is to be a guaranteed restore point or a normal one (the default).

To create a restore point:

(1)Connect SQL*Plus to a targetdatabase.

(2)Ensure that the database is open or mounted. If the database is mounted, then it must have been shut down cleanly(unless it is a physical standby database).

--如果是mount状态来创建point,那么这个必须是shutdown cleanly 之后的mount,如果是非cleanshutdown,那么在下次启动时需要进行recover 操作,这样就不能创建point。

Oracle 实例恢复时 前滚(roll forward) 后滚(rollback) 问题

http://blog.csdn.net/tianlesoftware/article/details/6286330

(3)Run theCREATE RESTOREPOINTstatement.

The following example shows how to create anormal restore point in SQL*Plus:

SQL> CREATE RESTORE POINTbefore_upgrade;

This example shows how to create aguaranteed restore point:

SQL> CREATE RESTORE POINT before_upgradeGUARANTEE FLASHBACK DATABASE;

2.2.2 ListingRestore Points

You can use theLISTcommand to list either a specificrestore point or all restore points known to the RMAN repository. Thevariations of the command are as follows:

LIST RESTORE POINT restore_point_name;

LIST RESTORE POINT ALL;

RMAN indicatesthe SCN and time of the restore point, the type of restore point, and the nameof the restore point. The following example shows sample output:

RMAN> LIST RESTORE POINT ALL;

using target database control file insteadof recovery catalog

SCN RSP Time TypeTime Name

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

341859 28-JUL-06 28-JUL-06 NORMAL_RS

343690 28-JUL-06 GUARANTEED 28-JUL-06GUARANTEED_RS

To see a list ofall currently defined restore points (normal and guaranteed), usetheV$RESTORE_POINTcontrol file view, by means of the followingquery:

SQL> SELECT NAME, SCN, TIME,DATABASE_INCARNATION#,

GUARANTEE_FLASHBACK_DATABASE,STORAGE_SIZE

FROM V$RESTORE_POINT;

The output from the view:

(1)Name of each restore point(guaranteed and normal)

(2)SCN

(3)Time and database incarnationnumber when the restore points were created

(4)Type of restore point (normalor guaranteed)

(5)Amount of space in the flashrecovery area being used to support information needed for Flashback Databaseoperations for that restore point

For normal restore points,STORAGE_SIZEis zero. For guaranteed restorepoints,STORAGE_SIZEindicates the amount of disk space in the flashrecovery area used to retain logs required toguaranteeFLASHBACKDATABASEto that restore point.

2.2.3 Dropping Restore Points

When you are satisfied that you do not need an existing restore point, or when you want tocreate a new restore point with the name of an existing restore point, you can drop the restore point, using theDROP RESTORE POINTSQL*Plusstatement.

For example:

SQL> DROP RESTORE POINTbefore_app_upgrade;

Restore point dropped.

The same statement is used to drop bothnormal and guaranteed restore points.

Note:

Normal restore points eventually age out of the control file, even if not explicitly dropped.The rules governing retention of restore points in the control file are:

(1)The most recent 2048 restorepoints are always kept in the control file, regardless of their age.

(2)Any restore point more recentthan the value ofCONTROL_FILE_RECORD_KEEP_TIMEis retained,regardless of how many restore points are defined.

Normal restore points that do not meet either of these conditions may age out of the controlfile.

Guaranteed restore points never age out of the control file. They remain until they areexplicitly dropped.

三. RestorePoints 示例

3.1 先创建restore point

--有关Flashback的相关参数:

SQL> show parameter db_recovery_file_dest

NAME TYPE VALUE

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

db_recovery_file_dest string D:\app\Administrator\flash_rec overy_area

db_recovery_file_dest_size big integer 1300M

SQL> show parameter db_flashback

NAME TYPE VALUE

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

db_flashback_retention_target integer 1440

SQL> select flashback_on from v$database;

FLASHBACK_ON

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

NO

--创建restore point

SQL>startup mount

SQL> create restore point upgrade_pointguarantee flashback database;

Restore point created.

SQL>shutdown immediate


注意:

如果数据库的Flashback database 没有打开,那么只能在mount 状态下进行创建。

如果是Open 状态执行,创建完之后,DB 会变成mount状态。

--查看我们创建的restore point

RMAN> list restore point all;

SCN RSP Time TypeTime Name

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

1316268211 GUARANTEED 29-OCT-11UPGRADE_POINT

3.2 执行操作

如果是升级,这里就执行升级的脚本

SQL>startup upgrade

SQL>@?/rdbms/admin/catupgrd.sql

SQL>shutdown immediate

SQL>startup

SQL>@?/rdbms/admin/utlrp.sql

这里我们就不执行,我们创建一个表,演示一下效果。

SQL> select open_mode from v$database;

OPEN_MODE

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

READ WRITE

SQL> create table d1(id number);

Table created.

SQL> insert into d1 values(1);

1 row created.

SQL> insert into d1 values(2);

1 row created.

SQL> commit;

Commit complete.

SQL> select * from d1;

ID

----------

1

2

3.3 如果失败,就进行回滚

注意:执行Flashback Database时,DB 不能处于open状态.

SQL> shutdown immediate

SQL> startup mount;

SQL> select open_mode from v$database;

OPEN_MODE

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

MOUNTED

SQL>select flashback_on from v$database;

FLASHBACK_ON

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

RESTORE POINT ONLY

SQL> flashback database to restore point upgrade_point;

Flashback complete.

SQL> alter database open;

alter database open

*

ERROR at line 1:

ORA-01589: must use RESETLOGS orNORESETLOGS option for database open

--提示必须用Resetlogs打开:

SQL> alter database open resetlogs;

Database altered.

--查看我们之前的创建的表:D1

SQL> select * from d1;

select * from d1

*

ERROR at line 1:

ORA-00942: table or view does not exist

提示我们表不存在,数据闪回到了我们之前的Restore Point了。 用resetlogs 打开DB 之后记得重新备份一下数据库。

3.4如果升级成功,我们直接删除restore point即可

SQL> drop restore point upgrade_point;

Restore point dropped.

用RMAN 验证:

RMAN>list restore point all;

using target database control file insteadof recovery catalog

SCN RSP Time TypeTime Name

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

RMAN>

已经为空。

基于Restore Points的方法,还可以将standby库临时激活到读写状态进行测试,测试完成后,在还原到之前的状态。这种方法的步骤,参考如下链接:

http://space.itpub.net/10834762/viewspace-464590

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

版权所有,文章允许转载,但必须以链接方式注明源地址,否则追究法律责任!

Blog: http://blog.csdn.net/tianlesoftware

Weibo: http://weibo.com/tianlesoftware

Email: tianlesoftware@gmail.com

Skype: tianlesoftware

-------加群需要在备注说明Oracle表空间和数据文件的关系,否则拒绝申请----

DBA1 群:62697716(满); DBA2 群:62697977(满)DBA3 群:62697850(满)

DBA 超级群:63306533(满); DBA4 群:83829929(满) DBA5群: 142216823(满)

DBA6 群:158654907(满) DBA7 群:69087192(满)DBA8 群:172855474

DBA 超级群2:151508914 DBA9群:102954821 聊天 群:40132017(满)

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值