|
001 |
Backup and recovery procedures protect your database against data loss
and reconstruct the data, should loss occur. The reconstructing of data
is achieved through media recovery, which refers to the various
operations involved in restoring, rolling forward, and rolling back a
backup of database files. This chapter introduces concepts fundamental
to designing a backup and recovery strategy.
|
备份(backup)及恢复(recovery)过程能够保护数据库,防止数据丢失,并在需要时重建数据。重建数据通常是通过介质恢复(media
recovery)实现的,介质恢复是指利用备份的数据库文件所执行的复原(restoring),前滚(rolling
forward),及回滚(rolling back)等一系列操作。本章将介绍设计备份恢复策略时需要掌握的基本概念。
|
|
002 |
This chapter contains the following topics:
|
本章包含以下主题:
|
|
003 |
See Also:
|
另见:
|
|
004 |
Introduction to
Backup
|
15.1 备份简介
|
|
005 |
A backup is a copy of data. This copy can include important parts of the
database, such as the control file and datafiles. A backup is a
safeguard against unexpected data loss and application errors. If you
lose the original data, then you can reconstruct it by using a backup.
|
备份(backup)是数据的一个副本(copy of data)。这个副本中通常包含数据库的重要组成部分,例如控制文件(control
file)及数据文件(datafile)等。备份能够减少不可预见的数据丢失或应用程序错误造成的损失。如果原始数据丢失,用户可以使用备份重建数据。
|
|
006 |
Backups are divided into physical backups and logical backups. Physical
backups, which are the primary concern in a backup and recovery
strategy, are copies of physical database files. You can make physical
backups with either the Recovery Manager (RMAN) utility or operating
system utilities. In contrast, logical backups contain logical data (for
example, tables and stored procedures) extracted with an Oracle utility
and stored in a binary file. You can use logical backups to supplement
physical backups.
|
备份分为物理备份(physical backup)及逻辑备份(logical
backup)。物理备份指物理数据库文件的副本,物理备份是备份恢复策略的主体。用户可以使用 Recovery
Manager(RMAN)或操作系统工具进行物理备份。与物理备份相对的是逻辑备份,这种备份方式使用 Oracle
工具抽取逻辑数据(例如,表或存储过程)并保存在二进制文件中。逻辑备份可以作为物理备份的补充。
|
|
007 |
There are two ways to perform Oracle backup and recovery: Recovery
Manager and user-managed backup and recovery.
|
进行 Oracle 备份恢复的方式有两种:使用 Recovery Manager
进行备份恢复,或手工管理(user-managed)的备份恢复。
|
|
008 |
Recovery Manager (RMAN) is an Oracle utility that can
back up, restore, and recover database files. It is a feature of the
Oracle database server and does not require separate installation.
|
Recovery Manager (RMAN) 是用于备份(back
up),复原(restore),及恢复(recover)数据库文件的 Oracle 工具。RMAN 是 Oracle
数据库的内置工具,无须单独安装。
|
|
009 |
You can also use operating system commands for backups and SQL*Plus for
recovery. This method, also called user-managed backup and recovery, is
fully supported by Oracle, although use of RMAN is highly recommended
because it is more robust and greatly simplifies administration.
|
用户也可以使用操作系统命令进行备份,并使用 SQL*Plus 进行恢复。这种方式被称为手工管理的备份恢复。Oracle
同时支持上述两种方式,但强烈建议采用 RMAN,因为采用 RMAN 的备份恢复方式更为健壮,且能够极大地简化备份恢复的管理工作。
|
|
010 |
Whether you use RMAN or user-managed methods, you can supplement your
physical backups with logical backups of schema objects made using the
Export utility. The utility writes data from an Oracle database to
binary operating system files. You can later use Import to restore this
data into a database.
|
无论用户采用 RMAN 或手工管理的备份恢复,都可以使用 Export utility(导出工具)对方案对象(schema object)进行逻辑备份,作为物理备份的补充。Export 能够将 Oracle
数据库内的数据写入二进制的操作系统文件。用户可以使用 Import utility(导入工具)将数据恢复到数据库中。
|
|
011 |
This section contains the following topics:
|
本节包含以下主题:
|
|
012 |
See Also:
"When to Use Import/Export Utilities Recovery" for
information on logical backups
|
另加:
“何时采用 Import/Export 工具恢复”了解关于逻辑备份的信息
|
|
013 |
Consistent and Inconsistent Backups
|
15.1.1 一致性备份与非一致性备份
|
|
014 |
A consistent backup is one in which the files being backed up contain
all changes up to the same system change number (SCN). This means that
the files in the backup contain all the data taken from a same point in
time. Unlike an inconsistent backup, a consistent whole database backup
does not require recovery after it is restored.
|
一致性备份(consistent backup)的含义是,备份所包含的各个文件中的所有修改都具备相同的系统变化编号(system
change number,SCN)。也就是说,备份所包含的各个文件中的所有数据均来自同一时间点。与非一致性备份(inconsistent
backup)不同,使用一致性数据库完全备份(consistent whole database
backup)进行复原(restore)后,不需要执行恢复操作(recovery)。
|
|
015 |
An inconsistent backup is a backup of one or more database files that
you make while the database is open or after the database has shut down
abnormally.
|
非一致性备份指,在数据库处于打开(open)状态时,或数据库异常关闭(shut down
abnormally)后,对一个或多个数据库文件进行的备份。
|
|
016 |
Overview of Consistent Backups
|
15.1.1.1 一致性备份概述
|
|
017 |
A consistent backup of a database or part of a database is a backup in
which all read/write datafiles and control files are checkpointed with
the same SCN.
|
对数据库整体或部分进行的一致性备份(consistent backup)后,备份中所有数据文件(datafile)及控制文件(control
file)都经历过检查点(checkpoint),拥有相同的 SCN。
|
|
018 |
The only way to make a consistent whole database backup is to shut down
the database with the NORMAL,
IMMEDIATE, or
TRANSACTIONAL options and make the backup while the database is
closed. If a database is not shut down cleanly, for example, an instance
fails or you issue a SHUTDOWN ABORT
statement, then the database's datafiles are always inconsistent—unless
the database is a read-only database.
|
进行一致性数据库完全备份(consistent whole database backup)的唯一方法是:首先使用 NORMAL,IMMEDIATE,或
TRANSACTIONAL 选项关闭数据库,并在数据库处于关闭状态时进行备份。如果数据库没有完全关闭,例如出现实例故障,或用户使用了 SHUTDOWN ABORT
语句,此时数据库的数据文件是非一致性的,除非此数据库为只读数据库(read-only
database)。
|
|
019 |
Oracle makes the control files and datafiles consistent to the same SCN
during a database checkpoint. The only tablespaces in a
consistent backup that are allowed to have older SCNs are read-only and
offline normal tablespaces, which are still consistent with the other
datafiles in the backup because no changes have been made to them.
|
Oracle 通过数据库检查点操作使数据文件和控制文件拥有相同的
SCN,即具备一致性。在一致性备份中,只有只读表空间(read-only tablespace)及脱机表空间(offline
tablespace)的 SCN 可以比备份中其他文件的 SCN 滞后。这两种表空间内的数据不会被修改,因此她们也能满足一致性的要求。
|
|
020 |
The important point is that you can open the database after restoring a
consistent whole database backup without needing recovery because the
data is already consistent: no action is required to make the data in
the restored datafiles correct. Hence, you can restore a year-old
consistent backup of your database without performing media recovery and
without Oracle performing instance recovery. Of course, when you restore
a consistent whole database backup without applying redo, you lose all
transactions that were made since the backup was taken.
|
一致性数据库完全备份的重要特点是,使用此种备份复原(restore)的数据库无须恢复(recovery)即可打开(open),这是因为复原的数据库具备一致性:复原的数据文件内的数据是正确的,无须用户进行任何
处理。用户可以使用一年前的一致性备份复原数据库,而无须进行介质恢复(media
recovery),Oracle 也不必执行实例恢复(instance
recovery)。但是,如果使用一致性备份复原数据库而没有应用重做日志(applying redo),备份之后产生的事务将全部丢失。
|
|
021 |
A consistent whole database backup is the only valid backup option for
databases operating in NOARCHIVELOG mode,
because otherwise recovery is necessary for consistency. In
NOARCHIVELOG mode, Oracle does not archive
the redo logs, and so the required redo logs might not exist on disk. A
consistent whole backup is also a valid backup option for databases
operating in ARCHIVELOG mode. When this
type of backup is restored and archived logs are available, you have the
option of either opening the database immediately and losing
transactions that were made since the backup was taken, or applying the
archived logs to recover those transactions.
|
如果数据库运行在 NOARCHIVELOG(非归档)模式下,一致性数据库完全备份是唯一有效的备份方案,因为使用非一致性备份(inconsistent
backup)复原数据库后需要执行恢复操作来确保数据一致性。在 NOARCHIVELOG
模式下,Oracle 不会对重做日志进行归档,因此恢复所需的重做日志可能已经不存在了。而运行在 ARCHIVELOG(归档)模式下的数据库,可以采用一致性数据库完全备份。当使用此种备份复原数据库后,用户可以立即打开数据库,使备份后发生的事务全部丢失;如果归档的重做日志存在,用户也可以应用这些日志从而恢复备份后发生的事务。
|
|
022 |
Overview of Inconsistent Backups
|
15.1.1.2 非一致性备份概述
|
|
023 |
An inconsistent backup is a backup in which the files being backed up do
not contain all the changes made at all the SCNs. In other words, some
changes are missing. This means that the files in the backup contain
data taken from different points in time. This can occur because the
datafiles are being modified as backups are being taken. Oracle recovery
makes inconsistent backups consistent by reading all archived and online
redo logs, starting with the earliest SCN in any of the datafile
headers, and applying the changes from the logs back into the datafiles.
|
非一致性备份(inconsistent backup)的含义是,备份所包含的各个文件中的所有修改不具备相同的系统变化编号(system
change number,SCN)。换句话说,有些修改在备份中不存在。这意味着备份所包含的各个文件中的所有数据来自不同的时间点。如果数据文件在备份的同时也在被修改就会出现上述情况。Oracle
的恢复(recovery)操作能够比较所有数据文件头(datafile headers)中的 SCN,之后以最早的 SCN
为起点读取归档及联机重做日志文件,并将其中出的所有修改应用到复原的数据文件中。
|
|
024 |
If the database must be up and running 24 hours a day, seven days a
week, then you have no choice but to perform inconsistent backups of the
whole database. A backup of online datafiles is called an
online backup. This requires that you run your database in
ARCHIVELOG mode.
|
如果数据库必须 24*7 地工作,对这样的数据库只能进行非一致性数据库完全备份。联机数据文件的备份被称为联机备份(online
backup)。需要进行联机备份的数据库必须运行在 ARCHIVELOG(归档)模式下。
|
|
025 |
If you run the database in ARCHIVELOG mode,
then you do not have to back up the whole database at one time. For
example, if your database contains seven tablespaces, and if you back up
the control file as well as a different tablespace each night, then in a
week you will back up all tablespaces in the database as well as the
control file. You can consider this staggered backup as a whole database
backup. However, if such a staggered backup must be restored, then you
need to recover using all archived redo logs that were created since the
earliest backup was taken.
|
如果数据库运行在 ARCHIVELOG
模式下,用户不必每次都进行数据库完全备份。例如,如果数据库包含七个表空间,用户每晚都备份控制文件及一个不同的表空间,那么一周后用户就已经备份了数据库的全部表空间及控制文件。用户可以把这个交错的备份作为数据库完全备份。如果需要使用这个交错的备份
恢复数据库,除了复原数据之外,用户还需应用最早备份时间之后的产生所有归档重做日志。
|
|
026 |
Caution:
Oracle strongly recommends that you do not make inconsistent, closed
database backups in NOARCHIVELOG mode.
If such a backup is used to restore the database, then data
corruption might result.
|
警告:
Oracle 强烈建议,运行在 NOARCHIVELOG
模式下的数据库关闭后不要进行非一致性备份。如果用这样的备份复原数据库有可能造成数据损坏。
|
|
027 |
See Also:
Oracle Database Backup and Recovery Advanced User's Guide
|
另见:
Oracle Database Backup and Recovery Advanced User's Guide
|
|
028 |
Archiving Unarchived Redo Log Files
|
15.1.1.2.1 对未归档的重做日志文件进行归档
|
|
029 |
After an online backup or inconsistent closed backup,
always ensure that you have the redo necessary to recover the backup by
archiving the unarchived redo logs.
|
在进行联机备份(online
backup)后或关闭(close)数据库后进行非一致性备份(inconsistent
backup)后,一定要归档未归档的重做日志,以保存恢复(recover)所需的重做数据。
|
|
030 |
Backing Up the Archived Logs and the
Control File
|
15.1.1.2.2 备份归档日志文件及控制文件
|
|
031 |
After open or inconsistent closed backups, Oracle recommends backing up
all archived logs produced during the backup, and then backing up the
control file after the backup completes. If you do not have all archived
redo logs produced during the backup, then you cannot recover the backup
because you do not have all the redo records necessary to make it
consistent.
|
在进行了非一致性备份后(无论备份时数据库是打开(open)或关闭(close)状态),Oracle
建议首先对非一致性备份期间产生的归档重做日志进行备份,再对非一致性备份完成后的控制文件进行备份。如果用户没有备份非一致性备份期间产生的归档重做日志,将无法恢复使用非一致性备份还原的数据库,因为此种情况下可能缺少足够的重做日志来使数据保持一致性。
|
|
032 |
Whole Database and Partial Database Backups
|
15.1.2 数据库完全备份与数据库部分备份
|
|
033 |
This section contains the following topics:
|
本节讨论以下主题:
|
|
034 |
See Also:
Oracle Database Utilities for information about logical backups
|
另见:
Oracle Database Utilities
了解关于逻辑备份的信息
|
|
035 |
Whole Database Backups
|
15.1.2.1 数据库完全备份
|
|
036 |
A whole database backup is a backup of every datafile in
the database, plus the control file. Whole database backups are the most
common type of backup.
|
数据库完全备份(whole database
backup)是数据库内所有数据文件(datafile)及控制文件(control file)的备份。数据库完全备份是最常用的一种备份。
|
|
037 |
Whole database backups can be taken in either
ARCHIVELOG or NOARCHIVELOG mode.
Before performing whole database backups, however, be aware of the implications of backing up in
ARCHIVELOG
and
NOARCHIVELOG modes.
|
运行在
ARCHIVELOG(归档)及 NOARCHIVELOG(非归档)模式下的数据库都可以进行数据库完全备份。在
进行数据库完全备份前,应了解在 ARCHIVELOG
及 NOARCHIVELOG 模式下各种备份方案间的关系。
|
|
038 |
Figure 15-1 illustrates the
valid
configuration options given the type of backup that is performed.
|
图 15-1
显示了进行数据库完全备份时所有可能的备份方案。
|
|
039 |
Figure 15-1 Whole Database
Backup Options
|
图 15-1 数据库完全备份方案
|
|
040 |

|

|
|
041 |
A whole database backup is either a consistent backup or
an inconsistent backup. Whether a backup is consistent
determines whether you need to apply redo logs after restoring the
backup.
|
数据库完全备份既可以是一致性备份(consistent backup)或非一致性备份(inconsistent
backup)。备份的类型决定了使用备份复原(restore)数据库后是否需要应用重做日志(redo log)。
|
|
042 |
Tablespace Backups
|
15.1.2.2 表空间备份
|
|
043 |
A tablespace backup is a backup of the datafiles that constitute the
tablespace. For example, if tablespace users
contains datafiles 2, 3, and 4, then a backup of tablespace
users backs up these three datafiles.
|
表空间备份(tablespace backup)是构成表空间的数据文件(datafile)的备份。例如,如果
users 表空间包含数据文件 2,3,及 4,那么对
users 表空间进行备份时就应备份这三个数据文件。
|
|
044 |
Tablespace backups, whether online or offline, are valid only if the
database is operating in ARCHIVELOG mode.
The reason is that redo is required to make the restored tablespace
consistent with the other tablespaces in the database.
|
表空间备份可以是联机的(online)或脱机的(offline),但数据库必须运行在 ARCHIVELOG(归档)模式下表空间备份才是有效的。因为在使用表空间备份复原(restore)一个表空间后,必须应用重做日志(redo)才能使其与其他表空间保持一致性。
|
|
045 |
Datafile Backups
|
15.1.2.3 数据文件备份
|
|
046 |
A datafile backup is a backup of a single datafile. Datafile backups,
which are not as common as tablespace backups, are valid in
ARCHIVELOG databases. The only time a
datafile backup is valid for a database in
NOARCHIVELOG mode is if:
- Every datafile in a tablespace is
backed up. You cannot restore the database unless all datafiles are
backed up.
- The datafiles are read only or
offline-normal.
|
数据文件备份(datafile backup)是对单个数据文件(datafile)的备份。与表空间备份(tablespace
backup)相比,数据文件备份较少被使用。数据库运行在 ARCHIVELOG(归档)模式下时数据文件备份才有效。但有两种例外情况,数据库运行在
NOARCHIVELOG (非归档)模式下数据文件备份也有效:
- 构成表空间的所有数据文件都进行了备份。用户必须使用所有数据文件来复原数据库。
- 数据文件是只读的或脱机(offline-normal)的。
|
|
047 |
See Also:
Oracle Database Backup and Recovery Reference
|
另见:
Oracle Database Backup and Recovery Reference
|
|
048 |
Control File Backups
|
15.1.2.4 控制文件备份
|
|
049 |
Backing up the control file is a crucial aspect of backup and recovery.
Without a control file, you cannot mount or open the database.
|
备份控制文件(control
file)是备份与恢复(recovery)过程中的重要工作。没有控制文件,数据库将无法挂载(mount)或打开(open)。
|
|
050 |
You can instruct RMAN to automatically backup the control file whenever
you run backup jobs. The command is CONFIGURE
CONTROLFILE AUTOBACKUP. Because the autobackup uses a default
filename, RMAN can restore this backup even if the RMAN repository is
unavailable. Hence, this feature is extremely useful in a disaster
recovery scenario.
|
用户可以利用 RMAN 命令 CONFIGURE
CONTROLFILE AUTOBACKUP
来实现在运行备份作业时自动地备份控制文件。由于自动备份功能(autobackup)使用默认的文件名,即使 RMAN 资料库不可用 RMAN
也能使用备份复原(restore)数据库。因此,这个功能在灾难恢复(disaster recovery)工作中可以发挥重要作用。
|
|
051 |
You can make manual backups of the control file by using the following
methods:
-
The RMAN
BACKUP
CURRENT CONTROLFILE command makes a binary backup of the
control file, as either a backup set or an image copy.
- The SQL statement
ALTER DATABASE BACKUP CONTROLFILE makes
a binary backup of the control file.
- The SQL statement
ALTER DATABASE BACKUP CONTROLFILE TO TRACE
exports the control file contents to a SQL script file. You can use
the script to create a new control file.
Trace file backups have one
major disadvantage: they contain no records of archived redo logs,
and RMAN backups and copies. For this reason, binary backups are
preferable.
|
用户也可以采用以下方式手工备份控制文件:
- RMAN 的 BACKUP
CURRENT CONTROLFILE 命令能够以二进制的格式备份控制文件。备份可以存在于备份集(backup
set)或镜像副本(image copy)中。
- SQL 语句
ALTER DATABASE BACKUP CONTROLFILE
能够以二进制的格式备份控制文件。
- SQL 语句
ALTER DATABASE BACKUP CONTROLFILE TO TRACE
能够将控制文件的内容导出为 SQL 脚本文件。用户可以使用此脚本创建新的控制文件。但跟踪文件备份(trace file
backup)有一个重大缺点。跟踪文件无法备份归档重做日志(archived redo log)及 RMAN
备份与备份副本。因此采用二进制格式的备份更为适宜。
|
|
052 |
See Also:
|
另见:
|
|
053 |
Archived Redo Log Backups
|
15.1.2.5 归档重做日志备份
|
|
054 |
Archived redo logs are essential for recovering an inconsistent backup.
The only way to recover an inconsistent backup without archived logs is
to use RMAN incremental backups. To be able to recover a backup through
the most recent log, every log generated between these two points must
be available. In other words, you cannot recover from log 100 to log 200
if log 173 is missing. If log 173 is missing, then you must halt
recovery at log 172 and open the database with the
RESETLOGS option.
|
在恢复(recover)使用非一致性备份(inconsistent
backup)复原(restore)的数据库时,归档重做日志(archived redo log)必不可少。除非使用了 RMAN
的增量备份(incremental
backup)功能,否则必须利用归档重做日志对非一致性备份进行恢复。如需将一个备份恢复到最新日志点(recent
log),则必须使用从复原点到最新日志点间的所有重做日志。举例来说,如果 173 号重做日志丢失,用户就无法将数据库从 100 号日志点恢复到
200 号日志点。此时用户只能在 172 号日志点处停止恢复,并使用
RESETLOGS 选项打开(open)数据库。
|
|
055 |
Because archived redo logs are essential to recovery, you should back
them up regularly. If possible, then back them up regularly to tape.
|
由于归档重做日志在恢复中必不可少,用户应该周期性地对其进行备份。如条件允许,还应将备份复制到磁带上。
|
|
056 |
You can make backups of archived logs by using the following methods:
- The RMAN BACKUP
ARCHIVELOG command
- The RMAN BACKUP
... PLUS ARCHIVELOG command
- An operating system utility
|
用户可以采用以下方法对归档重做日志进行备份:
- RMAN BACKUP
ARCHIVELOG 命令
- RMAN BACKUP
... PLUS ARCHIVELOG 命令
- 操作系统工具
|
|
057 |
See Also:
|
另见:
|
|
058 |
RMAN and User-Managed Backups
|
15.1.3 RMAN 备份与手工管理备份
|
|
059 |
There are two types of backups: image copies and
backup sets. An image
copy is an exact duplicate of a datafile, control file, or archived log.
You can create image copies of physical files with operating system
utilities or RMAN, and you can restore them as-is without performing
additional processing by using either operating system utilities or
RMAN.
|
备份有两种类型(type):镜像副本(image copy)及备份集(backup
set)。镜像副本是与数据文件(datafile),控制文件(control file)或归档重做日志文件(archived
log)完全一致的副本。用户可以使用操作系统工具或 RMAN 创建镜像副本,也能够使用操作系统工具或 RMAN
直接利用镜像副本恢复数据库,而无须任何额外处理。
|
|
060 |
Note:
Unlike operating system copies, RMAN validates the blocks in the
file and records the copy in the repository.
|
提示:
RMAN 与 操作系统复制的区别在于,RMAN
能够验证备份文件内数据块的有效性,并在资料库中记录复制的情况。
|
|
061 |
A backup set is a backup in a proprietary format that consists of one or
more physical files called backup pieces. It differs from an image copy
in that it can contain more than one database file, and it can also be
backed up using special processing, such as compression or incremental
backup. You must use RMAN to restore a backup set.
|
备份集(backup set)是由被称为备份成员(backup piece)的一个或多个物理文件构成的,其格式为 RMAN
自有格式。备份集与镜像副本的区别在于,备份集内可以包含多个数据文件,且备份过程中可以进行特殊处理,例如压缩或增量备份(incremental
backup)等。备份集必须使用 RMAN 来恢复。
|
|
062 |
RMAN with Online Backups
|
15.1.3.1 使用 RMAN 进行联机备份
|
|
063 |
Because the database continues writing to the file during an online
backup, there is the possibility of backing up inconsistent data within
a block. For example, assume that either RMAN or an operating system
utility reads the block while database writer is in the middle of
updating the block. In this case, RMAN or the copy utility could read
the old data in the top half of the block and the new data in the bottom
top half of the block. The block is a
fractured block, meaning that the
data in this block is not consistent.
|
在联机备份(online
backup)期间数据库仍会向数据文件中写入数据,因此备份中可能存在含有非一致性(inconsistent)数据的数据块(data
block)。例如,RMAN 或操作系统工具在读取数据块的同时,数据库写进程可能会更新相同的数据块。此时,RMAN
或复制工具读取的数据块中既包含新数据,又包含旧数据。这样的数据块是无效块(fractured block),即块内的数据不具备一致性。
|
|
064 |
During an RMAN backup, the Oracle database server reads the datafiles,
not an operating system utility. The server reads each block and
determines whether the block is fractured. If the block is fractured,
then Oracle re-reads the block until it gets a consistent picture of the
data.
|
在使用 RMAN 进行备份时,是 Oracle
数据库服务器而非操作系统工具负责读取数据文件(datafile)。数据库服务器逐一读取数据块并判断其是否有效。如果数据块是无效的,Oracle
会再次读取直道获得了具备一致性的数据块为止。
|
|
065 |
When you back up an online datafile with an operating system utility
(rather than with RMAN), you must use a different method to handle
fractured blocks. You must first place the files in backup mode with the
ALTER TABLESPACE BEGIN BACKUP statement (to
back up an individual tablespace), or the ALTER
DATABASE BEGIN BACKUP statement (to back up the entire database).
After an online backup is completed, you must run the
ALTER TABLESPACE ... END BACKUP or
ALTER DATABASE END BACKUP statement to take
the tablespace out of backup mode.
|
如果用户使用操作系统工具(而非 RMAN)备份联机数据,则需采用另一种方式解决无效块的问题。用户需要首先使用
ALTER TABLESPACE BEGIN BACKUP 语句(备份单独的表空间)或 ALTER
DATABASE BEGIN BACKUP 语句(备份整个数据库)将数据文件置为备份模式(backup
mode)。在联机备份结束后,再使用
ALTER TABLESPACE ... END BACKUP 或
ALTER DATABASE END BACKUP 将相关的数据文件恢复原状态。
|
|
066 |
When updates are made to files in backup mode, additional redo data is
logged. This additional data is needed to repair fractured blocks that
might be backed up by the operating system utility.
|
当数据库对处于备份模式的文件进行修改操作时,系统会记录额外的重做数据(redo data)。这些数据用于修复操作系统工具备份中可能包含的无效块。
|
|
067 |
Introduction to
Recovery
|
15.2 恢复简介
|
|
068 |
To restore a physical backup of a datafile or control file is to
reconstruct it and make it available to the Oracle database server. To
recover a restored datafile is to update it by applying archived redo
logs and online redo logs, that is, records of changes made to the
database after the backup was taken. If you use RMAN, then you can also
recover datafiles with incremental backups, which are backups of a
datafile that contain only blocks that changed after a previous
incremental backup.
|
复原(restore)数据文件(datafile)或控制文件(control file)的物理备份是指利用备份重建这些文件并使其在 Oracle
数据库服务器中正常工作。而对复原的数据文件进行恢复(recover)是指利用归档重做日志(archived redo
log)及联机重做日志(online redo log)对其进行更新,即重做在数据库备份后发生的操作。如果使用了
RMAN,用户也可以使用增量备份(incremental
backup)来恢复数据文件,数据文件的增量备份中只包含其前一次增量备份后修改过的数据块。
|
|
069 |
After the necessary files are restored, media recovery must be initiated
by the user. Media recovery involves various operations to restore, roll
forward, and roll back a backup of database files.
|
当所有文件被复原后,用户还需执行介质恢复(media recovery)的剩余步骤。介质恢复过程包括了对备份数据库文件的复原,前滚(roll
forward)及回滚(roll back)等操作。
|
|
070 |
Media recovery applies archived redo logs and online redo logs to
recover the datafiles. Whenever a change is made to a datafile, the
change is first recorded in the online redo logs. Media recovery
selectively applies the changes recorded in the online and archived redo
logs to the restored datafile to roll it forward.
|
在介质恢复过程中将应用归档重做日志及联机重做日志恢复数据文件。Oracle 每次修改数据文件之前,都会首先将这些修改记录在联机重做日志中。介质恢复过程
就是将归档重做日志及联机重做日志中的相关修改操作记录应用到复原的数据文件中以实现前滚。
|
|
071 |
To correct problems caused by logical data corruptions or user errors,
you can use Oracle Flashback. Oracle Flashback Database and Oracle
Flashback Table let you quickly recover to a previous time.
|
如果用户需要修正逻辑数据错误(logical data corruption)或用户操作失误(user error),可以使用 Oracle
Flashback(回闪)技术。用户利用 Oracle Flashback Database(回闪数据库)及 Oracle Flashback
Table(回闪表)能够将数据迅速恢复到之前某个时间点的状态。
|
|
072 |
Figure 15-2 illustrates the basic
principle of backing up, restoring, and performing media recovery on a
database.
|
图 15-2
显示了数据库备份,复原,及介质恢复的基本原理。
|
|
073 |
Figure 15-2 Media Recovery
|
图 15-2 介质恢复
|
|
074 |

|

|
|
075 |
Figure 15-2 illustrates the concept of restoring
and recovering a database from a backup, following a media
failure. A backup of the database is taken at SCN 100. Media
failure occurs at SCN 600. Redo logs spanning the period from
SCN 100 to SCN 600 have been archived for use in recovery. The
backup from SCN 100 is restored, or copied onto new media. The
redo logs are used to recover the database, performing again
each database change that occurred between the backup and the
point of media failure.
|
图 15-2 显示了数据库介质故障后进行复原及恢复的基本概念。数据库在 SCN 为 100
时进行了备份,在 SCN 为 600 时发生了介质故障。SCN 在 100 至 600
之间的重做日志已经被归档以供恢复只用。用户首先使用 SCN 为 100
时制作的备份复原数据库(复原也可以在新介质上进行)。之后再使用重做日志恢复数据库,即重新执行从备份点到介质故障点之间的所有数据修改操作。
|
|
076 |
Unlike media recovery, Oracle performs
crash recovery and instance
recovery automatically after an instance failure. Crash and instance
recovery recover a database to its transaction-consistent state just
before instance failure. By definition, crash recovery is the recovery
of a database in a single-instance configuration or an Oracle Real
Application Clusters configuration in which all instances have crashed.
In contrast, instance recovery is the recovery of one failed instance by
a live instance in an Oracle Real Application Clusters configuration.
|
与介质恢复不同,Oracle 在实例故障(instance failure)之后能自动地执行崩溃恢复(crash
recovery)及实例恢复(instance
recovery)。崩溃恢复及实例恢复能够在实例故障发生后将数据库恢复到满足事务一致性(transaction-consistent)的状态。崩溃恢复的定义是:单实例系统发生崩溃或
Oracle RAC 系统中所有实例发生崩溃后对数据库进行的恢复。与之相对,实例恢复的定义是:Oracle RAC
系统中正常实例对故障实例进行的恢复。
|
|
077 |
This section contains the following topics:
|
本节包含以下主题:
|
|
078 |
See Also:
|
另见:
|
|
079 |
Overview of Media Recovery
|
15.2.1 介质恢复概述
|
|
080 |
The type of recovery that takes a backup and applies redo is called
media recovery. Media recovery updates a backup to either to the current
or to a specified prior time. Typically, the term "media recovery"
refers to recovery of datafiles. Block media recovery is a more
specialized operation that you use when just a few blocks in one or more
files have been corrupted. In any case, you always use a restored backup
to perform the recovery.
|
先利用备份复原(restore)数据再应用重做日志(redo log)的恢复(recovery)方式被称为介质恢复(media
recovery)。介质恢复能将一个复原的备份更新到当前时间点或之前某个指定的时间点。通常“介质恢复”这个术语专指对数据文件进行恢复的过程。而数据块介质恢复(block
media recovery)指数据文件中的个别数据块出现错误时进行的特殊恢复操作。无论进行哪种恢复,首先都需要使用备份复原数据。
|
|
081 |
This section contains the following topics:
|
本节包含以下主题:
|
|
082 |
Complete Recovery
|
15.2.1.1 完全恢复
|
|
083 |
Complete recovery involves using redo data or incremental backups
combined with a backup of a database, tablespace, or datafile to update
it to the most current point in time. It is called complete because
Oracle applies all of the redo changes contained in the archived and
online logs to the backup. Typically, you perform complete media
recovery after a media failure damages datafiles or the control file.
|
完全恢复(complete
recovery)包括两个步骤:首先使用数据库,表空间或数据文件(datafile)的备份进行复原,再使用重做数据(redo
data)或增量备份(incremental backup)将数据更新到当前时间点。之所以称这样的恢复为完全恢复,是因为 Oracle
将使用归档及联机重做日志(archived and online
log)中的所有重做信息进行恢复,即恢复到当前时间点。通常,当出现介质故障(media failure)导致数据文件或控制文件(control
file)损坏时,需要用户进行介质恢复。
|
|
084 |
You can perform complete recovery on a database, tablespace, or
datafile. If you are performing complete recovery on the whole database,
then you must:
- Mount the database
- Ensure that all datafiles you want to
recover are online
- Restore a backup of the whole database
or the files you want to recover
- Apply online or archived redo logs, or
a combination of the two
|
用户可以对数据库,表空间,数据文件执行完全恢复。用户对整个数据库进行完全恢复时必须满足以下条件:
- 挂载(mount)数据库
- 确保所有需要被恢复的数据文件处于联机(online)状态
- 复原数据库或需要恢复的数据文件
- 应用联机重做日志或/与归档重做日志
|
|
085 |
If you are performing complete recovery on a tablespace or datafile,
then you must:
- Take the tablespace or datafile to be
recovered offline if the database is open
- Restore a backup of the datafiles you
want to recover
- Apply online or archived redo logs, or
a combination of the two
|
用户对表空间及数据文件进行完全恢复时必须满足以下条件:
-
如果数据库处于打开状态,应将需要恢复的表空间或数据文件置为脱机(offline)状态
- 复原需要恢复的数据文件
- 应用联机重做日志或/与归档重做日志
|
|
086 |
Incomplete Recovery
|
15.2.1.2 不完全恢复
|
|
087 |
Incomplete recovery, or point-in-time recovery, uses a backup to produce
a noncurrent version of the database. In other words, you do not apply
all of the redo records generated after the most recent backup. You
usually perform incomplete recovery of the whole database in the
following situations:
- Media failure destroys some or all of
the online redo logs.
- A user error causes data loss, for
example, a user inadvertently drops a table.
- You cannot perform complete recovery
because an archived redo log is missing.
- You lose your current control file and
must use a backup control file to open the database.
|
不完全恢复(incomplete recovery),也被称为按时间点恢复(point-in-time
recovery),指没有将数据库恢复到当前时间点的恢复。换句话说,用户没有将最近一次备份之后产生的所有重做日志应用到复原的数据库上。用户通常在下列情况出现时对数据库进行不完全恢复:
- 介质故障(media failure)导致部分或全部联机重做日志(online
redo log)损坏。
- 用户操作失误(user
error)导致数据丢失,例如,用户由于疏忽而移除了表。
- 由于归档重做日志(archived redo
log)丢失而无法进行完全恢复(complete recovery)。
- 当前控制文件(control
file)丢失,必须使用备份的控制文件打开(open)数据库。
|
|
088 |
To perform incomplete media recovery, you must restore all datafiles
from backups created prior to the time to which you want to recover and
then open the database with the RESETLOGS
option when recovery completes. The
RESETLOGS
operation creates a new incarnation of the database—in other words, a
database with a new stream of log sequence numbers starting with log
sequence 1.
|
执行不完全介质恢复(incomplete media
recovery)时,用户需要使用指定恢复时间点之前的备份复原(restore)数据文件,并在恢复(recovery)结束打开(open)数据库时使用 RESETLOGS
选项。RESETLOGS
选项的含义是使当前的数据库及重做日志有效,即令数据库使用一套新的日志序列号(从 1 开始)。
|
|
089 |
Before using the OPEN RESETLOGS command to
open the database in read/write mode after an incomplete recovery, it is
a good idea to first open the database in read-only mode, and inspect
the data to make sure that the database was recovered to the correct
point. If the recovery was done to the wrong point, then it is easier to
re-run the recovery if no OPEN RESETLOGS
has been done. If you open the database read-only and discover that not
enough recovery was done, then just run the recovery again to the
desired time. If you discover that too much recovery was done, then you
must restore the database again and re-run the recovery.
|
在完成了不完全恢复后,建议不要直接使用 OPEN RESETLOGS
命令以读/写模式打开(open)数据库,而应先以只读模式打开数据库,并检查是否已将数据库恢复到正确的时间点。如果恢复的时间点有误,在没有使用 OPEN RESETLOGS
命令的情况下,重新执行恢复操作相对简单。如果恢复结果早于指定的时间点,只需重新执行恢复操作。如果恢复结果超过了指定的时间点,则应再次复原数据库并重新进行恢复。
|
|
090 |
Note:
Flashback Database is
another way to perform incomplete recovery.
|
提示:
Flashback Database(回闪数据库)也是一种进行不完全恢复的方法。
|
|
091 |
See Also:
"Overview of Oracle Flashback Database"
|
另见:
“Oracle Flashback Database 概述”
|
|
092 |
Tablespace Point-in-Time Recovery
|
15.2.1.2.1 表空间按时间点恢复
|
|
093 |
The tablespace point-in-time recovery (TSPITR) feature lets you recover
one or more tablespaces to a point in time that is different from the
rest of the database. TSPITR is most useful when you want to:
- Recover from an erroneous drop or
truncate table operation
- Recover a table that has become
logically corrupted
- Recover from an incorrect batch job or
other DML statement that has affected only a subset of the database
- Recover one independent schema to a
point different from the rest of a physical database (in cases where
there are multiple independent schemas in separate tablespaces of
one physical database)
- Recover a tablespace on a very large
database (VLDB) rather than restore the whole database from a backup
and perform a complete database roll-forward
|
用户使用表空间按时间点恢复(tablespace point-in-time recovery,TSPITR)功能可以将一个或多个表空间恢复到与数据库中其他表空间不同的时间点。TSPITR
对以下情况最为适用:
- 因错误地移除(drop)及清除(truncate)表而进行的恢复
- 恢复存在逻辑错误的表
- 由于不正确的批处理作业或其他 DML
语句导致数据库中部分数据有误,因而需要恢复
-
单独将某个方案(schema)恢复到与物理数据库中其他方案不同的时间点(假设数据库中不同的方案使用不同的表空间)
- 恢复大型数据库(very large database,VLDB)中的一个表空间,而不必先使用备份复原整个数据库再执行所有前滚(roll-forward)操作
|
|
094 |
TSPITR has the following limitations:
- You cannot use it on the
SYSTEM tablespace, an
UNDO tablespace, or any tablespace that
contains rollback segments.
- Tablespaces that contain
interdependent data must be recovered together. For example, if two
tables are in separate tablespaces and have a foreign key
relationship, then both tablespaces must be recovered at the same
time; you cannot recover just one of them. Oracle can enforce this
limitation when it detects data relationships that have been
explicitly declared with database constraints. There could be other
data relationships that are not declared with database constraints.
Oracle cannot detect these, and the DBA must be careful to always
restore a consistent set of tablespaces.
|
TSPITR 功能存在以下限制:
- SYSTEM
表空间,UNDO 表空间,或任何包含回滚段(rollback
segment)的表空间无法使用 TSPITR 功能。
-
如果几个表空间中存在相互依赖的数据,则她们必须同时进行恢复操作。例如,两个表位于不同的表空间中且存在外键关系(foreign key
relationship),那么这两个表空间必须同时恢复。如果 Oracle 发现了通过数据库约束(database
constraint)显式地声明的数据间关系,就将强制保证这种恢复的同时性。在数据库中,有些数据关系可能没有通过数据库约束显式地声明。Oracle
无法发现这样的关系,此时 DBA 必须确保相关表空间在恢复时满足一致性的要求。
|
|
095 |
See Also:
Oracle Database Backup and Recovery Advanced User's Guide and
Oracle Database Backup and Recovery Reference for more
information on TSPITR
|
另见:
Oracle Database Backup and Recovery Advanced User's Guide
及
Oracle Database Backup and Recovery Reference
了解关于 TSPITR 的详细信息
|
|
096 |
Incomplete Media Recovery Options
|
15.2.1.2.2 不完全介质恢复选项
|
|
097 |
Because you are not completely recovering the database to the most
current time, you must tell Oracle when to terminate recovery. You can
perform the following types of media recovery.
|
在不完全恢复(incomplete recovery)中,由于没有将数据库恢复到当前时间点,用户必须告知 Oracle
在何时终止恢复(recovery)。介质恢复有以下几种类型。
|
|
098 |
|
| Type of Recovery |
Function |
|
| Time-based recovery |
Recovers the data up to a specified point in
time.
|
| Cancel-based recovery |
Recovers until you issue the
CANCEL statement
(not available when using
Recovery Manager).
|
Change-based recovery
|
Recovers until the specified SCN. |
| Log sequence recovery |
Recovers until the specified log sequence
number (only available when using Recovery Manager).
|
|
|
恢复的类型
|
功能
|
|
基于时间的恢复(Time-based recovery)
|
将数据恢复到指定的时间点。
|
| 用户控制的恢复(Cancel-based recovery) |
当用户提交
CANCEL 语句后停止恢复操作(此选项在使用 Recovery Manager(恢复管理器)时无效).
|
基于 SCN 的恢复(Change-based recovery)
|
将数据恢复到指定的 SCN。 |
按重做日志序号恢复(Log sequence recovery)
|
将数据恢复到指定的重做日志序号 (此选项只在使用 Recovery Manager 时有效)。
|
|
|
099 |
Datafile Media Recovery
|
15.2.1.3 数据文件介质恢复
|
|
100 |
Datafile media recovery is used to recover from a lost or damaged
current datafile or control file. It is also used to recover changes
that were lost when a tablespace went offline without the
OFFLINE NORMAL option. Both datafile media
recovery and instance recovery must repair database integrity. However,
these types of recovery differ with respect to their additional
features. Media recovery has the following characteristics:
- Applies changes to restored backups of
damaged datafiles.
- Can use archived logs as well as
online logs.
- Requires explicit invocation by a
user.
- Does not detect media failure (that
is, the need to restore a backup) automatically. After a backup has
been restored, however, detection of the need to recover it through
media recovery is automatic.
- Has a recovery time governed solely by
user policy (for example, frequency of backups, parallel recovery
parameters, number of database transactions since the last backup)
rather than by Oracle internal mechanisms.
|
数据文件介质恢复(datafile media recovery)用于对丢失或损坏的数据文件(datafile)及控制文件(control
file)进行恢复(recover)。她也可恢复因没有使用
OFFLINE NORMAL
选项执行脱机操作而造成数据丢失的表空间。数据文件介质恢复及实例恢复(instance recovery)的作用都是修复数据库完整性(database
integrity)。但是这两种恢复各有所不同。数据文件介质恢复具有以下特点:
- 能够将数据修改应用到被复原(restore)的受损数据文件中。
- 能够使用归档重做日志(archived redo log)及联机重做日志(online
redo log)。
- 需要用户显式的执行。
- 不能自动地检测介质故障(media
failure)(即不能自动地执行复原操作)。但在使用备份进行复原后,能够自动地检测是否需要通过介质恢复(media
recovery)来恢复数据。
-
恢复所需时间完全由用户的备份恢复策略(例如,备份的频率,并行恢复参数,上次备份后数据库内的事务量)决定,而与 Oracle
内部机制无关。
|
|
101 |
The database cannot be opened if any of the online datafiles needs media
recovery, nor can a datafile that needs media recovery be brought online
until media recovery is complete. The following scenarios necessitate
media recovery:
- You restore a backup of a datafile.
- You restore a backup control file
(even if all datafiles are current).
- A datafile is taken offline (either by
you or automatically by Oracle) without the
OFFLINE NORMAL option.
|
如果数据库内存在需要介质恢复(media recovery)的联机数据文件(online
datafile),那么此数据库将无法打开(open),如果一个数据文件需要介质恢复,那么此文件将无法联机。在出现以下情况时需要进行介质恢复:
- 使用备份复原了一个数据文件。
- 使用备份复原了一个控制文件(即使此时所有数据文件都是最新的)。
- 将数据文件脱机(offline)时(无论是用户手动执行的,还是
Oracle 自动执行的)没有使用
OFFLINE NORMAL 选项。
|
|
102 |
Unless the database is not open by any instance, datafile media recovery
can only operate on offline datafiles. You can initiate datafile media
recovery before opening a database even when crash recovery would have
sufficed. If so, crash recovery still runs automatically at database
open.
|
如果数据库已经被一个实例打开,数据文件介质恢复将只能针对脱机数据文件。即便数据库只需进行崩溃恢复(crash
recovery),用户也可以在数据库打开前执行介质恢复。此时,崩溃恢复仍会在数据库打开时自动运行。
|
|
103 |
Note that when a file requires media recovery, you must perform media
recovery even if all necessary changes are contained in the online logs.
In other words, you must still run recovery even though the archived
logs are not needed. Media recovery could find nothing to do — and
signal the "no recovery required" error — if invoked for files that do
not need recovery.
|
需要注意的是,如果一个文件需要介质恢复,即使所有对此文件的修改都包含在联机重做日志文件中也必须进行介质恢复。也就是说,即使无需应用归档重做日志也必须进行介质恢复。如果对无需恢复的数据文件执行了介质恢复,那么介质恢复将发现自己无需进行任何处理,并发出“no
recovery required(无需恢复)”错误。
|
|
104 |
Block Media Recovery
|
15.2.1.4 数据块介质恢复
|
|
105 |
Block media recovery is a technique for restoring and recovering
individual data blocks while all database files remain online and
available. If corruption is limited to only a few blocks among a subset
of database files, then block media recovery might be preferable to
datafile recovery.
|
数据块介质恢复(block media
recovery)能够在所有数据文件联机且可用的情况下对个别的数据块进行复原(restore)及恢复(recover)。如果数据错误局限在某些数据文件的少量数据块中,此时适宜采用数据块介质恢复来对数据文件进行恢复。
|
|
106 |
The interface to block media recovery is provided by RMAN. If you do not
already use RMAN as your principal backup and recovery solution, then
you can still perform block media recovery by cataloging into the RMAN
repository the necessary user-managed datafile and archived redo log
backups.
|
数据块介质恢复是通过 RMAN 来执行的。如果用户没有使用 RMAN 作为数据库的备份方案,可以向 RMAN
资料库(repository)中添加相关的用户管理的数据文件(user-managed
datafile)信息及归档重做日志备份(archived redo log backup)信息,这样也能使用 RMAN 进行数据块介质恢复。
|
|
107 |
See Also:
Oracle Database Backup and Recovery Reference for information on
how to catalog user-managed datafile and archived log backups and to
perform block media recovery
|
另见:
Oracle Database Backup and Recovery Reference
了解如何向 RMAN 资料库中添加相关的用户管理的数据文件信息及归档重做日志备份信息,从而执行数据块介质恢复。
|
|
108 |
Overview of RMAN and User-Managed Restore and
Recovery
|
15.2.2 RMAN 与手工管理的复原及恢复概述
|
|
109 |
You have a choice between two basic methods for recovering physical
files. You can:
- Use the RMAN utility to restore and
recover the database
- Restore backups by means of operating
system utilities, and then recover by running the SQL*Plus
RECOVER command
|
用户在恢复(recover)物理文件时有两种选择:
- 使用 RMAN 来复原(restore)及恢复数据库
- 使用操作系统工具复原备份,并使用 SQL*Plus 的
RECOVER 命令进行恢复
|
|
110 |
Whichever method you choose, you can recover a database, tablespace, or
datafile. Before performing media recovery, you need to determine which
datafiles to recover. Often you can use the
fixed view
V$RECOVER_FILE. This view lists all files
that require recovery and explains the error that necessitates recovery.
|
上述两种方法均可以对数据库,表空间,或数据文件(datafile)进行恢复。在进行介质恢复(media
recovery)之前,用户应首先确定哪些数据文件需要被恢复。相关信息可以从固定视图(fixed view)V$RECOVER_FILE
中获得。此视图记录了所有需要被恢复的文件及导致问题的原因。
|
|
111 |
See Also:
Oracle Database Backup and Recovery Reference for more about
using V$ views in a recovery scenario
|
另见:
Oracle Database Backup and Recovery Reference
了解在执行恢复操作时如何使用 V$ 视图
|
|
112 |
RMAN Restore and Recovery
|
15.2.2.1 RMAN 复原及恢复
|
|
113 |
The basic RMAN recovery commands are RESTORE
and RECOVER. Use
RESTORE to restore datafiles from backup sets or from image
copies on disk, either to their current location or to a new location.
You can also restore backup sets containing archived redo logs, but this
is usually unnecessary, because RMAN automatically restores the archived
logs that are needed for recovery and deletes them after the recovery is
finished. Use the RMAN RECOVER command to
perform media recovery and apply archived logs or incremental backups.
|
RMAN 恢复中最基础的命令是 RESTORE
和 RECOVER。RESTORE
命令可以使用备份集(backup set)或镜像副本(image
copy)将数据文件复原(restore)到原始位置或新位置。用户可以复原备份集中的归档重做日志(archived redo
log),但通常无需手工执行此类操作,因为 RMAN
能根据恢复(recovery)的需要自动地复原归档重做日志,并在恢复结束后自动地删除。RMAN 的 RECOVER
命令用于执行介质恢复(media recovery),将归档重做日志或增量备份(incremental backup)应用到复原后的数据文件中。
|
|
114 |
RMAN automates the procedure for recovering and restoring your backups
and copies.
|
RMAN 使复原及恢复工作更加自动化。
|
|
115 |
See Also:
Oracle Database Backup and Recovery Reference for details about
how to restore and recover using RMAN
|
另见:
Oracle Database Backup and Recovery Reference
了解关于使用 RMAN 进行复原及恢复的详细信息
|
|
116 |
User-Managed Restore and Recovery
|
15.2.2.2 手工管理的复原及恢复
|
|
117 |
If you do not use RMAN, then you can restore backups with operating
system utilities and then run the SQL*Plus RECOVER
command to recover the database. You should follow these basic steps:
- After identifying which files are
damaged, place the database in the appropriate state for restore and
recovery. For example, if some but not all datafiles are damaged,
then take the affected tablespaces offline while the database is
open.
- Restore the files with an operating
system utility. If you do not have a backup, it is sometimes
possible to perform recovery if you have the necessary redo logs
dating from the time when the datafiles were first created and the
control file contains the name of the damaged file.
- If you cannot restore a datafile to
its original location, then relocate the restored datafile and
change the location in the control file.
Restore any necessary archived redo log files.
- Use the SQL*Plus
RECOVER command to recover the datafile backups.
|
如果没有采用 RMAN,可以使用操作系统工具复原(restore)备份并使用 SQL*Plus 的 RECOVER
命令恢复(recover)数据库。上述过程包含以下基本步骤:
-
首先确定哪些文件需要被恢复,之后将数据库置于适当的状态,以便进行复原及恢复操作。例如,数据库中只有部分数据文件损坏时,可以在打开(open)数据库时
令受影响的表空间脱机(offline)。
-
使用操作系统工具从备份中复原数据文件。在没有备份的情况下,如果
|