Rman Command Examples
Rman Command Examples
Rman Command Examples
December 2003
Oracle Database Recovery Manager Reference, 10g Release 1 (10.1)
Contributors: Anand Beldalker, Tammy Bednar, Senad Dizdar, Muthu Olagappan, Francisco Sanchez,
Steve Wertheimer
The Programs (which include both the software and documentation) contain proprietary information of
Oracle Corporation; they are provided under a license agreement containing restrictions on use and
disclosure and are also protected by copyright, patent and other intellectual and industrial property
laws. Reverse engineering, disassembly or decompilation of the Programs, except to the extent required
to obtain interoperability with other independently created software or as specified by law, is prohibited.
The information contained in this document is subject to change without notice. If you find any problems
in the documentation, please report them to us in writing. Oracle Corporation does not warrant that this
document is error-free. Except as may be expressly permitted in your license agreement for these
Programs, no part of these Programs may be reproduced or transmitted in any form or by any means,
electronic or mechanical, for any purpose, without the express written permission of Oracle Corporation.
If the Programs are delivered to the U.S. Government or anyone licensing or using the programs on
behalf of the U.S. Government, the following notice is applicable:
Restricted Rights Notice Programs delivered subject to the DOD FAR Supplement are "commercial
computer software" and use, duplication, and disclosure of the Programs, including documentation,
shall be subject to the licensing restrictions set forth in the applicable Oracle license agreement.
Otherwise, Programs delivered subject to the Federal Acquisition Regulations are "restricted computer
software" and use, duplication, and disclosure of the Programs shall be subject to the restrictions in FAR
52.227-19, Commercial Computer Software - Restricted Rights (June, 1987). Oracle Corporation, 500
Oracle Parkway, Redwood City, CA 94065.
The Programs are not intended for use in any nuclear, aviation, mass transit, medical, or other inherently
dangerous applications. It shall be the licensee's responsibility to take all appropriate fail-safe, backup,
redundancy, and other measures to ensure the safe use of such applications if the Programs are used for
such purposes, and Oracle Corporation disclaims liability for any damages caused by such use of the
Programs.
Oracle is a registered trademark, and Oracle Store, Oracle7, Oracle8, Oracle8i, Oracle9i, PL/SQL, and
SQL*Plus are trademarks or registered trademarks of Oracle Corporation. Other names may be
trademarks of their respective owners.
Contents
Preface............................................................................................................................................................ ix
2 RMAN Commands
Summary of RMAN Commands...................................................................................................... 2-2
@ ............................................................................................................................................................. 2-6
@@ .......................................................................................................................................................... 2-7
ALLOCATE CHANNEL .................................................................................................................... 2-8
ALLOCATE CHANNEL FOR MAINTENANCE........................................................................ 2-12
allocOperandList............................................................................................................................... 2-15
ALTER DATABASE.......................................................................................................................... 2-19
archivelogRecordSpecifier .............................................................................................................. 2-22
BACKUP ............................................................................................................................................. 2-28
BLOCKRECOVER............................................................................................................................ 2-61
CATALOG .......................................................................................................................................... 2-66
CHANGE............................................................................................................................................ 2-70
cmdLine .............................................................................................................................................. 2-74
completedTimeSpec ......................................................................................................................... 2-79
CONFIGURE ..................................................................................................................................... 2-81
iii
CONNECT.......................................................................................................................................... 2-99
connectStringSpec........................................................................................................................... 2-102
CONVERT ........................................................................................................................................ 2-104
CREATE CATALOG ....................................................................................................................... 2-111
CREATE SCRIPT............................................................................................................................. 2-113
CROSSCHECK................................................................................................................................ 2-116
datafileSpec ...................................................................................................................................... 2-119
DELETE............................................................................................................................................. 2-121
DELETE SCRIPT............................................................................................................................. 2-125
deviceSpecifier................................................................................................................................. 2-127
DROP CATALOG ........................................................................................................................... 2-129
DROP DATABASE ......................................................................................................................... 2-131
DUPLICATE..................................................................................................................................... 2-133
EXECUTE SCRIPT .......................................................................................................................... 2-143
EXIT ................................................................................................................................................... 2-145
fileNameConversionSpec .............................................................................................................. 2-146
FLASHBACK ................................................................................................................................... 2-149
formatSpec........................................................................................................................................ 2-154
HOST................................................................................................................................................. 2-158
keepOption....................................................................................................................................... 2-161
LIST ................................................................................................................................................... 2-163
listObjList......................................................................................................................................... 2-184
maintQualifier ................................................................................................................................. 2-187
maintSpec ......................................................................................................................................... 2-189
obsOperandList ............................................................................................................................... 2-192
PRINT SCRIPT................................................................................................................................ 2-194
QUIT.................................................................................................................................................. 2-196
recordSpec ........................................................................................................................................ 2-197
RECOVER......................................................................................................................................... 2-199
REGISTER........................................................................................................................................ 2-211
RELEASE CHANNEL .................................................................................................................... 2-213
releaseForMaint............................................................................................................................... 2-215
REPLACE SCRIPT .......................................................................................................................... 2-216
REPORT ............................................................................................................................................ 2-219
RESET DATABASE ........................................................................................................................ 2-227
iv
RESTORE ......................................................................................................................................... 2-230
RESYNC............................................................................................................................................ 2-245
RUN ................................................................................................................................................... 2-248
SEND................................................................................................................................................. 2-251
SET..................................................................................................................................................... 2-253
SHOW ............................................................................................................................................... 2-262
SHUTDOWN................................................................................................................................... 2-265
SPOOL .............................................................................................................................................. 2-268
SQL .................................................................................................................................................... 2-270
STARTUP.......................................................................................................................................... 2-272
SWITCH ........................................................................................................................................... 2-275
UNREGISTER DATABASE .......................................................................................................... 2-279
untilClause ....................................................................................................................................... 2-281
UPGRADE CATALOG .................................................................................................................. 2-284
VALIDATE ....................................................................................................................................... 2-286
v
RC_LOG_HISTORY ......................................................................................................................... 3-33
RC_OFFLINE_RANGE .................................................................................................................... 3-34
RC_PROXY_ARCHIVEDLOG ....................................................................................................... 3-35
RC_PROXY_CONTROLFILE ......................................................................................................... 3-37
RC_PROXY_DATAFILE................................................................................................................... 3-39
RC_REDO_LOG................................................................................................................................ 3-41
RC_REDO_THREAD ....................................................................................................................... 3-42
RC_RESYNC ...................................................................................................................................... 3-43
RC_RMAN_CONFIGURATION ................................................................................................... 3-44
RC_RMAN_STATUS........................................................................................................................ 3-45
RC_STORED_SCRIPT..................................................................................................................... 3-47
RC_STORED_SCRIPT_LINE ......................................................................................................... 3-48
RC_TABLESPACE............................................................................................................................. 3-49
B RMAN Compatibility
About RMAN Compatibility............................................................................................................ B-2
RMAN Compatibility Matrix ........................................................................................................... B-3
RMAN Compatibility: Scenario....................................................................................................... B-4
Index
vi
Send Us Your Comments
Oracle Database Recovery Manager Reference, 10g Release 1 (10.1)
Part No. B10770-01
Oracle Corporation welcomes your comments and suggestions on the quality and usefulness of this
document. Your input is an important part of the information used for revision.
■ Did you find any errors?
■ Is the information clearly presented?
■ Do you need more information? If so, where?
■ Are the examples correct? Do you need more examples?
■ What features did you like most?
If you find any errors or have any other suggestions for improvement, please indicate the document
title and part number, and the chapter, section, and page number (if available). You can send com-
ments to us in the following ways:
■ Electronic mail: [email protected]
■ FAX: (650) 506-7227 Attn: Server Technologies Documentation Manager
■ Postal service:
Oracle Corporation
Server Technologies Documentation
500 Oracle Parkway, Mailstop 4op11
Redwood Shores, CA 94065
USA
If you would like a reply, please give your name, address, telephone number, and (optionally) elec-
tronic mail address.
If you have problems with the software, please contact your local Oracle Support Services.
vii
viii
Preface
ix
Audience
Recovery Manager Reference is intended for database administrators who perform
the following tasks:
■ Back up, restore, and recover Oracle databases
■ Perform maintenance on backups and copies of database files
To use this document, you need to know the following:
■ Relational database concepts and basic database administration as described in
Oracle Database Concepts and the Oracle Database Administrator's Guide
■ Basic RMAN concepts and tasks as described in Oracle Database Backup and
Recovery Basics
■ The operating system environment under which you are running Oracle
Organization
This document contains:
x
Related Documentation
For more information, see these Oracle resources:
■ Oracle Database Backup and Recovery Basics
■ Oracle Database Utilities
■ http://www.oracle.com/database/recovery
Many of the examples in this book use the sample schemas of the seed database,
which is installed by default when you install Oracle. Refer to Oracle Database
Sample Schemas for information on how these schemas were created and how you
can use them yourself.
Printed documentation is available for sale in the Oracle Store at
http://oraclestore.oracle.com/
If you already have a username and password for OTN, then you can go directly to
the documentation section of the OTN Web site at
http://otn.oracle.com/documentation/
Conventions
This section describes the conventions used in the text and code examples of this
documentation set. It describes:
■ Conventions in Text
■ Conventions in Code Examples
Conventions in Text
We use various conventions in text to help you more quickly identify special terms.
The following table describes those conventions and provides examples of their use.
xi
Convention Meaning Example
Bold Bold typeface indicates terms that are When you specify this clause, you create an
defined in the text or terms that appear in index-organized table.
a glossary, or both.
Italics Italic typeface indicates book titles or Oracle Database Concepts
emphasis.
Ensure that the recovery catalog and target
database do not reside on the same disk.
UPPERCASE Uppercase monospace typeface indicates You can specify this clause only for a NUMBER
monospace elements supplied by the system. Such column.
(fixed-width) elements include parameters, privileges,
You can back up the database by using the
font datatypes, RMAN keywords, SQL
BACKUP command.
keywords, SQL*Plus or utility commands,
packages and methods, as well as Query the TABLE_NAME column in the USER_
system-supplied column names, database TABLES data dictionary view.
objects and structures, usernames, and
Use the DBMS_STATS.GENERATE_STATS
roles.
procedure.
lowercase Lowercase monospace typeface indicates Enter sqlplus to open SQL*Plus.
monospace executables, filenames, directory names,
The password is specified in the orapwd file.
(fixed-width) and sample user-supplied elements. Such
font elements include computer and database Back up the datafiles and control files in the
names, net service names, and connect /disk1/oracle/dbs directory.
identifiers, as well as user-supplied
The department_id, department_name,
database objects and structures, column
and location_id columns are in the
names, packages and classes, usernames
hr.departments table.
and roles, program units, and parameter
values. Set the QUERY_REWRITE_ENABLED
initialization parameter to true.
Note: Some programmatic elements use a
mixture of UPPERCASE and lowercase. Connect as oe user.
Enter these elements as shown.
The JRepUtil class implements these
methods.
lowercase Lowercase italic monospace font You can specify the parallel_clause.
italic represents placeholders or variables.
Run Uold_release.SQL where old_
monospace
release refers to the release you installed
(fixed-width)
prior to upgrading.
font
xii
SELECT username FROM dba_users WHERE username = ’MIGRATE’;
The following table describes typographic conventions used in code examples and
provides examples of their use.
xiii
Convention Meaning Example
UPPERCASE Uppercase typeface indicates elements SELECT last_name, employee_id FROM
supplied by the system. We show these employees;
terms in uppercase in order to distinguish SELECT * FROM USER_TABLES;
them from terms you define. Unless terms DROP TABLE hr.employees;
appear in brackets, enter them in the
order and with the spelling shown.
However, because these terms are not
case sensitive, you can enter them in
lowercase.
lowercase Lowercase typeface indicates SELECT last_name, employee_id FROM
programmatic elements that you supply. employees;
For example, lowercase indicates names sqlplus hr/hr
of tables, columns, or files. CREATE USER mjones IDENTIFIED BY ty3MU9;
Note: Some programmatic elements use a
mixture of UPPERCASE and lowercase.
Enter these elements as shown.
Documentation Accessibility
Our goal is to make Oracle products, services, and supporting documentation
accessible, with good usability, to the disabled community. To that end, our
documentation includes features that make information available to users of
assistive technology. This documentation is available in HTML format, and contains
markup to facilitate access by the disabled community. Standards will continue to
evolve over time, and Oracle Corporation is actively engaged with other
market-leading technology vendors to address technical obstacles so that our
documentation can be accessible to all of our customers. For additional information,
visit the Oracle Accessibility Program Web site at
http://www.oracle.com/accessibility/
xiv
evaluates nor makes any representations regarding the accessibility of these Web
sites.
xv
xvi
1
About RMAN Commands
This chapter describes the basic elements of RMAN syntax. It includes the following
sections:
■ Conventions Used in this Reference
■ RMAN Command Entries
Syntax Diagrams
This reference uses syntax diagrams to show Recovery Manager commands. These
syntax diagrams use lines and arrows to show syntactic structure, as shown in
Figure 1–1.
catalog
ARCHIVELOG
, =
BACKUPPIECE LEVEL integer
’ filename ’
CONTROLFILECOPY
DATAFILECOPY
CATALOG ;
RECOVERY AREA
NOPROMPT
DB_RECOVERY_FILE_DEST
START WITH ’ string_pattern ’
This section describes the components of syntax diagrams and gives examples of
how to write RMAN commands. Syntax diagrams are made up of these items:
■ Keywords
■ Placeholders
Note that examples are set off from the text and appear in a monospace font.
Note: Optional sections following the examples provide more information on how
and when to use the statement.
Syntax
at::=
@ filename
Purpose
To execute a series of RMAN commands stored in an operating system file with the
specified full path name, for example, @/oracle/dbs/cmd/cmd1.rman. If you do
not specify the full path name, then the current working directory is assumed, for
example, @cmd1.rman. Do not use quotes around the string or leave whitespace
between the @ and filename. RMAN processes the specified file as if its contents had
appeared in place of the @ command.
Example
Running a Command File from the Command Line: Example This example
creates a command file and then runs it from the operating system command line:
echo "BACKUP DATABASE;" > backup_db.rman
rman TARGET / @backup_db.rman
Running a Command File Within RMAN: Example This example runs a command
file from the RMAN prompt and from within a RUN command:
@backup_db.rman
RUN { @backup_db.rman }
@@
Syntax
atat::=
@@ filename
Purpose
To execute a series of RMAN commands stored in an operating system file with the
specified filename, for example, @@cmd2.rman. If @@ is contained in a command
file, then @@filename directs RMAN to look for the specified filename in the same
directory as the command file from which it was called. If not used within a
command file, the @@ command is identical to the @ command. For example,
assume that you invoke RMAN as follows:
% rman @$ORACLE_HOME/rdbms/admin/dba/scripts/cmd1.rman
Assume that the command @@cmd2.rman appears inside the cmd1.rman script. In
this case, the @@ command directs RMAN to look for the file cmd2.rman in the
directory $ORACLE_HOME/rdbms/admin/dba/scripts/. Note that the file must
contain complete RMAN commands.
Example
Calling a Command File Within Another Command File: Example Assume that
you create command files called backup_logs.rman and backup_db.rman as in
the following example. Then, you execute bkup_db.rman from the command line,
which specifies that RMAN should look for the bkup_logs.rman script in the
Oracle home directory:
echo "BACKUP ARCHIVELOG ALL;" > $ORACLE_HOME/bkup_logs.rman
echo "BACKUP DATABASE;" > $ORACLE_HOME/bkup_db.rman
echo "@@bkup_logs.rman" >> $ORACLE_HOME/bkup_db.rman
rman TARGET / @$ORACLE_HOME/bkup_db.rman
ALLOCATE CHANNEL
Syntax
allocate::=
allocate
AUXILIARY = ’ ’
ALLOCATE CHANNEL channel_id
allocate1
= allocOperandList
DEVICE TYPE deviceSpecifier ;
Purpose
To manually allocate a channel, which is a connection between RMAN and a
database instance. Each connection initiates an database server session on the target
or auxiliary instance: this server session performs the work of backing up, restoring,
or recovering RMAN backups.
Manually allocated channels (allocated by using ALLOCATE) should be
distinguished from automatically allocated channels (specified by using
CONFIGURE). Manually allocated channels apply only to the RUN job in which you
issue the command. Automatic channels apply to any RMAN job in which you do
not manually allocate channels. You can always override automatic channel
configurations by manually allocating channels within a RUN command.
Each channel operates on one backup set or image copy at a time. RMAN
automatically releases the channel at the end of the job.
You can control the degree of parallelism within a job by allocating the desired
number of channels. Allocating multiple channels simultaneously allows a single
job to read or write multiple backup sets or disk copies in parallel. If you establish
multiple connections, then each connection operates on a separate backup set or
disk copy.
Whether ALLOCATE CHANNEL causes operating system resources to be allocated
immediately depends on the operating system. On some platforms, operating
system resources are allocated at the time the command is issued. On other
platforms, operating system resources are not allocated until you open a file for
reading or writing.
Examples
Syntax
allocateForMaint::=
allocateForMaint
ALLOCATE CHANNEL FOR MAINTENANCE
allocate1
= allocOperandList
DEVICE TYPE deviceSpecifier ;
Purpose
To manually allocate a channel in preparation for issuing a CHANGE, DELETE,or
CROSSCHECK command. Note that if you use CONFIGURE to set up automatic
channels, then RMAN can use these automatic channels for maintenance
operations; you do not have to manually allocate them.
If RMAN allocates the automatic maintenance channel for you, then it uses the
same naming convention as any other automatically allocated channel. If you
explicitly invoke ALLOCATE CHANNEL FOR MAINTENANCE, then RMAN uses the
following convention for channel naming: ORA_MAINT_devicetype_n, where
devicetype refers to DISK or sbt and n refers to the channel number. For example,
RMAN uses these names for two manually allocated disk channels:
ORA_MAINT_DISK_1
ORA_MAINT_DISK_2
You can allocate multiple maintenance channels for a single job, but you should
only use this feature in these scenarios:
■ To allow crosschecking or deletion of all backup pieces or proxy copies, both on
disk and tape, with a single command
■ To make crosschecking and deleting work correctly in an Oracle Real
Application Clusters configuration in which each backup piece or proxy copy
exists only on one node
Examples
Deleting a Backup Set: Example This example deletes backup sets from tape
created more than a week ago:
ALLOCATE CHANNEL FOR MAINTENANCE DEVICE TYPE sbt;
DELETE NOPROMPT BACKUP OF DATABASE COMPLETED BEFORE 'SYSDATE-7';
Deleting on Disk and sbt Channels with One Command: Example In this
example, you delete a backup from both disk and tape:
# back up datafile to disk and tape
BACKUP DEVICE TYPE DISK DATAFILE 1 TAG "weekly_bkup";
BACKUP DEVICE TYPE sbt DATAFILE 1 TAG "weekly_bkup";
allocOperandList
Syntax
allocOperandList::=
allocOperandList
=
CONNECT ’ connect_string ’
,
=
FORMAT formatSpec
=
MAXOPENFILES integer
=
MAXPIECESIZE sizeSpec
=
PARMS ’ channel_parms ’
=
RATE sizeSpec
=
SEND ’ command ’
Purpose
A subclause specifying control options on a channel, which is a connection between
RMAN and a database instance. Specify this clause on the following commands:
■ ALLOCATE CHANNEL
■ ALLOCATE CHANNEL FOR MAINTENANCE
■ CONFIGURE
'SBT_LIBRARY = Specifies which media library should be used on this sbt channel. The
lib_name' default library is operating system specific (for example, libobk.so in the
Solaris Operating Environment and ORASBT.DLL on Windows NT). For
example:
PARMS="SBT_LIBRARY=/oracle/lib/mmv.so"
RATE = integer Sets the maximum number of bytes (default), kilobytes (K), megabytes (M), or
gigabytes (G) that RMAN reads each second on this channel. This parameter
sets an upper limit for bytes read so that RMAN does not consume too much
disk bandwidth and degrade performance.
SEND 'command' Sends a vendor-specific command string to all allocated channels.
See Also: Your media manager documentation to see whether this feature is
supported and when it should be used.
Examples
ALTER DATABASE
Syntax
alterDatabase::=
alterDatabase
MOUNT
ALTER DATABASE RESETLOGS ;
OPEN
Purpose
To mount or open a database.
Examples
Opening the Database After a Backup: Example This example mounts the
database, takes a whole database backup, then opens the database. At the RMAN
prompt enter:
STARTUP MOUNT;
BACKUP DATABASE;
# now that the backup is complete, open the database.
ALTER DATABASE OPEN;
Mounting the Database After Restoring the Control File: Example To restore the
control file to its default location when connected to a recovery catalog, enter the
following:
STARTUP NOMOUNT;
RESTORE CONTROLFILE;
ALTER DATABASE MOUNT;
# you must run the RECOVER command after restoring a control file even if no datafiles
# require recovery
RECOVER DATABASE;
ALTER DATABASE OPEN RESETLOGS;
# if the database uses locally-managed temporary tablespaces, then you must add tempfiles
# to these tablespaces after restoring a backup control file
SQL " ALTER TABLESPACE temp ADD TEMPFILE ''?/oradata/trgt/temp01.dbf'' REUSE";
archivelogRecordSpecifier
Syntax
archivelogRecordSpecifier::=
archivelogRecordSpecifier
ALL
=
THREAD integer
ARCHIVELOG
LIKE ’ string_pattern ’
archlogRange
LIKE ’ string_pattern ’
archlogRange::=
archlogRange
=
FROM SCN integer
SCN BETWEEN integer AND integer
=
UNTIL SCN integer
=
FROM SEQUENCE integer
= =
SEQUENCE integer THREAD integer
SEQUENCE BETWEEN integer AND integer
=
UNTIL SEQUENCE integer
=
FROM TIME ’ date_string ’
TIME BETWEEN ’ date_string ’ AND ’ date_string ’
=
UNTIL TIME ’ date_string ’
Purpose
A subclause used to specify an archived log or range of archived redo logs files for
use in backup, restore, recovery, and maintenance operations.
When backing up archived redo logs, RMAN can perform archived log failover
automatically. RMAN backs up the log when at least one archived log
corresponding to a given log sequence number and thread is available. Also, if the
copy that RMAN is backing up contains corrupt blocks, then it searches for good
copies of these blocks in other copies of the same archived logs.
Specifying a range of archived redo logs does not guarantee that RMAN includes all
redo data in the range: for example, the last available archived log file may end
before the end of the range, or an archived log file in the range may be missing from
all archiving destinations. RMAN includes the archived redo logs it finds and does
not issue a warning for missing files.
archlogRange
SCN BETWEEN integer AND Specifies a range of SCNs. SCN BETWEEN integer1 AND integer2 is exactly
integer equivalent to FROM SCN integer1 UNTIL SCN integer2.
UNTIL SCN = integer Specifies the ending SCN for a sequence of archived redo log files. If you do
not specify the FROM SCN parameter, then RMAN will start with the earliest
available archived log.
If the database is open when you run BACKUP ARCHIVELOG, and if the UNTIL
clause is specified, then RMAN does not run ALTER SYSTEM ARCHIVE LOG
CURRENT.
FROM SEQUENCE integer Specifies the beginning log sequence number for a sequence of archived redo
log files. If you do not specify the UNTIL SEQUENCE parameter, RMAN will
include all available log files beginning with log sequence number specified in
the FROM SEQUENCE parameter.
Note: You can specify all log sequence numbers in a thread by using the
following syntax, where thread_number is an integer referring to the thread:
... ARCHIVELOG FROM SEQUENCE 0 THREAD thread_number
SEQUENCE Specifies either a single log sequence number or a range of sequence numbers.
If the database is open when you run BACKUP ARCHIVELOG, and if the
SEQUENCE keyword is specified, then RMAN does not run ALTER SYSTEM
ARCHIVE LOG CURRENT.
integer Specifies a single log sequence number.
BETWEEN integer Specifies a range of log sequence numbers. SEQUENCE BETWEEN integer1
AND integer AND integer2 is exactly equivalent to FROM SEQUENCE integer1 UNTIL
SEQUENCE integer2.
UNTIL SEQUENCE = integer Specifies the terminating log sequence number for a sequence of archived
redo log files. If you do not specify the FROM SEQUENCE parameter, RMAN
uses the lowest available log sequence number to begin the sequence.
If the database is open when you run BACKUP ARCHIVELOG, and if the UNTIL
clause is specified, then RMAN does not run ALTER SYSTEM ARCHIVE LOG
CURRENT.
Examples
Specifying Records by Time: Example This example backs up all logs that could
be used to recover to a point one week ago, and then deletes all archived redo logs
that were created more than two weeks ago:
BACKUP ARCHIVELOG UNTIL TIME 'SYSDATE-7';
DELETE ARCHIVELOG ALL COMPLETED BEFORE 'SYSDATE-14';
Specifying a Single Log Sequence Number: Example This example backs up only
archived log 30 of thread 1 and then deletes it.
BACKUP ARCHIVELOG SEQUENCE 30 DELETE INPUT;
Specifying All Log Sequence Numbers in a Thread This example crosschecks all
archived redo logs in thread 1:
CROSSCHECK ARCHIVELOG FROM SEQUENCE 0 THREAD 1;
BACKUP
Syntax
backup::=
backup
backupOperand
BACKUP backupSpec
backup1
backupSpecOperand
PLUS ARCHIVELOG
;
backupOperand::=
backupOperand
backupTypeSpec
= ’ ’
CHANNEL channel_id
CHECK LOGICAL
=
COPIES integer
CUMULATIVE
=
DEVICE TYPE deviceSpecifier
=
DISKRATIO integer
duration
fileNameConversionSpec
=
FILESPERSET integer
FORCE
,
=
FORMAT formatSpec
forRecoveryOfSpec
FULL
=
INCREMENTAL LEVEL integer
keepOption
=
MAXSETSIZE sizeSpec
notBackedUpSpec
NOCHECKSUM
NOEXCLUDE
=
POOL integer
ONLY
PROXY
REUSE
skipSpec
= ’ ’
TAG tag_name
VALIDATE
backupSpec::=
backupSpec
archivelogRecordSpecifier
ALL
completedTimeSpec
BACKUPSET ,
primaryKey
’ filename ’
CONTROLFILECOPY ALL
LIKE ’ string_pattern ’
copyOfSpec
FOR STANDBY
( CURRENT CONTROLFILE backupSpecOperand )
DATABASE
datafileCopySpec
,
DATAFILE datafileSpec
RECOVERY AREA
DB_RECOVERY_FILE_DEST
RECOVERY FILES
SPFILE
,
’ ’
TABLESPACE tablespace_name
backupSpecOperand::=
backupSpecOperand
= ’ ’
CHANNEL channel_id
ALL
DELETE INPUT
=
DISKRATIO integer
=
FILESPERSET integer
FORCE
,
=
FORMAT formatSpec
= ’ ’
FROM TAG tag_name
FOR STANDBY
INCLUDE CURRENT CONTROLFILE
keepOption
=
MAXSETSIZE sizeSpec
notBackedUpSpec
NOEXCLUDE
=
POOL integer
REUSE
skipSpec
= ’ ’
TAG tag_name
backupTypeSpec::=
backupTypeSpec
COMPRESSED
BACKUPSET
AS
COPY
copyOfSpec::=
copyOfSpec
DATABASE
,
DATAFILE datafileSpec
COPY OF
,
’ ’
TABLESPACE tablespace_name
datafileCopySpec::=
datafileCopySpec
,
’ filename ’
ALL
DATAFILECOPY
LIKE ’ string_pattern ’ NODUPLICATES
,
= ’ ’
FROM TAG tag_name
duration::=
duration
LOAD
MINIMIZE
TIME
PARTIAL
DURATION integer : integer
forRecoveryOfSpec::=
forRecoveryOfSpec
=
DATAFILECOPY FORMAT formatSpec
= ’ ’
WITH TAG tag_name
COPY
FOR RECOVER OF = ’ ’
TAG tag_name
notBackedUpSpec::=
notBackedUpSpec
integer TIMES
UP
NOT BACKED =
UP SINCE TIME ’ date_string ’
sizeSpec::=
sizeSpec
G
K
M
integer
skipSpec::=
skipSpec
INACCESSIBLE
SKIP OFFLINE
READONLY
Purpose
To back up a database, tablespace, datafile (current or copy), control file (current or
copy), SPFILE, archived log, or backup set. (These are the only file types that can be
backed up by RMAN.) can back up a target or standby database. The term backup
refers to the files created by an RMAN BACKUP command.
Each backup set contains at least one backup piece, which is an RMAN-specific
physical file containing the backed up data. You can also use the BACKUP command
to generate a proxy copy, which is a backup to a third-party medium in which the
entire data transfer is conducted by a media manager.
Backup sets can be created on disk, or on media manager devices such as tape
drives.
When the AS COPY option is used, RMAN generates image copies of the input files.
An image copy is a byte-for-byte identical copy of the original file. You can create
image copy backups of datafiles, datafile copies, and archived redo log files. Image
copy files can only exist on disk.
You can create and restore image copy backups with RMAN, or with a native
operating system command for copying files. However, when you use RMAN to
create image copies, they are recorded in the RMAN repository, and are more easily
available for use in restore and recovery operations. Otherwise, you must use the
CATALOG command to add the image copies to the RMAN repository before RMAN
can use them.
By default, RMAN creates all backups as backup sets, on tape or on disk. You can
change the default backup type for disk backups to be image copies using the
CONFIGURE command. Backups to tape can only be backup sets.
Incremental Backups
Incremental backups copy only those blocks that have changed since a previous
backup. A level 0 incremental backup captures all data blocks in a datafile. Level 1
incremental backups capture changes since a previous backup. Level 1 backups can
be cumulative, in which case they capture changes since the last level 0 incremental
backup, or differential, in which case they capture changes since the last level 0 or
level 1 incremental backup.
Backup Optimization
The BACKUP command optimizes backups, that is, does not back up files that are
identical to files that are already backed up, when the following conditions are met:
Channel Failover
A BACKUP command is decomposed into multiple independent backup steps by
RMAN. Each independent step can be executed on any channel allocated for a
specific device. If you have multiple channels allocated, and one channel fails or
encounters a problem during a backup step, then RMAN attempts to complete the
work on another channel. RMAN reports a message in V$RMAN_OUTPUT and in the
output to the interactive session or log file when channel failover occurs.
Note: Backups that use the disk test API are not supported for
production backups. Instead, use the preconfigured DISK channel
or manually allocate a DISK channel.
When using the RMAN BACKUP command, you cannot perform any of the
following actions:
■ Make a backup (either normal or incremental) in NOARCHIVELOG mode when
the database is open or is closed after an instance failure or SHUTDOWN ABORT.
You can only backup a database running in NOARCHIVELOG mode after a
consistent shutdown.
■ Stripe a single backup set across multiple channels.
■ Stripe a single input file across multiple backup sets.
■ Combine archived redo log files and datafiles into a single backup set.
■ Specify multiple, identical FORMAT strings within a single backupSpec (for
example, BACKUP DATAFILE 3 TO '/tmp/foo', DATAFILE 4 TO
'/tmp/foo'). However, RMAN permits a single FORMAT string to exist in
multiple backupSpec clauses.
■ Back up files with different block sizes into the same backup set. RMAN can
back up tablespaces with different block sizes, but puts each differently sized
datafile into its own backup set.
■ Back up locally-managed temporary tablespaces (although you can back up
dictionary-managed tablespaces)
■ Back up transportable tablespaces that were not made read-write after being
transported.
■ Use the DELETE INPUT option when backing up objects other than datafile
copies, archived redo logs, or backup sets.
■ Specify the number of backup pieces that should go in a backup set.
■ Create image copies (BACKUP AS COPY) on a nondisk media device.
■ Create incremental level 1 backups as image copies.
■ Back up a backup set on tape to disk or on tape to tape.
■ Make an image copy of a backup set, although you can make an image copy of
an image copy.
■ Specify the PLUS ARCHIVELOG clause on the BACKUP ARCHIVELOG command.
■ Open a NOARCHIVELOG mode database while it is being backed up. If you do,
and some data blocks in the files being backed up are modified before being
read by the backup session, then the backup is not usable after being restored
because it requires recovery.
■ Make the length of a backup piece filename longer than the platform-specific
length limit. If you use a media manager, then the length is also limited by the
limit in the supported version of the media management API. Vendors
supporting SBT 1.1 must support filenames up to 14 characters, and may
support longer filenames. Vendors supporting SBT 2.0 must support filenames
up to 512 characters, but may support longer filenames.
■ Specify the DEVICE TYPE option for a device other than DISK if you have not
already run CONFIGURE DEVICE TYPE for this device.
■ Manually allocate channels and run BACKUP with the DEVICE TYPE option.
■ Validate the backup of backup sets.
■ Specify DEVICE TYPE DISK when running the BACKUP RECOVERY AREA
command.
■ Back up the change-tracking file with RMAN.
backupOperand
Syntax Element Description
backupOperand Specifies various options for the BACKUP command.
backupTypeSpec Specifies the type of backup being created, either backup sets or image copies.
See "backupTypeSpec" on page 2-51 for details.
CHANNEL channel_id Specifies the case-sensitive name of a channel to use when creating backups.
Use any name that is meaningful, for example ch1 or dev1. The database
uses the channel ID to report I/O errors. If you do not set this parameter, then
RMAN dynamically assigns the backup sets to any available channels during
execution.
Note: You can also specify this parameter in the backupSpec clause.
backupSpec
Syntax Element Description
backupSpec A BACKUP specification list contains a list of one or more backupSpec
clauses. A backupSpec clause contains, at a minimum, a list of one or more
objects to be backed up.
Each backupSpec clause generates one or more backup sets (AS BACKUPSET)
or image copies (AS COPY). For AS BACKUPSET, the backupSpec clause
generates multiple backup sets if the number of datafiles specified in or
implied by its list of objects exceeds the default limit of 4 datafiles or 16
archived logs in each backup set.
archivelogRecordSp Specifies a range of archived redo logs to be backed up. RMAN does not
ecifier signal an error if the command finds no logs to back up, because this situation
probably exists because no new logs were generated after the previous
BACKUP ARCHIVELOG ALL DELETE INPUT command.
If you specify BACKUP ARCHIVELOG ALL, then RMAN backs up exactly one
copy of each distinct log sequence number. For example, if you archive to
multiple destinations, RMAN backs up one copy of each log sequence
number—not each copy of each log sequence number. For other commands,
such as DELETE, ALL does refer to every log, even duplicate log sequences.
If the database is open when you run BACKUP ARCHIVELOG, and if the UNTIL
clause or SEQUENCE parameter is not specified, then RMAN runs ALTER
SYSTEM ARCHIVE LOG CURRENT.
Note: If you run BACKUP ARCHIVELOG ALL, or if the specified log range
includes logs from prior incarnations, then RMAN backs up logs from prior
incarnations to ensure availability of all logs that may be required for recovery
through an OPEN RESETLOGS.
See Also: "archivelogRecordSpecifier" on page 2-22 for syntax, and Oracle
Database Backup and Recovery Advanced User's Guide explanations of backup
failover for logs and automatic log switching
backupSpecOperand
Syntax Element Description
backupSpecOperand Specifies a variety of options and parameters that affect the backupSpec
clause. Many subclauses of backupSpecOperand are also used with
backupOperand. For those, see the description of "backupOperand" on
page 2-39. Those which are not shared in common with backupOperand are
listed here.
DELETE [ALL] INPUT Deletes the input files upon successful creation of the backup. Specify this
option only when backing up archived logs, datafile copies (COPY OF or
DATAFILECOPY), or backup sets. It is equivalent to issuing DELETE for the
input files.
The ALL option applies only to archived logs. If you run DELETE ALL INPUT,
then the command deletes all copies of corresponding archived redo logs or
datafile copies that match the selection criteria. For example, if you specify the
SEQUENCE n clause, then RMAN deletes all archive logs with same sequence
number n, including duplicate archived logs (that is, logs with same log
sequence number and thread).
Note: The BACKUP ARCHIVELOG command only backs up one copy of each
distinct log sequence number, so if the DELETE INPUT option is used without
the ALL keyword, RMAN only deletes the copy of the file that it backs up.
See Also: "CONNECT" on page 2-99 for information on the effect of recovery
catalog compatibility on this command
FROM TAG = ’tag_name’ Allows specifying a backup by tag. Defined in context with several other
commands.
INCLUDE CURRENT Creates a snapshot of the current control file and places it into each backup set
CONTROLFILE produced by this clause.
[FOR STANDBY]
If you specify FOR STANDBY, then RMAN creates a backup of the control file
usable for creation of a standby database. The backup set includes the standby
control file and the object backed up.
Note: This option does not apply with AS COPY and results in an error
message.
backupTypeSpec
Syntax Element Description
AS [ COMPRESSED ] Creates backup sets (rather than image copies) on the specified device type.
BACKUPSET
AS BACKUPSET is the only possibility when backing up to tape, and for
creating level 1 incremental backups to any destination.
With the COMPRESSED option, binary compression is used. The data written
into the backup set is compressed to reduce the overall size of the backup set.
All backups that create backup sets can create compressed backup sets.
Restoring compressed backup sets is no different from restoring
uncompressed backup sets.
Note:
■ There is some CPU overhead associated with compressing backup sets. If
the database being backed up is running at or near its maximum load,
you may find the overhead from using AS COMPRESSED BACKUPSET
unacceptable. In most other circumstances, compressing backupsets saves
enough disk space to be worth the CPU overhead.
■ When backing up to a locally attached tape device, compression provided
by the media management vendor is usually preferable to the binary
compression integraed into the database, so use uncompressed backup
sets and turn on the compression provided by the media management
vendor. In any case, you should not use both forms of compression
together.
■ When using incrementally updated backups, the level 0 incremental
must be an image copy backup.
■ Full database backups should usually be either image copies or
compressed backupsets. Image copies are more flexible than backup sets
for some purposes (such as use in an incrementally updated backups
strategy), and compressed backupsets make more efficient use of storage
space, if you can tolerate the CPU overhead.
AS COPY Creates image copies (rather than backup sets). Can only be used with
backups created on disk.
copyOfSpec
Syntax Element Description
COPY OF DATABASE Makes a backup of previous image copies of all datafiles and control files in
the database. All datafiles that would normally be included by BACKUP
DATABASE are expected to have copies: if not, then RMAN signals an error. It
is not necessary for all copies to have been produced by a single BACKUP
command. If multiple copies exist of datafile, then RMAN backs up the latest.
Optionally, specify the copies by tag name (for example, FULL_COLD_COPY).
Note: The output of this command can be image copies or backup sets.
COPY OF TABLESPACE Makes a backup of previous image copies of the datafiles in one or more
tablespace_name specified tablespaces. All datafiles that would normally be included by
BACKUP TABLESPACE should have copies: if not, then RMAN signals an error.
It is not necessary for all copies to have been produced by a single BACKUP
command. If multiple copies exist of datafile, then RMAN backs up the latest.
Specify the tablespaces in the list by tablespace name (for example, users) or
specify a particular copy by tag name (for example, 0403_CPY_OF_USERS). If
you do not specify TAG, then RMAN backs up the most recent datafile copy
for each datafile in the tablespace.
Note: The output of this command can be image copies or backup sets.
COPY OF DATAFILE Makes a backup of a previous image copy of one or more datafiles. Specify the
datafileSpec datafile by file number (DATAFILE 3) or filename (DATAFILE
'?/oradata/trgt/users01.dbf'). You specify the datafile filename and
not the filename of the copy of the datafile. If more than one copy exists of a
given datafile, then RMAN backs up the most recent copy.
Note: It is not necessary for the image copies that you are backing up to have
been created by a single BACKUP command.
Note: The output of this command can be image copies or backup sets.
See Also: "datafileSpec" on page 2-119
datafileCopySpec
Syntax Element Description
DATAFILECOPY { Specifies the filenames of one or more datafile image copies. You can use the
filename [,filename...] following parameters:
|{ ALL
■ ’filename’ specifies an image copy by filename
| LIKE ’string_pattern’
| FROM TAG ’tag_name’ ■ ALL specifies that all datafile image copies should be backed up
}
■ LIKE ’pattern’ specifies a filename pattern. The percent sign (%) is a
} wildcard that means zero or more characters; an underscore (_) is a
wildcard that means one character.
■ FROM TAG ’tag_name’ specifies a list of one or more datafile copies,
identified by the tag tag_name. If multiple datafile copies with this tag
exist, then RMAN backs up only the most current datafile copy of any
particular datafile. Tags are not case sensitive.
NODUPLICATES Prevents the inclusion of identical datafile copies in a backup
operation. For each set of duplicate datafile copies, the file with the
most recent timestamp will be selected.
duration
Syntax Element Description
DURATION hh:mm Specifies a maximum time for a backup command to run. If a backup
command does not complete in the specified duration, the backup being taken
[PARTIAL]
stops.
[MINIMIZE
(TIME|LOAD)] With the PARTIAL option, the command is considered to have completed
successfully and no error is reported by RMAN even if the whole backup is
not completed in the specified duration.
Without the PARTIAL option, the backup command is considered to have
failed if it does not complete in the specified duration, and RMAN reports an
error. If the backup command is part of a RUN block, subsequent commands
in the RUN block do not execute.
Whether PARTIAL is used or not, all backupsets completed before the backup
is interrupted are retained and can be used in restore and recover operations.
With disk backups, you can use MINIMIZE TIME run the backup at
maximum speed (default) , or MINIMIZE LOAD to slow the rate of backup to
lessen the load on the system. With MINIMIZE LOAD the backup will take the
full specified duration.
When DURATION is used with MINIMIZE TIME, the file most recently backed
up is given the lowest priority to back up. This scheduling mechanism
provides for the eventual complete backup of the database during successive
backup windows, as different datafiles are backed up in round-robin fashion.
forRecoveryOfSpec
Syntax Element Description
FOR RECOVER OF TAG [=] Lets you identify any tagged level 0 incremental to serve as the basis for this
’tag_name’ level 1 incremental. Useful in strategies other than the incrementally updated
backups strategy.
FOR RECOVER OF COPY Lets you specify that this incremental should contain all changes since the
SCN of a datafile copy (level 0 incremental backup) of your database. The
datafile copies should be identified with either a DATAFILE COPY or WITH
TAG clause, to keep the incremental backup strategy for which this backup
will be used separate from the rest of your backup strategies. Otherwise, the
most recent copy of each datafile will be used as the basis for the incremetal.
WITH TAG [=] Used with FOR RECOVER OF COPY, specifies a tag to identify the level 0
’tag_name’ incremental backup to serve as the basis of the incremental. If no level 0 with
the tag specified in WITH TAG option is found, then FOR RECOVER OF COPY
option will create a level 0 datafile copy tagged with the value specified in the
WITH TAG option. BACKUP... FOR RECOVER OF COPY WITH TAG... is
key to backup strategies based on incrementally updated backups, as
described in Oracle Database Backup and Recovery Basics and used in some
Enterprise Manager backup strategies.
DATAFILE COPY [=] Used with FOR RECOVER OF COPY, identifies the datafile copies to use as the
formatSpec basis for this incremental.
notBackedUpSpec
Syntax Element Description
NOT BACKED UP Backs up only those files (of the files specified on the command) that RMAN
has never backed up. This option is a convenient way to back up new files
after adding them to the database.
sizeSpec
Syntax Element Description
integer [K|M|G] Specifies the size of data, such as a file, in kilobytes (K), megabytes (M) or
gigabytes (G).
skipSpec
Syntax Element Description
SKIP Excludes datafiles or archived redo logs from the backup according to the
criteria specified by the following keywords.
Note: You can also specify this option in the backupSpec clause.
INACCESSIBLE Specifies that datafiles or archived redo logs that cannot be read due to I/O
errors should be excluded from the backup.
A datafile is only considered inaccessible if it cannot be read. Some offline
datafiles can still be read because they still exist on disk. Others have been
deleted or moved and so cannot be read, making them inaccessible.
OFFLINE Specifies that offline datafiles should be excluded from the backup.
READONLY Specifies that read-only datafiles should be excluded from the backup.
Examples
# Run every day to back up blocks that have changed since most recent level 0 or 1:
BACKUP INCREMENTAL LEVEL 1 CUMULATIVE DATABASE;
BACKUP INCREMENTAL LEVEL 1 DIFFERENTIAL TABLESPACE users;
Backing Up Tablespaces and Datafiles to Disk: Example This command uses two
backupSpec clauses to back up tablespaces and datafiles and lets RMAN perform
automatic parallelization of the backup:
RUN
{
ALLOCATE CHANNEL dev1 DEVICE TYPE DISK FORMAT '/disk1/%U';
ALLOCATE CHANNEL dev2 DEVICE TYPE DISK FORMAT '/disk2/%U';
BACKUP
(TABLESPACE SYSTEM, tools, users, undotbs MAXSETSIZE 5M)
(DATAFILE 2,4,5);
}
Backing Up Tablespaces and Datafiles to Disk: Example This command uses two
backupSpec clauses to back up tablespaces and datafiles and lets RMAN perform
automatic parallelization of the backup:
RUN
{
ALLOCATE CHANNEL dev1 DEVICE TYPE DISK FORMAT '/disk1/%U';
ALLOCATE CHANNEL dev2 DEVICE TYPE DISK FORMAT '/disk2/%U';
BACKUP AS COPY
(TABLESPACE SYSTEM, tools, users, undotbs MAXSETSIZE 5M)
(DATAFILE 2,4,5);
}
Backing Up Datafile Copies: Example This example finds three datafile copies
with the tag LATESTCOPY, copies them to directory /copies and names the copies
by means of subsitution variables:
BACKUP AS COPY
FROM TAG 'LATESTCOPY'
COPY OF DATAFILE 4, 6, 14
FORMAT '/copies/Datafile%f_Database%d';
Backing Up Archived Logs and Deleting the Input: Example This example
assumes that you have two archive destinations set: /arch1 and /arch2. The
command backs up one log for each unique sequence number and then deletes all
logs from both archiving directories.
BACKUP ARCHIVELOG LIKE '/arch%' DELETE ALL INPUT;
Backing Up Backup Sets to Tape: Example In this example, the goal is to keep
recent backup sets on disk and older backup sets on tape, and to avoid keeping
copies of the same backup set on disk and tape simultaneously. This command
backs up backup sets created more than two weeks ago to tape and then deletes the
backed-up backup pieces from disk:
BACKUP DEVICE TYPE sbt BACKUPSET COMPLETED BEFORE 'SYSDATE-14'
DELETE INPUT;
Creating a Control File for a Standby Database: Example This example creates a
backup of the current control file that can be used to create a standby database:
BACKUP CURRENT CONTROLFILE FOR STANDBY;
Checking for Corruption: Example This example backs up datafile 3 and specifies
that no more than two blocks with corruption should be tolerated:
RUN
{
SET MAXCORRUPT FOR DATAFILE 3 TO 2;
BACKUP CHECK LOGICAL
DATAFILE 3;
}
Exempting Copies from the Retention Policy: Example The following example
copies the control file and two datafiles and exempts them from the retention policy
forever. (Note that KEEP FOREVER requires a recovery catalog.)
rman TARGET / CATALOG rman/rman@rcat
RMAN> SHUTDOWN IMMEDIATE;
RMAN> STARTUP MOUNT;
RMAN> BACKUP AS COPY
KEEP FOREVER NOLOGS
CURRENT CONTROLFILE FORMAT '?/oradata/cf_longterm.cpy',
DATAFILE 1 FORMAT ’?/oradata/df1_longterm.cpy’,
DATAFILE 2 FORMAT ’?/oradata/df2_longterm.cpy’;
ALTER DATABASE OPEN;
Backing Up Files That Need Backups: Example This example backs up all
datafiles that have not been backed up to tape in the last month, and then backs up
all archived logs that do not have at least two backups on tape:
BACKUP DEVICE TYPE sbt DATABASE NOT BACKED UP SINCE TIME 'SYSDATE-31';
BLOCKRECOVER
Syntax
blockrecover::=
blockrecover
,
=
DEVICE TYPE deviceSpecifier bmrOption
BLOCKRECOVER bmrBlockSpec ;
bmrBlockSpec::=
bmrBlockSpec
CORRUPTION LIST
,
DATAFILE datafileSpec BLOCK integer
,
TABLESPACE tablespace_name DBA integer
bmrOption::=
bmrOption
BACKUPSET
FROM
DATAFILECOPY
= ’ ’
FROM TAG tag_name
RESTORE untilClause
Purpose
Block media recovery recovers an individual data block or set of data blocks within
a datafile. This type of recovery is useful if the data loss or corruption applies to a
small number of blocks rather than to an entire datafile.
You can also use block media recovery to validate the integrity of redo generated
after a backup. For example, you can do a trial-run block media recovery to detect
problems in the archived redo stream.
Typically, block corruption is reported in error messages in trace files. Block-level
data loss usually results from:
■ I/O errors causing minor data loss
■ Memory corruptions that get flushed to disk
You need to specify the datafile number and block number or the tablespace and
data block address (DBA) when executing the BLOCKRECOVER command, or use the
CORRUPTION LIST keyword to recover all blocks reported in the V$DATABASE_
BLOCK_CORRUPTION view.
bmrBlockSpec
bmrOption
Examples
Limiting Block Media Recovery by Backup Tag: Example This example recovers
blocks and restores only from the backup with the tag weekly_backup:
BLOCKRECOVER TABLESPACE SYSTEM DBA 4194404, 4194405 FROM TAG "weekly_backup";
CATALOG
Syntax
catalog::=
catalog
ARCHIVELOG
, =
BACKUPPIECE LEVEL integer
’ filename ’
CONTROLFILECOPY
DATAFILECOPY
CATALOG ;
RECOVERY AREA
NOPROMPT
DB_RECOVERY_FILE_DEST
START WITH ’ string_pattern ’
Purpose
Use the CATALOG command to do the following:
■ Add metadata about a user-managed datafile copy, control file copy, archived
log or backup piece to the RMAN repository.
■ Record a datafile copy as a level 0 incremental backup in the RMAN repository,
which enables you to use it as part of an incremental backup strategy.
■ Record the existence of the last user-managed datafile copies made after the
final shutdown in Oracle7, before migrating the database to Oracle8.
See Also: Oracle Database Backup and Recovery Basics to learn how
to manage target database records stored in the catalog
Examples
Cataloging an Archived Redo Log: Example This example assumes that you
made operating system copies of archived logs or transferred them from another
location, and then added them to the RMAN repository:
CATALOG ARCHIVELOG '?/oradata/archive1_30.dbf', '?/oradata/archive1_31.dbf',
'?/oradata/archive1_32.dbf';
Note that you can create datafile copies both with the RMAN BACKUP AS COPY
command and by using operating system utilities in conjunction with ALTER
TABLESPACE BEGIN/END BACKUP.
Cataloging File in the Flash Recovery Area: Example The following example
catalogs all files in the currently enabled flash recovery area without prompting the
user for each one:
CATALOG RECOVERY AREA NOPROMPT;
CHANGE
Syntax
change::=
change
AVAILABLE ,
=
keepOption DEVICE TYPE deviceSpecifier
CHANGE maintSpec ;
UNAVAILABLE
UNCATALOG
maintSpec::=
maintSpec
OF listObjList
BACKUP
maintQualifier
archivelogRecordSpecifier
OF listObjList
COPY
,
=
DEVICE TYPE deviceSpecifier
recordSpec
Purpose
To make the following changes:
■ Change the status of backups, copies, and archived logs in the repository to
AVAILABLE or UNAVAILABLE. This feature is useful when a previously
unavailable file is made available again, or you do not want a specific backup or
copy to be eligible to be restored but also do not want to delete it.
■ The CHANGE command can alter the repository status of usable backups and
copies from prior incarnations.
■ Remove catalog records for backups and copies, and update the corresponding
records in the target control file to status DELETED. This feature is useful when
you remove a file by using an operating system command rather than the
RMAN CHANGE command, and want to remove its repository record as well.
■ Specify that a backup or copy should either abide by the currently configured
retention policy or be exempt from it.
See Also: Oracle Database Backup and Recovery Basics to change the
availability status of a backup or copy
Examples
Uncataloging and Cataloging Archived Logs: Example In this example, you move
all archived logs to a new directory, uncatalog them, and then recatalog them in the
new location:
HOST 'mv $ORACLE_HOME/oradata/trgt/arch/* /fs2/arch';
CHANGE ARCHIVELOG ALL UNCATALOG;
CATALOG START WITH ’/fs2/arch’;
cmdLine
Syntax
cmdLine::=
cmdLine
APPEND
=
AUXILIARY connectStringSpec
=
CATALOG connectStringSpec
=
CMDFILE
’ ’
@
filename
=
LOG
MSGNO
NOCATALOG
=
SEND ’ command ’
= ’
PIPE pipe_name ’
= ’
SCRIPT script_name
=
TARGET connectStringSpec
=
TIMEOUT integer
RMAN
Purpose
To start RMAN from the operating system command line. Use these arguments to:
■ Connect to the target, recovery catalog, or auxiliary database.
See Also: Oracle Database Backup and Recovery Basics to learn how
to connect RMAN to database instances
Examples
Specifying a Stored Script: Example This example connects to the target database
prod1 and the recovery catalog database rcat, and then runs the stored script
full_backup:
% rman TARGET SYS/sys_pwd@prod1 CATALOG rman/rman@rcat SCRIPT full_backup
Invoking the RMAN Pipe Interface: Example This example invokes the RMAN
pipe newpipe with a 90 second timeout option:
% rman PIPE newpipe TARGET SYS/oracle@inst1 TIMEOUT = 90
completedTimeSpec
Syntax
completedTimeSpec::=
completedTimeSpec
=
AFTER ’ date_string ’
=
COMPLETED
BEFORE ’ date_string ’
BETWEEN ’ date_string ’ AND ’ date_string ’
Purpose
A subclause that specifies when a backup or copy completed.
Examples
Deleting Expired Backups: Example This example deletes expired backup sets of
datafile 1 made in the last two weeks:
DELETE EXPIRED BACKUP OF DATAFILE 1 COMPLETED AFTER 'SYSDATE-14';
CONFIGURE
Syntax
configure::=
configure
APPLIED ON STANDBY
TO
ARCHIVELOG DELETION POLICY NONE
CLEAR
CLEAR
AUXNAME FOR DATAFILE datafileSpec
TO ’ filename ’
CONFIGURE backupConf ;
cfauConf
deviceConf
CLEAR
SNAPSHOT CONTROLFILE NAME
TO ’ filename ’
backupConf::=
backupConf
ARCHIVELOG = CLEAR
BACKUP COPIES FOR DEVICE TYPE deviceSpecifier
DATAFILE TO integer
CLEAR
BACKUP OPTIMIZATION OFF
ON
CLEAR
EXCLUDE FOR TABLESPACE tablespace_name
CLEAR
MAXSETSIZE sizeSpec
TO
UNLIMITED
CLEAR
cfauConf::=
cfauConf
CLEAR
= CLEAR
FORMAT FOR DEVICE TYPE deviceSpecifier
CONTROLFILE AUTOBACKUP TO formatSpec
OFF
ON
deviceConf::=
deviceConf
AUXILIARY integer = allocOperandList
CHANNEL DEVICE TYPE deviceSpecifier
CLEAR
CLEAR
DEFAULT DEVICE TYPE
TO deviceSpecifier
CLEAR
= COMPRESSED
DEVICE TYPE deviceSpecifier BACKUPSET
BACKUP TYPE TO
COPY
PARALLELISM integer
Purpose
To configure persistent settings affecting RMAN backup, restore, duplication, and
maintenance jobs. These configurations are in effect for any RMAN session until the
configuration is cleared or changed.
Use CONFIGURE to set the following:
■ An ongoing retention policy that automatically determines which backups and
copies are eligible for deletion because they are no longer needed
■ The device type (for example, DISK or sbt) for RMAN jobs
■ The default number of channels of each device type that RMAN should allocate
for automated backup and restore jobs
■ The settings for automatic channels for a specified device type
■ The maximum size of backup pieces and sets created on automatic channels
■ Backup optimization either ON or OFF
■ The exclusion policy for tablespaces in whole database backups
■ The filename of the snapshot control file
■ Filenames for files in an auxiliary database
■ The control file autobackup feature to ON or OFF
■ The default format for the control file autobackup output files
RMAN uses default settings for CONFIGURE options. You can return to the default
value for any CONFIGURE command by running the same command with the
CLEAR option.
See Also: Oracle Database Backup and Recovery Basics to learn how
to configure the RMAN environment
backupConf
Syntax Element Description
{ARCHIVELOG | DATAFILE} Specifies the number of copies of each backup set for DATAFILE (both
BACKUP COPIES datafiles and control files) or ARCHIVELOG files on the specified device type,
FOR DEVICE TYPE [=] from 1 (default) to 4. If duplexing is specified in the BACKUP command or in a
deviceSpecifier SET BACKUP COPIES command, then the CONFIGURE setting is overridden.
[CLEAR |TO integer]
Note: Control file autobackups on disk are a special case and are never
duplexed. RMAN always writes one and only copy.
Note: RMAN raises an error if you try to duplex backups to the flash recovery
area. You cannot duplex backups to the flash recovery area.
BACKUP OPTIMIZATION Toggles backup optimization ON or OFF (default). Specify CLEAR to return
[CLEAR | OFF | ON ] optimization to its default value of OFF.
Optimization does not back up a file to a device type if the identical file is
already backed up on the device type. For two files to be identical, their
content must be exactly the same. You can override backup optimization by
using the FORCE option of the BACKUP command.
RMAN does not signal an error if optimization causes all files to be skipped
during a backup. Note that BACKUP ... DELETE INPUT deletes all specified
files whether or not optimization would skip these files during a backup.
Backup optimization is enabled when all of the following conditions are met:
■ The CONFIGURE BACKUP OPTIMIZATION ON command has been run.
■ You run BACKUP DATABASE, BACKUP ARCHIVELOG with ALL or LIKE
options, or BACKUP BACKUPSET ALL.
■ The RMAN job uses a channel of only one device type.
The retention policy has an effect on which files backup optimization skips.
See Also: Oracle Database Backup and Recovery Advanced User's Guide for a
description of how RMAN determines that it can skip the backup of a file
EXCLUDE FOR TABLESPACE Excludes the specified tablespace from BACKUP DATABASE commands. Note
tablespace_name that you cannot exclude the SYSTEM tablespace. By default, each tablespace is
[ CLEAR ] not excluded, that is, the exclude functionality is disabled. The exclusion is
stored as an attribute of the tablespace, not the individual datafiles, so the
exclusion applies to any files that are added to this tablespace in the future. If
you run CONFIGURE ... CLEAR on a tablespace after excluding it, then it
returns to the default configuration of "not excluded."
You can still back up the configured tablespace by explicitly specifying it in a
BACKUP command or by specifying the NOEXCLUDE option on a BACKUP
DATABASE command.
RETENTION POLICY Specifies a persistent, ongoing policy for datafile and control file backups and
copies that RMAN marks as obsolete, that is, not needed and eligible for
deletion. As time passes, RMAN marks backups and copies as obsolete
according to the criteria you specify in the retention policy. RMAN does not
automatically delete any backups or copies: manually run the DELETE
OBSOLETE command to remove obsolete files. By default, RETENTION
POLICY is configured to REDUNDANCY 1.
For backups, the basic unit of the retention policy is a backup set (not a
backup piece) or image copy. For example, BACKUP AS BACKUPSET COPIES 4
TABLESPACE users generates a single backup set that is duplexed into four
identical backup pieces. The retention policy considers this as one backup, not
four separate backups.
CLEAR Resets the retention policy to its default (REDUNDANCY = 1).
TO RECOVERY WINDOW Specifies a time window in which RMAN should be able to recover the
OF database. The window stretches from the current time (SYSDATE) to the point
integer DAYS of recoverability, which is the earliest date to which you want to recover. The
point of recoverability is SYSDATE - integer days in the past.
TO REDUNDANCY Specifies that RMAN should retain integer backups or copies of each
integer datafile and control file. If more than integer backups or copies exist,
RMAN marks these extra files as obsolete. Then, RMAN determines the oldest
of the retained backups and copies, and marks all archived logs and log
backups older than this backup or copy as obsolete. The DELETE OBSOLETE
command removes obsolete backups and copies as well as archived log
backups and copies.
TO NONE Disables the retention policy feature. RMAN does not consider any backups or
copies as obsolete.
cfauConf
Syntax Element Description
CONTROLFILE AUTOBACKUP Controls the control file autobackup feature. By default, this feature is not
enabled.
CLEAR Returns the feature to its default setting of OFF.
FORMAT FOR DEVICE Configures the default filename format for the control file autobackup on the
TYPE specified device type. If a flash recovery area is enabled, then RMAN creates
deviceSpecifier [ the disk autobackup in the flash recovery area. Otherwise, RMAN creates it in
CLEAR | an operating system specific location (?/dbs on Unix and Windows).
TO formatSpec
By default, the initial format is %F for all devices. Any default format string
]
specified with CONFIGURE must include the %F substitution variable.
%F is the only legal substitution variable for use in a control file autobackup
format. Use of any other substitution variable is an error.
Specify CLEAR to return the format to the default %F.
The formatSpec can specify an Automatic Storage Management disk group.
The following example configures a channel for an ASM disk group:
CONFIGURE CONTROLFILE AUTOBACKUP FOR DEVICE TYPE DISK TO ’+dgroup1’;
See Also: "formatSpec" on page 2-154, for the semantics of the %F substitution
variable.
OFF Disables the autobackup feature. (OFF is the default value.) When this
command is OFF, any BACKUP command that includes datafile 1 (including
BACKUP DATABASE) automatically includes the current control file and server
parameter file in the backup set. Otherwise, RMAN does not include these
files.
deviceConf
Syntax Element Description
[AUXILIARY] CHANNEL Specifies the standard or AUXILIARY channel that you are configuring or
[ integer ] DEVICE TYPE clearing, as well as the device type (DISK or sbt) of the channel. Either
deviceSpecifier configure a generic channel or specify a channel number, where integer is
less than 255.
If you configure a generic channel (that is, if you do not specify a channel
number), then RMAN uses the generic settings for every parallelized channel
except any channel number that you have explicitly configured. A generic
channel setting specifies options for all channels not configured explicitly.
For generic channels of a specified device type, a new command erases
previous settings for this device type. Assume that you run these commands:
CONFIGURE CHANNEL DEVICE TYPE sbt MAXPIECESIZE 1G;
CONFIGURE CHANNEL DEVICE TYPE sbt FORMAT ’bkup_%U’;
The second command erases the MAXPIECESIZE setting of the first command.
If AUXILIARY is specified, then this configuration is used only for channels
allocated at the auxiliary instance. Specify configuration information for
auxiliary channels if they require different parameters from the channels
allocated at the target instance. If no auxiliary device configuration is
specified, then RMAN configures any auxiliary channels using the target
database device configuration.
See Also: Oracle Database Backup and Recovery Advanced User's Guide to learn
how configure automatic channels specified by channel number
allocOperandList Specifies control options for the allocated channel. Note that the FORMAT
parameter can specify an Automatic Storage Management disk group. The
following example configures a channel for an ASM disk group:
CONFIGURE CHANNEL DEVICE TYPE DISK FORMAT ’+dgroup1’;
See Also: "allocOperandList" on page 2-15
CLEAR Clears the specified channel. For example, CONFIGURE CHANNEL 1 DEVICE
TYPE DISK CLEAR returns only channel 1 to its default, whereas CONFIGURE
CHANNEL DEVICE TYPE DISK CLEAR returns the generic disk channel to its
default. Note that you cannot specify any other channel options (for example,
PARMS) when you specify CLEAR.
Examples
Overriding the Default Device Type: Example This example configures the default
device type to sbt, backs up the archived logs on the default sbt channel, and then
backs up the database to disk on the default disk channel:
CONFIGURE CHANNEL DEVICE TYPE sbt PARMS 'ENV=(NSR_SERVER=bksrv1)';
CONFIGURE DEFAULT DEVICE TYPE TO sbt;
BACKUP ARCHIVELOG ALL;
BACKUP DEVICE TYPE DISK DATABASE;
special case and are never duplexed) and then runs a database backup, specifying
three different file systems for the copies:
CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 3;
BACKUP DEVICE TYPE DISK DATABASE
FORMAT '/disk1/backup/%U', '/disk2/backup/%U', '/disk3/backup/%U';
RUN
{
ALLOCATE AUXILIARY CHANNEL dupdb1 TYPE DISK;
DUPLICATE TARGET DATABASE TO dupdb
LOGFILE
GROUP 1 ('?/dbs/dupdb_log_1_1.f',
'?/dbs/dupdb_log_1_2.f') SIZE 200K,
GROUP 2 ('?/dbs/dupdb_log_2_1.f',
'?/dbs/dupdb_log_2_2.f') SIZE 200K REUSE;
}
# Un-specify the auxiliary names for the datafiles so that they are not overwritten
# by mistake:
CONFIGURE AUXNAME FOR DATAFILE 1 CLEAR;
CONFIGURE AUXNAME FOR DATAFILE 2 CLEAR;
CONFIGURE AUXNAME FOR DATAFILE 3 CLEAR;
CONFIGURE AUXNAME FOR DATAFILE 4 CLEAR;
Specifying the Default Format for the Control File Autobackup: Example This
example turns on the autobackup feature, then changes the default format for the
DISK and sbt devices, then clears the autobackup setting:
CONFIGURE CONTROLFILE AUTOBACKUP ON;
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '?/oradata/%F';
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE sbt TO 'cf_auto_%F';
CONFIGURE CONTROLFILE AUTOBACKUP CLEAR; # returns to default setting of OFF
CONNECT
Syntax
connect::=
connect
CONNECT AUXILIARY ;
connectStringSpec
CONNECT CATALOG
connectStringSpec ;
CONNECT TARGET
Purpose
To establish a connection between RMAN and a target, auxiliary, or recovery
catalog database.
Examples
Connecting with a Recovery Catalog: Example This example starts RMAN and
then connects to the target database prod1 by using operating system
authentication and the recovery catalog database rcat by using a password file:
% rman
RMAN> CONNECT TARGET /
RMAN> CONNECT CATALOG rman/rman@rcat
connectStringSpec
Syntax
connectStringSpec::=
connectStringSpec
password
’ userid / @ net_service_name ’
Purpose
A subclause specifying the username, password, and net service name for
connecting to a target, recovery catalog, or auxiliary database. The connection is
necessary to authenticate the user and identify the database.
Examples
Entering the Password Interactively: Example This example connects to the target
database as user SYS but without specifying a password at the command line:
% rman TARGET SYS
CONVERT
Syntax
convert::=
convert
,
DATAFILE ’ filename ’
,
CONVERT convertOptionList ;
’ ’
TABLESPACE tablespace_name
convertOptionList::=
convertOptionList
fileNameConversionSpec
=
FORMAT formatSpec
=
FROM PLATFORM ’ platform ’
=
PARALLELISM integer
=
TO PLATFORM ’ platform ’
Purpose
To quickly transport a tablespace across different platforms. Important uses of the
command include:
■ Content providers can publish structured data as transportable tablespaces and
distribute it to customers who can easily and efficiently integrate this data into
their Oracle databases, regardless of their chosen platform.
■ Data from a large data warehouse server can be distributed to data marts on
smaller computers (for example, Windows NT workstations).
Examples
The procedure for transporting tablespaces is documented at length in Oracle
Database Administrator's Guide. RMAN’s CONVERT command is only required in
cases where you are transporting between platforms with different byte ordering. If
your platforms have the same byte ordering, then you can either use CONVERT or
copy the files directly.
The basic outline of the process is as follows:
1. Identify the tablespaces that will be transported. Depending on relations
between objects in the tablespaces you want to transport and objects in other
tablespaces, this may require careful planning.
2. Make the tablespaces to be moved read-only.
3. Use the Original Export utility to generate a file containing structural
information from the data dictionary for the tablespaces to be transported. This
file will be used when plugging the tablespaces into the destination database.
4. If you need to convert your datafiles for transport and you wish to use the
source system’s resources for the conversion, then use the RMAN CONVERT
command at this point on the source platform to convert the tablespaces for the
target platform. See the first example following this outline. (If you prefer to
use the destination system’s resources for the conversion, do nothing in this
step.)
5. Copy the datafiles (converted, if necessary) and the structural information file
to the target database. You may move these by any means that is convenient: an
operating system copy, ftp, or even distribution on removable media like CDs
or tapes.
6. If you are transporting across platforms where endian conversion is required,
and you did not perform the conversion on the source platform, then perform
the conversion on the destination platform. See the second example following
this outline.
7. Invoke the Original Import utility to plug the set of tablespaces into the target
database.
For more details on this process, see Oracle Database Administrator's Guide. Read
that discussion in its entirety before attempting any part of the tablespace transport
process. The discussion in this document will focus on the specifics of using the
CONVERT command, as you would use it on the source and destination platforms.
From this point, you follow the rest of the general outline for tablespace transport.
Use the export utility to create the file of structural information, if you have not
already, move the structural information file and the converted datafiles from
/tmp/transport_linux/ to the desired directories on the destination host, and
plug the tablespace into the new database with the Import utility.
■ You do not specify the source or destination platform. RMAN can determine the
source platform by examining the datafile, and the target platform defaults to
the platform of the host running the conversion.
% rman TARGET /
RMAN> CONVERT DATAFILE=’/tmp/transport_solaris/*’
DB_FILE_NAME_CONVERT
’/tmp/transport_solaris/fin’,’/orahome/dbs/fin’,
’/tmp/transport_solaris/hr’,’/orahome/dbs/hr’
CREATE CATALOG
Syntax
createCatalog::=
createCatalog
;
CREATE CATALOG
Purpose
To create a schema for the recovery catalog. Typically, you create this schema in a
separate recovery catalog database. The catalog is created in the default tablespace
of the recovery catalog owner.
See Also:
■ Oracle Database Administrator's Guide for more information
about the RECOVERY_CATALOG_OWNER role
■ "cmdLine" on page 2-74 for information about RMAN
command-line options
Example
CREATE SCRIPT
Syntax
createScript::=
createScript
=
GLOBAL ’ ’ COMMENT ’ comment ’
CREATE SCRIPT script_name
createScript1
backupCommands
maintenanceCommands
{ }
miscellaneousCommands
restoreCommands
;
FROM FILE ’ filename ’
Purpose
To create a stored script in the recovery catalog.
A stored script is a sequence of RMAN commands, given a name and stored in the
recovery catalog for later execution. A stored script may be local (that is, associated
with one target database) or global (available for use with any database registered
in the recovery catalog).
Any command that is legal within a RUN command is permitted in the stored script.
Several other commands are used with stored scripts:
■ The PRINT SCRIPT command is used to view the contents of a stored script.
■ The REPLACE SCRIPT command is used to update the contents of a stored
script.
■ The EXECUTE SCRIPT command is used to execute the commands in the
stored script.
Example
Creating a Local Stored Script: Example This example creates a stored script
called backup_whole that backs up the database and archived redo logs:
# creates recovery catalog script to back up database and archived logs
CREATE SCRIPT backup_whole
COMMENT "backup whole database and logs"
{
BACKUP INCREMENTAL LEVEL 0 TAG b_whole_l0
DATABASE PLUS ARCHIVELOG;
}
Creating a Global Stored Script: Example This example creates a stored script
called backup_whole that backs up the database and archived redo logs:
# creates recovery catalog script to back up database and archived logs
CREATE GLOBAL SCRIPT global_backup_db
COMMENT "backup any database from the recovery catalog, with logs"
{
BACKUP DATABASE PLUS ARCHIVELOG;
}
CROSSCHECK
Syntax
crosscheck::=
crosscheck
CROSSCHECK maintSpec ;
maintSpec::=
maintSpec
OF listObjList
BACKUP
maintQualifier
archivelogRecordSpecifier
OF listObjList
COPY
,
=
DEVICE TYPE deviceSpecifier
recordSpec
Purpose
To verify the status of backups and copies recorded in the RMAN repository against
media such as disk or tape. The CROSSCHECK command only processes files created
on the same device type as the channels running the crosscheck.
The CROSSCHECK command does not delete any files that it is unable to find, but
updates their repository records to EXPIRED. Then, you can run DELETE EXPIRED
to remove the repository records for all expired files as well as any existing physical
files whose records show the status EXPIRED.
If some backup pieces or copies were erroneously marked as EXPIRED, for
example, because the media manager was misconfigured, then after ensuring that
the files really do exist in the media manager, run the CROSSCHECK BACKUP
command again to restore those files to AVAILABLE status.
See Also: Oracle Database Backup and Recovery Basics to learn how
to manage target database records in the catalog
Examples
Crosschecking All Backups and Copies: Example The following example, which
assumes that the default configured channel is DEVICE TYPE sbt, queries the
status of all backups and copies on tape and disk. Because RMAN preconfigures a
disk channel, you do not need to manually allocate a disk channel:
CROSSCHECK BACKUP; # crosschecks backup sets and image copies
# assuming that the default channel is sbt, you can crosscheck on both disk
# and sbt backups by simply running CROSSCHECK with the default channels
CROSSCHECK BACKUP COMPLETED BETWEEN '01-JAN-01' AND '01-SEP-01';
datafileSpec
Syntax
datafileSpec::=
datafileSpec
’ filename ’
integer
Purpose
A subclause that specifies a datafile by filename or absolute file number.
Examples
DELETE
Syntax
delete::=
delete
EXPIRED
FORCE
maintSpec
NOPROMPT
,
DELETE = ;
obsOperandList DEVICE TYPE deviceSpecifier
OBSOLETE
maintSpec::=
maintSpec
OF listObjList
BACKUP
maintQualifier
archivelogRecordSpecifier
OF listObjList
COPY
,
=
DEVICE TYPE deviceSpecifier
recordSpec
Purpose
To delete physical backups and copies as well as do the following:
■ Update their repository records in the target control file to status DELETED
■ Remove their repository records from the recovery catalog (if you use a catalog)
When running RMAN interactively, DELETE displays a list of the files and prompts
you for confirmation before deleting any file in the list. When reading commands
from a command file, RMAN will not prompt for confirmation.
See Also: "BACKUP" on page 2-28 to learn about the BACKUP ...
DELETE INPUT command
Examples
Deleting Obsolete Backups: Example The following example deletes backups and
copies that are not needed to recover the database to a random point within the last
week. RMAN also deletes archived redo logs that are no longer needed:
DELETE NOPROMPT OBSOLETE RECOVERY WINDOW OF 7 DAYS;
Deleting Files That Have Already Been Backed Up: Example The following
example deletes backups and copies (including archived redo logs) that have
already been backed up at least twice to tape:
DELETE NOPROMPT BACKUP BACKED UP 2 TIMES TO DEVICE TYPE sbt;
DELETE NOPROMPT COPY BACKED UP 2 TIMES TO DEVICE TYPE sbt;
Forcing the Deletion of a Backup Set: Example The following example attempts
to delete the backup set copy with tag weekly_bkup:
DELETE NOPROMPT BACKUPSET TAG weekly_bkup;
However, RMAN displays a warning because the repository shows the backup set
as available, but the object is not actually available on the media:
RMAN-06207: WARNING: 1 objects could not be deleted for SBT_TAPE channel(s) due
RMAN-06208: to mismatched status. Use CROSSCHECK command to fix status
List of Mismatched objects
==========================
Object Type Filename/Handle
--------------- ---------------------------------------------------
Backup Piece 0id270ud_1_1
DELETE SCRIPT
Syntax
deleteScript::=
deleteScript
GLOBAL ’ ’
DELETE SCRIPT script_name ;
Purpose
To delete a local or global stored script from the recovery catalog.
Example
deviceSpecifier
Syntax
deviceSpecifier::=
deviceSpecifier
DISK
’ ’
media_device
Purpose
A subclause specifying the type of storage for a backup or copy.
Examples
Restoring from Tape: Example This example restores archived logs from tape:
RESTORE DEVICE TYPE sbt ARCHIVELOG ALL;
DROP CATALOG
Syntax
dropCatalog::=
p g
;
DROP CATALOG
Purpose
To remove the schema from the recovery catalog.
Example
Deleting the Catalog: Example This example drops the schema from the recovery
catalog (you must enter the command twice to confirm):
RMAN> DROP CATALOG
DROP DATABASE
Syntax
dropDatabase::=
dropDatabase
INCLUDING BACKUPS NOPROMPT
DROP DATABASE ;
Purpose
Deletes the target database and, if RMAN is connected to a recovery catalog,
unregisters it. RMAN removes all datafiles, online logs, and control files belonging
to the target database.
Example
DUPLICATE
Syntax
duplicate::=
duplicate
dupsbyOptionList
FOR STANDBY
DUPLICATE TARGET DATABASE ’ ’ dupOptionList ;
TO database_name
dupOptionList::=
dupOptionList
,
=
DEVICE TYPE deviceSpecifier
fileNameConversionSpec
,
LOGFILE logSpec
NOFILENAMECHECK
OPEN RESTRICTED
= ’ ’
PFILE filename
SKIP READONLY
,
’ ’
SKIP TABLESPACE tablespace_name
untilClause
dupsbyOptionList::=
dupsbyOptionList
DORECOVER
fileNameConversionSpec
NOFILENAMECHECK
logSpec::=
logSpec
REUSE
’ filename ’ SIZE sizeSpec
,
REUSE
GROUP integer ( ’ filename ’ ) SIZE sizeSpec
sizeSpec::=
sizeSpec
G
K
M
integer
Purpose
To use backups (backup sets or image copies) of the target database to create either
of the following:
■ A duplicate database, which is a copy of the target database (or a subset of the
target database) with a unique DBID. Because a duplicate database has a unique
DBID, it is entirely independent of the primary database and can be registered
in the same recovery catalog as the primary database. Typically, duplicate
databases are used for testing.
■ A standby database, which is a special copy of the primary database that is
updated by applying archived redo logs from the primary database. A standby
database does not get a new DBID.
To create a standby database with the DUPLICATE command you must specify the
FOR STANDBY option. The DUPLICATE ... FOR STANDBY command creates the
standby database by restoring a standby control file, mounting the standby control
file, and then restoring and recovering backups of the target datafiles. The standby
database is left mounted after duplication is complete. Note that backups of the
standby database are interchangeable with backups of the primary database.
When duplicating a database that is currently in NOARCHIVELOG mode, recovery
occurs with the NOREDO option. Hence, if incremental backups exist, RMAN applies
only these backups to the restored files during recovery. For databases in
ARCHIVELOG mode, DUPLICATE recovers by default up to the last archived redo
log generated at the time the command was executed, or until a time specified with
a SET UNTIL clause.
See Also:
Oracle Database Backup and Recovery Advanced User's Guide to learn
how to create a duplicate database with the DUPLICATE command
Oracle Data Guard Concepts and Administration to learn how to
create, manage, and back up a standby database
■ If you need to duplicate a database when some backups of the target database
do not exist then you must specify SKIP TABLESPACE. If you do not specify
SKIP TABLESPACE, then RMAN attempts to duplicate the following:
– All datafiles in online tablespaces, whether or not the datafiles are online.
– All tablespaces taken offline with an option other than NORMAL. For
example, RMAN attempts to duplicate tablespaces taken offline with the
IMMEDIATE option. You cannot duplicate OFFLINE NORMAL tablespaces,
although you can add these tablespaces manually after duplication.
If no valid backups exist of any tablespace or datafile, then the DUPLICATE
command fails.
■ You can skip all tablespaces in the target database except the SYSTEM
tablespace, undo tablespaces, and tablespaces containing rollback segments.
RMAN does not check for completeness. For example, you can duplicate a data
tablespace but not the tablespace containing the index for the data, or duplicate
a tablespace that contains only one partition of a partitioned table.
■ If the target and duplicate databases reside on the same host, set the CONTROL_
FILES parameter appropriately so that the DUPLICATE command does not
generate an error because the target control file is in use.
■ If the target and duplicate databases share the same host, set all *_PATH and *_
DEST initialization parameters appropriately so that the target database files are
not overwritten by the duplicate database files.
■ You cannot set the DB_NAME parameter in the duplicate parameter file to a
value different from the database name specified in the DUPLICATE command.
■ You cannot use the same database name for the target and duplicate databases
when the duplicate database resides in the same Oracle home as the target.
Note that if the duplicate database resides in a different Oracle home from the
target, then its database name just has to differ from other database names in
that same Oracle home.
■ If the target and duplicate databases reside on different hosts, then you must do
one of the following tasks for duplication to be successful:
– Move backups and disk copies from the target host to the duplicate host to
the same location as the target host so that the path names are identical
– Move backups and disk copies from the target host to the duplicate host to
a new location (so that the path names are different), and then CATALOG
them.
– Make sure that all backups and copies (disk or sbt) on the target host are
remotely accessible from the duplicate host. Make sure that the archived
redo logs are available in the expected location in the new host.
■ Duplication must be done to the same platform as the source datababse.
■ You cannot recover the duplicate database to the current point in time, that is,
the most recent SCN. RMAN recovers the duplicate database up to or before the
most recent available archived log: it cannot recover into the online redo logs.
■ Specify new filenames or convert target filenames for the datafiles and online
redo logs when the duplicate filenames must be different from the target
filenames (as when duplicating to the same host as the primary). If you do not
specify filenames for duplicate online redo logs and datafiles, then RMAN
reuses the target datafile names.
■ If you want the duplicate filenames to be the same as the target filenames, and
if the databases are in different hosts, then you must specify
NOFILENAMECHECK.
■ If duplicating a database on the same host as the target database, do not specify
the NOFILENAMECHECK option. Otherwise, RMAN may signal this error:
RMAN-10035: exception raised in RPC: ORA-19504: failed to create file
"/oracle/dbs/tbs_01.f"
ORA-27086: skgfglk: unable to lock file - already in use
SVR4 Error: 11: Resource temporarily unavailable
Additional information: 8
RMAN-10031: ORA-19624 occurred during call to
DBMS_BACKUP_RESTORE.RESTOREBACKUPPIECE
The following restrictions apply when you use the DUPLICATE command with the
FOR STANDBY option:
■ All backups and copies located on disk must be available at the standby host
with the same path names as in the target host.
■ Backups on tape must be accessible from the standby host.
■ If archived logs have not been backed up, then archived logs must be available
at the standby host with the same path names as in the target host.
■ If RMAN recovers the standby database, then the checkpoint SCN of the control
file must be included in an archived redo log that is either available at the
standby site or included in an RMAN backup. For example, assume that you
create the standby control file and then immediately afterward archive the
current log, which has a sequence of 100. In this case, you must recover the
standby database up to at least log sequence 100, or the database signals an
ORA-1152 error message because the standby control file backup or copy was
taken after the point in time.
■ You cannot use SET NEWNAME or CONFIGURE AUXNAME to transform the
filenames for the online redo logs on the standby database.
■ You cannot use the DUPLICATE command to activate a standby database.
■ You cannot connect to the standby database and then DUPLICATE ... FOR
STANDBY to create an additional standby database. To create additional standby
databases, connect to the original primary database and run DUPLICATE ...
FOR STANDBY.
■ Do not attempt to register the standby database in the primary database
repository.
dupOptionList
logSpec
dupsbyOptionList
Examples
Setting New Filenames Manually: Example This example assumes that the target
datafiles are on host1 in directory /h1/oracle/dbs/trgt. You wish to duplicate
the database to newdb on host2 in the directory /h2/oracle/oradata/newdb.
The DUPLICATE command uses backup sets stored on tape to duplicate the target
database to database newdb, and recovers it to a point 24 hours ago:
RUN
{
ALLOCATE AUXILIARY CHANNEL newdb1 DEVICE TYPE sbt;
DUPLICATE TARGET DATABASE TO newdb
DB_FILE_NAME_CONVERT=('/h1/oracle/dbs/trgt/','/h2/oracle/oradata/newdb/')
UNTIL TIME ’SYSDATE-1’ # specifies incomplete recovery
SKIP TABLESPACE cmwlite, drsys, example # skip desired tablespaces
PFILE = ?/dbs/initNEWDB.ora
lOGFILE
GROUP 1 ('?/oradata/newdb/redo01_1.f',
'?/oradata/newdb/redo01_2.f') SIZE 200K,
GROUP 2 ('?/oradata/newdb/redo02_1.f',
'?/oradata/newdb/redo02_2.f') SIZE 200K
GROUP 3 ('?/oradata/newdb/redo03_1.f',
'?/oradata/newdb/redo03_2.f') SIZE 200K REUSE;
}
Reusing the Target Filenames: Example This example assumes the following:
■ You are restoring to a new host without a catalog.
■ You have configured automatic channels.
■ The target host and duplicate host have the same file structure.
■ You wish to name the duplicate files exactly like the target database files.
■ You do not want to duplicate read-only tablespaces.
■ You want to prevent RMAN from checking whether files on the target database
that have the same names as the duplicated files are in use.
CONNECT TARGET
CONNECT AUXILIARY SYS/aux_pwd@newdb
DUPLICATE TARGET DATABASE TO ndbnewh
LOGFILE
'?/dbs/log_1.f' SIZE 200K,
'?/dbs/log_2.f' SIZE 200K
SKIP READONLY
NOFILENAMECHECK;
EXECUTE SCRIPT
Syntax
executeScript::=
executeScript
GLOBAL ’ ’
EXECUTE SCRIPT script_name ;
Purpose
To run a local or global RMAN script stored in the recovery catalog.
Example
Executing a Script: Example This example runs a stored script called backup_
whole_10:
RUN { EXECUTE script backup_whole_10; }
EXIT
Syntax
exit::=
;
EXIT
Purpose
To shut down the Recovery Manager utility.
Example
Exiting RMAN: Example This example starts RMAN and then shuts it down:
% rman
RMAN> EXIT
fileNameConversionSpec
Syntax
fileNameConversionSpec::=
fileNameConversionSpec
,
= ( ’ ’ )
DB_FILE_NAME_CONVERT string_pattern
Purpose
A subclause that specifies one or more patterns to be used in generating new
database file names based on old ones. Used with BACKUP , CONVERT and
DUPLICATE as one way of generating output file names.
Where:
■ string1 is a pattern matching the orignal filename
■ string2 is the pattern replacing string1 in the generated filename
■ string3 is a pattern matching the orignal filename
■ string4 is the pattern replacing string3 in the generated filename
You can use as many pairs of primary and standby replacement strings as required.
For example, when making image copy backups of tablespaces users (with
datafiles in directory /disk1/dbs/users) and tools (with datafiles in
/disk1/dbs/tools/), to direct the converted datafiles to /newdisk/users and
/newdisk/tools respectively, use the DB_FILE_NAME_CONVERT pattern shown
here:
BACKUP AS COPY TABLESPACE users, tools
DB_FILE_NAME_CONVERT = (’disk1/dbs’,’newdisk’);
would have the same effect as the previous example, because the pattern ’dbs’
matches the filename and there is no reason to compare it to the second pattern
’/disk1’.
Examples
FLASHBACK
Syntax
flashback::=
flashback
,
=
DEVICE TYPE deviceSpecifier
FLASHBACK DATABASE
flashback1
=
TO SCN integer
=
= THREAD integer
TO SEQUENCE integer
=
TO TIME ’ date_string ’
= ;
TO BEFORE SCN integer
=
= THREAD integer
TO BEFORE SEQUENCE integer
=
TO BEFORE TIME ’ date_string ’
Purpose
Performs a Flashback Database operation, returning the database to (or to just
before) target time, as specified by time, SCN or log sequence number.
The result of using flashback database is generally similar to a database
point-in-time recovery performed with RECOVER, except for the following principal
differences:
■ You do not need to restore a backup.
■ RMAN uses flashback logs to undo changes to a point before the target time or
SCN, and then uses archived redo logs to recover the database forward to make
it consistent. RMAN automatically restores from backup any archived logs that
are needed. (Flashback logs are stored as Oracle-managed files in the flash
recovery area, and cannot be created if no flash recovery area is configured.)
■ The FLASHBACK command does not start modifying the database until it has
made sure that it has all the files and resources that it needs.
■ Some NOLOGGING changes will be reflected in the flashback which would not
be reflected in the results of a point-in-time recovery, because flashback
database uses backed-up block images as the basis for undoing changes to your
current datafiles.
Because FLASHBACK DATABASE does not require you to restore a backup, it is
usually much faster than incomplete recovery.
■ If insufficient flashback data is available for a subset of your datafiles, then you
can take these datafiles offline and then run FLASHBACK on those for which
there is sufficient flashback log data. Afterwards, you can perform point-in-time
recovery on those files where there was not sufficient flashback log data.
■ RMAN issues an error if you attempt to perform Flashback Database on online
tablespaces on which flashback was disabled using the SQL statement ALTER
TABLESPACE ... FLASHBACK OFF.
■ You must OPEN RESETLOGS after running FLASHBACK DATABASE. If datafiles
are not flashed back because they are offline, then the RESETLOGS may fail with
an error. In that case you must do one of the following:
– Flash back the affected datafiles to the same time or SCN as the other
datafiles.
– Run RESTORE and then RECOVER to bring the affected datafiles to the same
time or SCN as the rest of the database.
– Take the datafiles offline and then drop them.
■ RMAN never flashes back data for temporary tablespaces.
■ You cannot run FLASHBACK DATABASE to a time before an OPEN RESETLOGS.
■ If a datafile has changed status between the current SCN and the SCN to which
you are flashing back, then the FLASHBACK command behaves differently
depending on the nature of the status change. Refer to Table 2–3.
■ If the FLASHBACK command fails or is interrupted, then the database is left
mounted. You can issue another FLASHBACK command or run RECOVER to
return the database to its original state.
■ When you have completed a flashback operation, you may wish to open the
database read-only and run some queries to see if you have achieved the
desired result. If you are not satisfied with your flashback operation, you can
perform RECOVER DATABASE to re-apply all changes and bring the database
back to its state when you started the flashback operation. You can then attempt
flashb ack again. If you are satisfied, you can either perform an OPEN
RESETLOGS to abandon all changes after the target time for the flashback, or
you can export lost data, use RECOVER DATABASE to return your database to
its state before the flashback database operation, and then re-import the lost
data.
■ When performing a FLASHBACK DATABASE operation, your database may not
be left at the SCN most immediately before the target time you specify. There
are events other than transactions which cause the SCN for your database to be
updated. If you use the FLASHBACK DATABASE TO form of the command and
there is a transaction associated with your specified SCN, the database after the
flashback operation will include all changes up to and including that
transaction. Otherwise, all changes up to but not including that transaction will
be included in your datafiles, whether you use the FLASHBACK DATBASE TO
or FLASHBACK DATABASE TO BEFORE form of the command. Changes after
the specified target time or SCN are never applied.
Examples
formatSpec
Syntax
formatSpec::=
formatSpec
’ format_string ’
Purpose
To specify a filename format or an Automatic Storage Management disk group for a
backup piece or image copy. If you do not specify a value for the FORMAT
parameter, then RMAN either creates the backup in the flash recovery area if it is
enabled, or in a port-specific directory (for example, ?/dbs on UNIX) if a flash
recovery area is not enabled. In either case, RMAN uses the variable %U to name the
backup.
The entire format_string is processed in a port-specific manner by the target
instance to derive the final backup piece name. The substitution variables listed in
"Keywords and Parameters" are available in FORMAT strings to aid in generating
unique filenames. The formatting of this information varies by platform.
If specified in more than one of these places, then RMAN searches for the FORMAT
parameter in the order shown.
Example
Specifying an ASM Disk Group: Example This example copies the database to
ASM disk group disk1 and uses a tempfile creation template:
BACKUP AS COPY DATABASE FORMAT ’+disk1(tempfile)’; # use tempfile creation template
Specifying a Format for Datafile Copies: Example This example creates copies of
three datafiles with tag 'LATESTCOPY' to directory /copies:
# Create copies of 3 datafiles with tag 'LATESTCOPY' to directory /copies
BACKUP AS COPY
FROM TAG 'LATESCOPY'
COPY OF DATAFILE 4, 6, 14
FORMAT '/copies/Datafile%f_Database%d';
HOST
Syntax
host::=
host
’ command ’
HOST ;
Purpose
To invoke an operating system command-line sub-shell from within RMAN.
Examples
Executing an Operating System Copy Within RMAN: Example This example shuts
down the database, makes a backup of datafile system01.dbf, then executes the
UNIX ls command to display all backed up datafiles:
SHUTDOWN IMMEDIATE;
STARTUP MOUNT;
BACKUP DATAFILE ’?/oradata/trgt/system01.dbf’
FORMAT ’/tmp/system01.dbf’;
HOST ’ls -l /tmp/*dbf’;
Hosting to the Operating System Within a Backup: Example This example makes
an image copy of datafile 3, hosts out to the UNIX prompt to check that the copy
is in the directory (the UNIX session output is indented and displayed in bold), then
resumes the RMAN session:
RMAN> BACKUP DATAFILE 3 FORMAT '?/oradata/df3.cpy';
RMAN> HOST;
% ls $ORACLE_HOME/oradata/df3.cpy
/net/oracle/oradata/df3.cpy
% exit
RMAN> LIST COPY;
keepOption
Syntax
keepOption::=
keepOption
FOREVER
LOGS
KEEP =
NOLOGS
UNTIL TIME ’ date_string ’
NOKEEP
Purpose
A subclause specifying the status of a backup or copy in relation to a retention
policy. The KEEP option marks the backup or copy as exempt from the retention
policy (that is, not obsolete), and the NOKEEP option undoes any existing
exemptions.
Examples
Changing the Status of a Copy: Example This example specifies that any
long-term image copies of datafiles and control files should lose their exempt status
and so become eligible to be obsolete according to the existing retention policy:
CHANGE COPY OF DATABASE CONTROLFILE NOKEEP;
LIST
Syntax
list::=
list
maintQualifier
untilClause
RECOVERABLE
listObjectSpec
EXPIRED
recordSpec
’ ’
database_name
OF DATABASE
INCARNATION
maintQualifier
LIST ;
untilClause
RECOVERABLE
listObjectSpec
recordSpec
ALL
GLOBAL
SCRIPT NAMES
listObjectSpec::=
listObjectSpec
OF listObjList listBackupOption
BACKUP
archivelogRecordSpecifier
OF listObjList
COPY
listBackupOption::=
listBackupOption
BY FILE
SUMMARY
Purpose
To display information about backup sets, proxy copies, and image copies recorded
in the repository. The LIST command displays the files against which you can run
CROSSCHECK and DELETE commands. Use this command to list:
■ Backups and copies that do not have the status AVAILABLE in the RMAN
repository
■ Backups and copies of datafiles that are available and can possibly be used in a
restore operation
■ Specified archived logs, backup sets, backup pieces, control file copies, datafile
copies, and proxy copies
■ Backups and copies restricted by tag, completion time, recoverability, or device
■ Incarnations of a specified database or of all databases known to the repository
■ Stored scripts in the recovery catalog
RMAN records the output to either standard output or the message log, but not to
both at the same time. You can control how the output is organized (BY BACKUP or
BY FILE) as well as the level of detail in the output (VERBOSE or SUMMARY).
See Also: Oracle Database Backup and Recovery Basics to learn how
to make lists and reports, and "cmdLine" on page 2-74
listObjectSpec
listBackupOption
LIST Output
The information that appears in the output is shown in the following tables:
■ Table 2–4, "List of Backup Sets (for datafile backup sets)"
■ Table 2–5, "List of Backup Pieces (for sets with only one piece)"
Table 2–4 List of Backup Sets (for datafile backup sets) (Cont.)
Column Indicates
Device Type The type of device on which the backup was made, for
example, DISK or sbt.
Elapsed Time The duration of the backup.
Completion Time The date and time that the backup set completed. Note that
the format of this field depends on the NLS_LANG and NLS_
DATE_FORMAT environment settings.
Table 2–5 List of Backup Pieces (for sets with only one piece)
Column Indicates
BP Key A unique identifier for this backup piece in the recovery
catalog or target database control file.
If you are connected to a recovery catalog, then BP Key is the
primary key of the backup piece in the catalog. It corresponds
to BP_KEY in the RC_BACKUP_PIECE view. If you are
connected in NOCATALOG mode, then BP Key displays the
RECID from V$BACKUP_PIECE.
Note: The values for KEY in the recovery catalog and the
control file are different.
Status The backup piece status: AVAILABLE, UNAVAILABLE, or
EXPIRED (refer to the CHANGE, CROSSCHECK, and DELETE
commands for an explanation of each status).
Tag The tag applied to the backup set; NULL if none. Note that tag
names are not case sensitive and display in all uppercase.
Piece Name The filename or handle of the backup piece. If the backup
piece is on sbt, the Media ID is displayed with the name.
Controlfile Included A control file is included in the backup.
Note: This row appears only if the current control file is
included in the backup.
Table 2–5 List of Backup Pieces (for sets with only one piece) (Cont.)
Column Indicates
SPFILE Included A server parameter file is included in the backup.
Ckp SCN The SCN of the backup control file checkpoint. All database
changes recorded in the redo records before the specified SCN
are reflected in this control file.
Note: This row appears only if the current control file is
included in the backup.
Ckp time The time of the backup control file checkpoint. All database
changes recorded in the redo records before the specified time
are reflected in this control file.
Note: This row appears only if the current control file is
included in the backup.
Table 2–8 Backup Set Copy ... of backup set ... (only if multiple pieces)
Column Indicates
Device Type The type of device on which the backup was made, for
example, DISK or sbt.
Elapsed Time The duration of the backup.
Completion Time The date and time that the backup set completed. Note that
the format of this field depends on the NLS_LANG and NLS_
DATE_FORMAT environment settings.
Tag The tag applied to the backup set; NULL if none. Note that tag
names are not case sensitive and display in all uppercase.
Table 2–9 List of Backup Pieces for backup set ... Copy ... (if multiple pieces)
Column Indicates
BP Key A unique identifier for this backup piece in the recovery
catalog or target database control file.
If you are connected to a recovery catalog, then BP Key is the
primary key of the backup piece in the catalog. It corresponds
to BP_KEY in the RC_BACKUP_PIECE view. If you are
connected in NOCATALOG mode, then BP Key displays the
RECID from V$BACKUP_PIECE.
Note: The values for KEY in the recovery catalog and the
control file are different.
Pc# The number of the backup piece in the backup set.
Status The backup piece status: AVAILABLE, UNAVAILABLE, or
EXPIRED (refer to the CHANGE, CROSSCHECK, and DELETE
commands for an explanation of each status).
Table 2–9 List of Backup Pieces for backup set ... Copy ... (if multiple pieces) (Cont.)
Column Indicates
Piece Name The filename or handle of the backup piece. If the backup
piece is stored on sbt, the media ID is also displayed.
Table 2–14 List of Archived Log Backups (LIST BACKUP ... BY FILE)
Column Indicates
Thrd The thread number of the redo log.
Seq The log sequence number of the archived log.
Low SCN The lowest SCN in the archived log.
Low Time The time when the database switched into the redo log having
this sequence number.
BS Key A unique key identifying this backup set.
If you are connected to a recovery catalog, then BS Key is the
primary key of the backup set in the catalog. It corresponds to
BS_KEY in the RC_BACKUP_SET view. If you are connected in
NOCATALOG mode, then BS Key displays the RECID from
V$BACKUP_SET.
S The status of the backup: A (available), U (unavailable), or X
(all backup pieces in set expired). Refer to the CHANGE,
CROSSCHECK, and DELETE commands for an explanation of
each status.
#Pieces The number of backup pieces in the backup set.
#Copies The number of copies made of each backup piece in the set.
The number is 1 if no duplexing was performed. Otherwise,
the value ranges from 2 to 4.
Tag The tag applied to the backup set; NULL if none. Note that tag
names are not case sensitive and display in all uppercase.
Table 2–15 List of Controlfile Backups (LIST BACKUP ... BY FILE) (Cont.)
Column Indicates
S The status of the backup: A (available), U (unavailable), or X
(all backup pieces in set expired). Refer to the CHANGE,
CROSSCHECK, and DELETE commands for an explanation of
each status.
#Pieces The number of backup pieces in the backup set.
#Copies The number of copies made of each backup piece in the set.
The number is 1 if no duplexing was performed. Otherwise,
the value ranges from 2 to 4.
Tag The tag applied to the backup set; NULL if none. Note that tag
names are not case sensitive and display in all uppercase.
Examples
Listing Backups: Example This example lists all backups in default verbose mode:
LIST BACKUP;
List of Backups
===============
Key TY LV S Device Type Completion Time #Pieces #Copies Tag
------- -- -- - ----------- -------------------- ------- ------- ---
35 B A A SBT_TAPE FEB 08 2002 05:37:37 1 1 TAG20020208T053733
42 B F A SBT_TAPE FEB 08 2002 05:38:21 1 1 TAG20020208T053744
Listing Backups by File: Example This example groups all backups by file:
LIST BACKUP BY FILE;
Thrd Seq Low SCN Low Time BS Key S #Pieces #Copies Tag
---- ------- ---------- --------- ------- - ------- ------- ---
1 141 49463 14-SEP-01 213 A 1 1 TAG20011114T125431
Listing Archived Redo Logs: Example The following example lists archived logs
and copies of logs:
LIST COPY OF DATABASE ARCHIVELOG ALL;
List of Backups
===============
Listing Stored Scripts: Example This example shows the output of running LIST
ALL SCRIPT NAMES:
RMAN> LIST ALL SCRIPT NAMES;
Script Name
Description
-----------------------------------------------------------------------
configure_Rman
Script to configure retention policy and device parameters.
backup_schema_dfs
Backups only tablespaces that are being currently used.
Script Name
Description
-----------------------------------------------------------------------
nightly_backup
Script used to backup PROD database every weekday.
Global Scripts
Script Name
Description
-----------------------------------------------------------------------
purge_backups
General script to enforce retention policy
validate_archived_logs
General script to synchronize archived logs on disk with RMAN.
listObjList
Syntax
listObjList::=
listObjList
archivelogRecordSpecifier
CONTROLFILE
,
’ ’
DATABASE SKIP TABLESPACE tablespace_name
dbObject
SPFILE
dbObject::=
dbObject
DATABASE
,
DATAFILE datafileSpec
,
’ ’
TABLESPACE tablespace_name
Purpose
A subclause used to specify database files and archived redo logs.
■ LIST
dbObject
Examples
Listing Datafile Copies: Example The following command lists image copies of all
the files in the database, skipping the temp tablespace, which is a
dictionary-managed temporary tablespace:
LIST COPY OF DATABASE SKIP TABLESPACE temp;
Crosschecking Archived Redo Logs: Example The following example queries the
media manager for the status of server parameter file and archived redo log
backups (either backup sets or image copies) created in the last three months:
Deleting Expired Control File Backup Sets: Example The following command
deletes expired backups (either backup sets or image copies) of the control file:
DELETE EXPIRED BACKUP OF CONTROLFILE;
maintQualifier
Syntax
maintQualifier::=
maintQualifier
completedTimeSpec
,
=
DEVICE TYPE deviceSpecifier
LIKE ’ string_pattern ’
=
BACKED UP integer TIMES TO DEVICE TYPE deviceSpecifier
= ’ ’
TAG tag_name
Purpose
A subclause used to specify database files and archived redo logs.
Example
Listing Backups on a Specific Device: Example The following command lists all
backups located on tape and copies located in /tmp:
LIST BACKUP DEVICE TYPE sbt;
LIST COPY LIKE ’/tmp’;
Deleting Archived Logs That Are Already Backed Up: Example The following
command deletes only those archived logs that have been successfully backed up
three or more times to tape:
DELETE ARCHIVELOG ALL BACKED UP 3 TIMES TO DEVICE TYPE sbt;
maintSpec
Syntax
maintSpec::=
maintSpec
OF listObjList
BACKUP
maintQualifier
archivelogRecordSpecifier
OF listObjList
COPY
,
=
DEVICE TYPE deviceSpecifier
recordSpec
Purpose
To specify the backup files operated on by the CHANGE, CROSSCHECK, and DELETE
commands.
Examples
To see the maintSpec clause in use, refer to the commands where it is used:
■ "CHANGE" on page 2-70
■ "CROSSCHECK" on page 2-116
■ "DELETE" on page 2-121
obsOperandList
Syntax
obsOperandList::=
obsOperandList
ORPHAN
RECOVERY WINDOW OF integer DAYS
=
REDUNDANCY integer
Purpose
A subclause used to specify which criteria are used to mark backups and copies as
obsolete.
Example
PRINT SCRIPT
Syntax
printScript::=
printScript
GLOBAL ’ ’ TO FILE ’ filename ’
PRINT SCRIPT script_name ;
Purpose
To print a local or global stored script to standard output or to a file.
For more information about stored scripts, see "CREATE SCRIPT" on page 2-113.
Examples
Printing a Script to a File: Example The following example prints a script to the
file ’/tmp/backup_db.rman’:
PRINT SCRIPT backup_db TO FILE ’/tmp/backup_db.rman’;
Printing a Script to the Screen: Example This example prints a stored script to
standard output (includes sample output):
RMAN> PRINT SCRIPT ’backup_db’;
QUIT
Syntax
quit::=
quit
QUIT
Purpose
To shut down the Recovery Manager utility.
Example
Quitting RMAN: Example This example starts RMAN and then shuts it down:
% rman
RMAN> QUIT
recordSpec
Syntax
recordSpec::=
recordSpec
,
’ filename ’
ARCHIVELOG ,
primaryKey
,
BACKUPSET primaryKey
,
’ media_handle ’
,
BACKUPPIECE
primaryKey
PROXY
= ’ ’
TAG tag_name
,
’ filename ’
,
primaryKey
CONTROLFILECOPY
,
DATAFILECOPY
= ’ ’ NODUPLICATES
TAG tag_name
ALL NODUPLICATES
DATAFILECOPY
LIKE ’ string_pattern ’
Purpose
A subclause that specifies which objects the CHANGE, CROSSCHECK, DELETE, and
LIST commands should operate on. Most recordSpec options allow you to specify
a primary key. Run the LIST command to obtain the key.
Examples
Deleting Datafile Copies: Example This example deletes a specified datafile copy:
DELETE NOPROMPT DATAFILECOPY ’?/oradata/users01.cpy’;
RECOVER
Syntax
recover::=
recover
,
=
DEVICE TYPE deviceSpecifier recoverOptionList
RECOVER recoverObject ;
recoverObject::=
recoverObject
= ’ ’
WITH TAG tag_name
COPY OF dbObject
,
DATAFILECOPY ’ filename ’
dbObject
recoverObject1
,
FOREVER ’ ’
SKIP TABLESPACE tablespace_name
untilClause
dbObject::=
dbObject
DATABASE
,
DATAFILE datafileSpec
,
’ ’
TABLESPACE tablespace_name
recoverOptionList::=
recoverOptionList
,
= ’ ’
ARCHIVELOG TAG tag_name
=
AUXILIARY DESTINATION ’ location ’
CHECK LOGICAL
CHECK READONLY
MAXSIZE sizeSpec
DELETE ARCHIVELOG
= ’ ’
FROM TAG tag_name
NOREDO
TEST
ALLOW integer CORRUPTION
NOPARALLEL
integer
PARALLEL
sizeSpec::=
sizeSpec
G
K
M
integer
Purpose
The RECOVER command has three uses:
■ Performing complete recovery of one or more restored datafiles, or the entire
database.
■ Performing point-in-time recovery of a database (DBPITR) or tablespace
(TSPITR).
See Also:
■ Oracle Database Backup and Recovery Basics to learn how to
recover datafiles.
■ "RESTORE" on page 2-230 command for explanation of the
default location for restoring archived logs. Note that RMAN
automatically specifies the MAXSIZE option when staging logs
in the flash recovery area.
control file is restored prior to recovery, and the backup control file does not
contain a record of the recently-added datafile.
■ If you need to restore archived log redo or incremental backups during your
recovery operation, then you must either configure channels or use ALLOCATE
CHANNEL commands in a RUN block with your RECOVER command.
■ You do not have to allocate a channel for archived log recovery because RMAN
uses the preconfigured DISK channel. If incremental backups need to be
restored during recovery, then you must either use configured channels or
manually allocate channels of the same type that created these backups.
■ RMAN uses restore failover to try all suitable backups, when it encounters
difficulty restoring files needed for the recovery operation. See Oracle Database
Backup and Recovery Advanced User's Guide for details on restore failover.
■ For datafile and tablespace recovery, the target database must be mounted. If it
is open, then the datafiles or tablespaces to be recovered must be offline. For
database recovery, the database must be mounted but not open.
■ If you want to perform DBPITR, the best practice is to enter a SET UNTIL
command before both the RESTORE and RECOVER commands. If you run SET
UNTIL after the RESTORE operation, then you may not be able to perform
media recovery on the database to the target time, because the restored files
may have time stamps later than the target time.
■ You cannot arbitrarily recover datafiles to different points in time. You can
recover the whole database to a single point in time (DBPITR, in which case you
should use SET UNTIL, followed by RESTORE DATABASE and RECOVER
DATABASE) or recover wholly contained tablespaces to a point in time different
from the rest of the database (TSPITR, in which case you must use RECOVER
TABLESPACE... UNTIL...). For more information on DBPITR, see tOracle
Database Backup and Recovery Advanced User's Guide.For more information on
TSPITR, see the procedure described in Oracle Database Backup and Recovery
Advanced User's Guide .
■ The RECOVER DATABASE command does not recover any files that are offline
normal or read-only at the point in time to which the files are being recovered.
RMAN omits offline normal files with no further checking. If CHECK READONLY
is specified, then RMAN checks each read-only file on disk to ensure that it is
already current at the desired point in time. If CHECK READONLY is not
specified, then RMAN omits read-only files.
■ You must open the database with the RESETLOGS option after incomplete
recovery or recovery with a backup control file.
recoverObject
dbObject
recoverOptionList
Examples
management channel to use datafile copies on disk and backups on tape, and
restores one of the datafiles in tablespace users to a different location:
RMAN> RUN
{
ALLOCATE CHANNEL dev2 DEVICE TYPE sbt;
SQL "ALTER TABLESPACE users OFFLINE IMMEDIATE";
SET NEWNAME FOR DATAFILE '?/oradata/trgt/users01.dbf'
TO '/tmp/users01.dbf';
RESTORE TABLESPACE users;
SWITCH DATAFILE ALL;
RECOVER TABLESPACE users;
SQL "ALTER TABLESPACE users ONLINE";
}
Performing DBPITR with a Backup Control File and Recovery Catalog: Example
Assume that all datafiles and control files as well as archived redo log 40 were lost
due to a disk failure. Because you do not have incremental backups, you need to
recover the database with available archived redo logs. You do not need to restore
tablespace history because it has not changed since log 40. After connecting to the
target and recovery catalog, follow the example shown here:
RMAN> STARTUP FORCE NOMOUNT;
RMAN> RUN
{
SET UNTIL SEQUENCE 530 THREAD 1; # Recover database until log sequence 40
RESTORE CONTROLFILE TO '/tmp/control01.ctl';
RESTORE CONTROLFILE FROM '/tmp/control01.ctl'; # Replicates to CONTROL_FILES locations
ALTER DATABASE MOUNT;
RESTORE DATABASE SKIP TABLESPACE temp, history;
RECOVER DATABASE SKIP FOREVER TABLESPACE temp;
}
RMAN> ALTER DATABASE OPEN RESETLOGS;
If the database uses locally-managed temporary tablespaces, then you must add
tempfiles to these tablespaces after restoring a backup control file, using the SQL
ALTER TABLESPACE... ADD TEMPFILE command:
RMAN> SQL "ALTER TABLESPACE temp ADD TEMPFILE ''?/oradata/trgt/temp01.dbf'' REUSE";
You can also refer to the datafile copy by its tag, with this form of the command:
RMAN> RECOVER COPY OF DATAFILE 3 WITH TAG "DF3CPY";
At time t2, t3, and t4 you make incremental backups of the database. To roll forward
the image copy of datafile 3 to the date of the latest incremental backup, use the
RECOVER command. You can identify the datafile by its filename with this form of
the command:
RMAN> RECOVER DATAFILECOPY ’/disk1/3img.df’;
Available incremental backups are applied to the datafile copy to recover it to the
desired point in time. Redo from the archived redo logs is not applied by this
command.
REGISTER
Syntax
register::=
register
REGISTER DATABASE ;
Purpose
To register the target database in the recovery catalog so that RMAN can access it.
RMAN obtains all information it needs to register the target database from the
target database itself.
Note: If you are using RMAN with different target databases that
have the same database name and DBID, be careful to always
specify the correct recovery catalog schema when invoking RMAN.
Example
RELEASE CHANNEL
Syntax
release::=
release
= ’ ’
RELEASE CHANNEL channel_id ;
Purpose
To release a channel while maintaining the connection to the target database
instance. Specify the channel name with the same identifier used in the ALLOCATE
CHANNEL command. This command is optional because RMAN automatically
releases all channels allocated when a RUN block terminates.
Examples
Releasing a Channel: Example This example makes three identical backup sets of
datafiles 1 to 4 to tape with channel ch1, then releases it. RMAN then makes three
identical backups of datafiles 5 to 7 to tape with channel ch2 and then releases it:
RUN {
SET BACKUP COPIES = 3;
ALLOCATE CHANNEL ch1 DEVICE TYPE sbt FORMAT ’bkup_%U’;
ALLOCATE CHANNEL ch2 DEVICE TYPE sbt MAXPIECESIZE = 5M;
BACKUP CHANNEL ch1 DATAFILE 1,2,3,4;
RELEASE CHANNEL ch1;
releaseForMaint
Syntax
releaseForMaint::=
releaseForMaint
RELEASE CHANNEL ;
Purpose
To release a sequential I/O device specified in an ALLOCATE CHANNEL FOR
MAINTENANCE command. Note that maintenance channels are unaffected by
ALLOCATE CHANNEL and RELEASE CHANNEL command issued within a RUN
command.
Requirements
■ Execute this command only at the RMAN prompt, not within a RUN block.
■ You must have a maintenance channel allocated in order to release it.
Examples
REPLACE SCRIPT
Syntax
replaceScript::=
replaceScript
=
GLOBAL ’ ’ COMMENT ’ comment ’
REPLACE SCRIPT script_name
replaceScript1
backupCommands
maintenanceCommands
{ }
miscellaneousCommands
restoreCommands
;
FROM FILE ’ filename ’
Purpose
To replace an existing script stored in the recovery catalog. If the script does not
exist, then REPLACE SCRIPT creates it.
A stored script is a sequence of RMAN commands, given a name and stored in the
recovery catalog for later execution. A stored script may be local (that is, associated
with one target database) or global (available for use with any database registered
in the recovery catalog).
For more information about stored scripts and commands used to create, update,
delete and execute stored scripts, see "CREATE SCRIPT" on page 2-113.
Example
REPORT
Syntax
report::=
report
DAYS =
integer
INCREMENTAL
RECOVERY WINDOW OF integer DAYS
=
REDUNDANCY integer
NEED BACKUP reportObject
obsOperandList
OBSOLETE
REPORT
atClause
SCHEMA
UNRECOVERABLE reportObject
report1
,
=
DEVICE TYPE deviceSpecifier
;
reportObject::=
reportObject
,
’ ’
SKIP TABLESPACE tablespace_name
DATABASE
,
DATAFILE datafileSpec
,
’ ’
TABLESPACE tablespace_name
atClause::=
atClause
=
AT SCN integer
=
= THREAD integer
AT SEQUENCE integer
=
AT TIME ’ date_string ’
Purpose
To perform detailed analyses of the RMAN repository. The Database writes the
output from the REPORT command to standard output or the message log file.
Use the REPORT command to answer questions such as the following:
■ Which files need a backup?
■ Which files have not had a backup for some time?
■ Which files are not recoverable due to unrecoverable operations?
■ Which backup files can be deleted?
■ What was the physical schema of the database at a previous time?
See Also: Oracle Database Backup and Recovery Basics to learn how
to use RMAN’s reporting functionality
reportObject
atClause
Report Output
The information that appears in the output is described in the following tables:
■ Table 2–21, "Report of Database Schema"
■ Table 2–22, "Report of Obsolete Backups and Copies"
■ Table 2–23, "Report of Files that Need Backup Due to Unrecoverable
Operations"
■ Table 2–24, "Report of Files with Fewer Than n Redundant Backups"
■ Table 2–25, "Report of Files Whose Recovery Needs More Than n Days of
Archived Logs"
■ Table 2–26, "Report of Files That Need More than n Incrementals During
Recovery"
Table 2–23 Report of Files that Need Backup Due to Unrecoverable Operations
Column Indicates
File The absolute number of the datafile that needs a new backup
due to unrecoverable operations.
Type Of Backup FULL or INCREMENTAL, depending on which type of backup
Required is necessary to ensure the recoverability of all of the data in
this file. If FULL, then create a full backup, level 0 backup, or a
datafile copy. If INCREMENTAL, then a full or incremental
backup will also suffice.
Name The name of the datafile.
Table 2–25 Report of Files Whose Recovery Needs More Than n Days of Archived
Logs
Column Indicates
File The absolute file number of a datafile that requires more than
n days of archived redo logs for recovery.
Days The number of days of archived redo data required for
recovery.
Table 2–25 Report of Files Whose Recovery Needs More Than n Days of Archived
Logs (Cont.)
Column Indicates
Name The name of the datafile.
Table 2–26 Report of Files That Need More than n Incrementals During Recovery
Column Indicates
File The absolute file number of a datafile that requires more than
n incrementals for complete recovery.
Incrementals The number of incremental backups required for complete
recovery.
Name The name of the datafile.
Examples
3 9 /oracle/oradata/trgt/cwmlite01.dbf
4 9 /oracle/oradata/trgt/drsys01.dbf
Report of files whose recovery needs more than 2 days of archived logs
File Days Name
---- ----- -----------------------------------------------------
1 3 /oracle/oradata/trgt/drsys01.dbf.f
RESET DATABASE
Syntax
reset::=
reset
RESET DATABASE TO INCARNATION primaryKey ;
Purpose
To reset the target database in the RMAN repository, which means to do either of
the following actions:
■ Inform RMAN that the SQL statement ALTER DATABASE OPEN RESETLOGS has
been executed and that a new incarnation of the target database has been
created. Note that if you run the RMAN command ALTER DATABASE OPEN
RESETLOGS (not the SQL statement with the same keywords), then RMAN
resets the target database automatically so that you do not have to run RESET
DATABASE. By resetting the database, RMAN considers the new incarnation as
the current incarnation of the database.
■ To reset the database to a previous incarnation. Typically, you would reset the
incarnation when performing incomplete recovery to a point before a
RESETLOGS operation, or when attempting to undo the affects of a RESETLOGS
by restoring backups taken before a RESETLOGS.
Examples
# step 1: start and mount a control file that knows about the incarnation to which
# you want to return. if the current control file does not know about it, then
# you must restore an older control file
STARTUP NOMOUNT;
RESTORE CONTROLFILE UNTIL TIME ’SYSDATE-250’;
ALTER DATABASE MOUNT;
# step 4: restore and recover the database to a point before the RESETLOGS
RESTORE DATABASE UNTIL SCN 154876;
RECOVER DATABASE UNTIL SCN 154876;
# step 5: make this incarnation the current incarnation and then list incarnations:
ALTER DATABASE OPEN RESETLOGS;
LIST INCARNATION OF DATABASE trgt;
Resetting the Database After Incomplete Recovery: Example This example assumes that
an incomplete recovery or recovery with a backup control file was performed in NOCATALOG mode. Later, RMAN is
started in CATALOG mode, but the RESYNC command fails because the incarnation has not been reset in the catalog.
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03009: failure of resync command on default channel at 11/01/2001 12:00:43
RMAN-20003: target database incarnation not found in recovery catalog
RESTORE
Syntax
restore::=
restore
( restoreSpecOperand )
RESTORE restoreObject
restore1
= ’ ’
CHANNEL channel_id
CHECK LOGICAL
CHECK READONLY
,
=
DEVICE TYPE deviceSpecifier
FORCE
BACKUPSET
FROM
DATAFILECOPY
= ’ ’
FROM TAG tag_name
SUMMARY
PREVIEW
untilClause
VALIDATE
;
restoreObject::=
restoreObject
archivelogRecordSpecifier
TO ’ filename ’
CONTROLFILE
,
FOREVER ’ ’
SKIP TABLESPACE tablespace_name
DATABASE
,
DATAFILE datafileSpec
PFILE
TO ’ filename ’
SPFILE
TO ’ filename ’
STANDBY CONTROLFILE
,
’ ’
TABLESPACE tablespace_name
restoreSpecOperand::=
restoreSpecOperand
= ’ ’
CHANNEL channel_id
autoBackupOptList
AUTOBACKUP
FROM
’ media_handle ’
= ’ ’
FROM TAG tag_name
autoBackupOptList::=
autoBackupOptList
= ’ ’
DB_NAME database_name
MAXDAYS =
integer
MAXSEQ
= ’ ’
DB_NAME database_name
RECOVERY AREA =
quoted_string = identifier
DB_RECOVERY_FILE_DEST DB_UNIQUE_NAME
quoted_string
Purpose
The primary use of RESTORE is to restore files from backups or image copies.
Typically, you restore when a media failure has damaged a current datafile, control
file, or archived log or prior to performing a point-in-time recovery.
There are two other uses of RESTORE:
■ RESTORE... PREVIEW identifies the backups which RMAN will use to perform
any RESTORE operation. Output from a RESTORE... PREVIEW is in the same
format as the output of the LIST command.
■ With the VALIDATE option, RMAN scans existing backups that it would use to
perform a RESTORE operation to determine whether the operation can be
performed successfully.
RMAN chooses which backups to restore based on the criteria that you specify. For
example, you can limit the restore to backups before a given point of time (within
the current incarnation) with the untilClause.
When you run RESTORE in CATALOG mode with a backup control file, RMAN
automatically adjusts the control file to reflect the structure of the restored database.
If you do not run SET NEWNAME and RMAN detects that the default filename cannot
be used (for example, because the filename is in use by another database that shares
the storage), and if the file is an Oracle Managed File or is on an Automatic Storage
Management disk group, then RMAN attempts to create a new file in the same
location or disk group.
If you run RESTORE in this configuration, then RMAN allocates three sbt channels
and the two preconfigured DISK channels.
Restore Failover
If a backup piece, image copy or proxy copy is inaccessible (for instance, deleted
from the device) or if a block is corrupted, then the RESTORE command
automatically looks for a another usable copy of this backup piece or image copy on
both the same device and other devices. If no usable copies are available, then
RMAN searches for prior backups. RMAN continously searches for prior usable
backups until it has exhaused all possibilities.
Restore failover also occurs when restoring archivelogs for use in RECOVER,
BLOCKRECOVER and FLASHBACK operations. RMAN records messages about
failover due to block corruption in the alert log and trace files.
See Oracle Database Backup and Recovery Advanced User's Guide for details on restore
failover.
See Also: Oracle Database Backup and Recovery Basics to learn how
to restore files
For example, if you made some backups of a datafile to DISK channels and
others to sbt channels, and only a DISK channel is allocated for the RESTORE
command, RMAN will not restore backups that were created on sbt channels.
■ If there are no backups available for a lost datafile, RMAN will create an empty
datafile with the checkpoint change as creation SCN. During recovery, all
archived logs back to the creation of the datafile will be restored, and all
changes during the history of the datafile will be re-applied to recreate its
contents.
■ If datafile names are symbolic links, that is, files pointing to other files, then the
control file stores the filenames of the link files but RMAN performs I/O on the
datafiles pointed to by the link files. If a link file is lost and you RESTORE a
datafile without re-creating the symbolic link, then RMAN restores the datafile
to the location of the link file rather than to the location pointed to by the link.
■ If the database is started but not mounted in NOCATALOG mode, then the
RESTORE SPFILE command requires the FROM AUTOBACKUP clause.
■ If you are restoring the server parameter file and the control file in a disaster
recovery situation, you cannot run RESTORE CONTROLFILE FROM
AUTOBACKUP, mount this control file, and then run RESTORE SPFILE without
the FROM AUTOBACKUP clause.
■ Do not specify a datafile more than once in a restore job. For example, the
following command is illegal because datafile 1 is both specified explicitly
and implied by the SYSTEM tablespace:
RESTORE TABLESPACE SYSTEM DATAFILE 1;
■ You must have already configured a device type by using CONFIGURE (except
for DISK, which is preconfigured) before specifying the DEVICE TYPE option.
■ You cannot manually allocate channels and then run RECOVER DEVICE TYPE.
■ RMAN cannot backup or restore locally-managed temporary tablespaces.
RMAN can, however, back up and restore dictionary-managed temporary
tablespaces.
■ RMAN does not support backup and recovery of the change tracking file. Note
that database restore and recovery has no user-visible effect on change tracking.
The next incremental backup after any recovery is able to use the
change-tracking file.
■ If no suitable backups are available in the current incarnation of the database,
then you can force RMAN to use backups from a previous incarnation. Using
the CHANGE... UNAVAILABLE command, you can make all backups since the
restoreObject
restoreSpecOperand
autoBackupOptList
Examples
Restoring the Control File When Using a Recovery Catalog: Example This
example restores the control file to its default location, replicates it automatically to
all CONTROL_FILES locations, and mounts the database:
RUN
{ # SET DBID is not necessary when connected to a recovery catalog
STARTUP FORCE NOMOUNT;
RESTORE CONTROLFILE;
ALTER DATABASE MOUNT;
}
Restoring the Control File with a Tag: Example This NOCATALOG example restores
the control file specified by a tag, and then mounts the database:
CONNECT TARGET /
STARTUP NOMOUNT;
SET DBID 320066378; # required when restoring control file in NOCATALOG mode
RESTORE CONTROLFILE FROM TAG ’monday_cf_backup’;
ALTER DATABASE MOUNT;
Restoring the Database with a Backup Control File: Example This example
restores the control file to a temporary location, replicates it to all control file
locations specified in the CONTROL_FILES initialization parameter, and then
restores and recovers the database:
CONNECT TARGET /
STARTUP NOMOUNT;
SET DBID 320066378; # required when restoring control file in NOCATALOG mode
RUN
{
ALLOCATE CHANNEL c1 DEVICE TYPE sbt;
RESTORE CONTROLFILE TO ’/tmp/control01.ctl’ FROM AUTOBACKUP;
RESTORE CONTROLFILE FROM ’/tmp/control01.ctl’; # restores to all CONTROL_FILES locations
ALTER DATABASE MOUNT;
RESTORE DATABASE;
RECOVER DATABASE;
}
ALTER DATABASE OPEN RESETLOGS;
# if the database uses locally-managed temporary tablespaces, then add new tempfiles
# to these tablespaces after the RESETLOGS
SQL "ALTER TABLESPACE temp ADD TEMPFILE ’’?/oradata/trgt/temp01.dbf’’ REUSE";
Restoring the Server Parameter File to Current Location: Example The following
series of commands restores the current server parameter file in NOCATALOG mode:
rman TARGET /
RMAN> SET DBID 1447326980 # set dbid to dbid of target database
RMAN> STARTUP FORCE NOMOUNT; # start instance with dummy SPFILE
RMAN> RUN
{
ALLOCATE CHANNEL c1 DEVICE TYPE sbt;
RESTORE SPFILE FROM AUTOBACKUP; # FROM AUTOBACKUP needed in NOCATALOG mode
}
RMAN> STARTUP FORCE; # start with restored SPFILE and open database
RESYNC
Syntax
resync::=
resync
FROM CONTROLFILECOPY ’ filename ’
RESYNC CATALOG ;
Purpose
To perform a full resynchronization of the recovery catalog. You can also use
RESYNC CONTROLFILE to resynchronize the current control file with the RMAN
repository in a control file copy.
Resynchronizations can be full or partial. When full, RMAN updates all changed
records for the physical schema: datafiles, tablespaces, redo threads, and online
redo logs. If the database is open, RMAN also obtains data about rollback segments.
When partial, RMAN reads the current control file to update data, but does not
resynchronize metadata about the physical schema or rollback segments.
When you run RESYNC CATALOG, RMAN creates a snapshot control file in order to
obtain a read-consistent view of the control file, then updates the recovery catalog
with any new information from the snapshot. The RESYNC CATALOG command
updates the classes or records described in the following table.
Examples
Resynchronizing the Current Control File from a Backup: Example This example
updates the RMAN repository in the current control file with metadata from a
backup control file:
CONNECT TARGET / NOCATALOG
RESYNC CONTROLFILE FROM CONTROLFILECOPY '/tmp/cfile.dbf';
RUN
Syntax
run::=
run
backupCommands
maintenanceCommands
RUN { }
miscellaneousCommands
restoreCommands
backupCommands::=
backupCommands
backup
convert
restoreCommands::=
restoreCommands
blockrecover
duplicate
flashback
recover
restore
switchFile
maintenanceCommands::=
maintenanceCommands
catalog
change
configure
crosscheck
delete
report
show
validate
miscellaneousCommands::=
miscellaneousCommands
allocate
alterDatabase
executeScript
host
release
resync
send
set
shutdown
sql
startup
Purpose
The RUN command lets you group a series RMAN commands into a block to be
executed sequentially. It also creates a scope within which a script can override
default configured channels for a task using the ALLOCATE CHANNEL and
RELEASE CHANNEL commands, and other parameters using the SET command
with appropriate arguments. On completing the execution of the commands listed
in the RUN block, the channels allocated within the RUN block are released and
settings returned to their values.
Upon reading the closing brace of the RUN block, RMAN compiles the list of job
commands into one or more job steps and then executes the steps immediately.
Examples
Executing an RMAN Script: Example This example executes the stored script
backup_db:
RUN { EXECUTE SCRIPT backup_db; }
SEND
Syntax
send::=
send
,
= ’ ’
CHANNEL channel_id
SEND , ’ command ’
=
DEVICE TYPE deviceSpecifier
send1
=
PARMS ’ channel_parms ’
;
Purpose
To send a vendor-specific string to one or more channels supported by a media
manager. Refer to your media management documentation to determine which
commands are supported.
Example
SET
Syntax
set::=
set
;
setRmanOption
SET
setRunOption ;
setRmanOption::=
setRmanOption
AUXILIARY INSTANCE PARAMETER FILE TO ’ filename ’
=
CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE deviceSpecifier TO formatSpec
COMMAND ID TO ’ string ’
=
DBID integer
OFF
ECHO
ON
setRunOption::=
setRunOption
ARCHIVELOG DESTINATION TO ’ log_archive_dest ’
=
BACKUP COPIES integer
=
CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE deviceSpecifier TO formatSpec
COMMAND ID TO ’ string ’
,
MAXCORRUPT FOR DATAFILE datafileSpec TO integer
’ filename ’
NEWNAME FOR DATAFILE datafileSpec TO
NEW
untilClause
Purpose
To configure settings that apply only to the current RMAN session. The SET
command contrasts with the CONFIGURE command, which configures persistent
settings that apply to all RMAN sessions.
You can use the SET command either at the RMAN prompt or within a RUN block.
Within a RUN block, the SET command sets attributes that persist until the end of
the RUN block. The specified attributes affect all statements within RUN that follow
the SET command. When you use SET outside of a RUN block the attributes you set
persist until you exit the RMAN client.
Use the SET command outside a RUN block to:
■ Display executed RMAN commands in the message log.
■ Specify a database's database identifier (DBID) when restoring a control file or
server parameter file.
Use SET specified within a RUN block to:
■ Specify new filenames for restored datafiles
■ Specify the filenames for the auxiliary database during TSPITR or database
duplication.
■ Specify a limit for the number of permissible block corruptions.
■ Override default archived redo log destinations.
setRunOption
Examples
Restoring the Control File When Databases Share the Same Name: Example The
following example uses the DBID to restore the control file because multiple target
databases share the same DB_NAME in the catalog. After you have restored the target
control file, you can mount the database to restore the rest of the database:
rman TARGET / CATALOG rman/rman@catdb
RMAN> STARTUP FORCE NOMOUNT;
RMAN> SET DBID = 862893450; # needed to distinguish target from others with same DB_NAME
RMAN> RESTORE CONTROLFILE; # assuming catalog has automatic channel allocation information
RMAN> ALTER DATABASE MOUNT;
Setting the Command ID: Example This example sets the command ID, backs up
the users tablespace, then archives the online redo logs:
RUN
{
ALLOCATE CHANNEL t1 DEVICE TYPE DISK FORMAT '/disk1/%U';
ALLOCATE CHANNEL t2 DEVICE TYPE DISK FORMAT '/disk2/%U';
SET COMMAND ID TO 'rman';
BACKUP INCREMENTAL LEVEL 0 MAXSETSIZE 5M TABLESPACE users;
SQL 'ALTER SYSTEM ARCHIVE LOG ALL';
}
Duplexing a Backup Set: Example Assume that you have used the CONFIGURE
command to set duplexing as follows:
CONFIGURE ARCHIVELOG COPIES FOR DEVICE TYPE sbt TO 4;
CONFIGURE DATAFILE COPIES FOR DEVICE TYPE sbt TO 3;
The following example overrides these configurations and makes two copies of
each datafile and archived log in the backup:
RUN
{
ALLOCATE CHANNEL dev1 DEVICE TYPE sbt;
SET BACKUP COPIES = 2;
BACKUP DATAFILE 1,2,3,4,5;
BACKUP ARCHIVELOG ALL;
}
Overriding the Autobackup Format During a Restore: Example This example sets
the DBID, sets a boundary time for the restore, then restores a control file
autobackup with a nondefault format. First start RMAN and then run:
CONNECT TARGET / NOCATALOG
STARTUP FORCE NOMOUNT
SET DBID 676549873;
RUN
{
SET UNTIL TIME '10/10/2001 13:45:00';
SET CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '?/oradata/cf_%F.bak';
RESTORE CONTROLFILE FROM AUTOBACKUP MAXSEQ 100;
}
ALTER DATABASE MOUNT;
Restoring the Server Parameter File: Example This example restores a lost server
parameter file:
CONNECT TARGET / CATALOG rman/rman@catdb
SET DBID 676549873; # set dbid so rman knows the database name
STARTUP FORCE NOMOUNT # rman starts database with a dummy server parameter file
RESTORE SPFILE;
STARTUP FORCE; # needed so that RMAN restarts database with restored server parameter file
SHOW
Syntax
show::=
show
ALL
BACKUP COPIES
ARCHIVELOG
DELETION POLICY
AUXNAME
BACKUP OPTIMIZATION
=
AUXILIARY FOR DEVICE TYPE deviceSpecifier
CHANNEL
SHOW FORMAT ;
CONTROLFILE AUTOBACKUP
DATAFILE BACKUP COPIES
DEFAULT
DEVICE TYPE
EXCLUDE
MAXSETSIZE
RETENTION POLICY
SNAPSHOT CONTROLFILE NAME
Purpose
To display the current CONFIGURE command settings. The output of SHOW consists
of the CONFIGURE commands used to set the configuration. RMAN default
configurations are suffixed with #default.
Examples
SHUTDOWN
Syntax
shutdown::=
shutdown
ABORT
IMMEDIATE
NORMAL
TRANSACTIONAL ;
SHUTDOWN
Purpose
To shut down the target database without exiting RMAN. This command is
equivalent to using the SQL*Plus SHUTDOWN statement.
Examples
SPOOL
Syntax
spool::=
spool
OFF APPEND ;
SPOOL LOG
TO filename
Purpose
To write RMAN output to a log file.
If the file does not already exist, then RMAN creates it. If the file does exist, then
RMAN overwrites the file by default. If you specify APPEND, RMAN will append its
output to the end of the file.
If the specified file cannot be opened for writing. Instead, RMAN turns SPOOL to
OFF and continues execution.
Examples
Spooling RMAN Output to a File: Example This example directs RMAN output to
standard output for the backup of datafile 1, then directs output to a log file for the
backup of datafile 2, then directs output to a different log file for the whole
database backup:
BACKUP DATAFILE 1;
SPOOL LOG TO '/tmp/df2log.f';
BACKUP DATAFILE 2;
SPOOL LOG OFF;
SPOOL LOG TO '/tmp/dblog.f';
BACKUP DATABASE;
SPOOL LOG OFF;
SQL
Syntax
sql::=
sql
SQL ’ command ’ ;
Purpose
To execute a SQL statement or a PL/SQL stored procedure from within Recovery
Manager.
If you attempt to use single quotes for the string following the SQL keyword or
use only one set of single quotes for the filename, then the command fails.
■ You cannot execute SELECT statements.
See Also: For valid SQL syntax, see the Oracle Database SQL
Reference
Examples
STARTUP
Syntax
startup::=
startup
DBA
FORCE
MOUNT
NOMOUNT
= ’ ’
PFILE filename ;
STARTUP
Purpose
To start the target database from within the RMAN environment. This command is
equivalent to using the SQL*Plus STARTUP command. You can:
■ Start the instance without mounting a database.
■ Start the instance and mount the database, but leave it closed.
■ Start the instance, and mount and open the database in:
– unrestricted mode (accessible to all users)
– restricted mode (accessible to DBAs only)
Additionally, the RMAN STARTUP command can start an instance in NOMOUNT
mode even if no server parameter file or initialization parameter file exists. This
feature is useful when you need to restore a lost server parameter file.
Examples
Opening the Database by Using the Default Parameter File: Example This
example starts and opens the database:
STARTUP;
Mounting the Database While Specifying the Parameter File: Example This
example forces a SHUTDOWN ABORT and then mounts the database with restricted
access, specifying a nondefault parameter file location:
STARTUP FORCE MOUNT DBA PFILE=/tmp/initTRGT.ora;
SWITCH
Syntax
switch::=
switch
DATABASE
,
DATAFILE datafileSpec
SWITCH TO COPY ;
,
’ ’
TABLESPACE tablespace_name
switchFile::=
switchFile
DATAFILE ALL
’ filename ’
SWITCH TO DATAFILECOPY ;
= ’ ’
TAG tag_name
DATAFILE datafileSpec
Purpose
To specify that a datafile copy is now the current datafile, that is, the datafile
pointed to by the control file. A SWITCH is equivalent to using the PL/SQL ALTER
DATABASE RENAME FILE statement: the names of the files in the RMAN repository
are updated, but the database does not actually rename the files at the operating
system level. Note that this command deletes the records for the datafile copy from
the recovery catalog and updates the control file records to status DELETED.
■ If the control file is a restored backup control file, then SWITCH adds the datafile
to the control file if it is not there already. You can only add datafiles through
SWITCH that were created after the backup control file was created.
switchFile
DATAFILE ALL Specifies that all datafiles for which a SET NEWNAME FOR DATAFILE
command has been issued in this job are switched to their new name.
Example
UNREGISTER DATABASE
Syntax
unregister::=
unregister
database_name NOPROMPT
UNREGISTER DATABASE ;
Purpose
To unregister a database from the recovery catalog.
Example
untilClause
Syntax
untilClause::=
untilClause
=
UNTIL SCN integer
=
= THREAD integer
UNTIL SEQUENCE integer
=
UNTIL TIME ’ date_string ’
Purpose
A subclause that specifies an upper limit by time, SCN, or log sequence number for
various RMAN operations.
See Also: Oracle Database Backup and Recovery Basics to learn how
to set the date format used by RMAN
Examples
Reporting Obsolete Backups: Example This example assumes that you want to be
able to recover to any point within the last week. It considers as obsolete all backups
that could be used to recover the database to a point one week ago:
REPORT OBSOLETE UNTIL TIME 'SYSDATE-7';
UPGRADE CATALOG
Syntax
upgradeCatalog::=
upgradeCatalog
;
UPGRADE CATALOG
Purpose
To upgrade the recovery catalog schema from an older version to the version
required by the RMAN executable. For example, if you use a release 8.0 recovery
catalog with a release 8.1 version of RMAN, then you must upgrade the catalog.
Note that UPGRADE CATALOG does not run scripts to perform the upgrade. Instead,
RMAN sends various SQL DDL statements to the recovery catalog to update the
recovery catalog schema with new tables, views, columns, and so forth.
Example
VALIDATE
Syntax
validate::=
validate
CHECK LOGICAL
,
, =
DEVICE TYPE deviceSpecifier
VALIDATE BACKUPSET primaryKey ;
Purpose
To examine a backup set and report whether it can be restored. RMAN scans all of
the backup pieces in the specified backup sets and looks at the checksums to verify
that the contents are intact so that the backup can be successfully restored if
necessary.
Use this command when you suspect that one or more backup pieces in a backup
set are missing or have been damaged. Use VALIDATE BACKUPSET to specify which
backups to test; use the VALIDATE option of the RESTORE command to let RMAN
choose which backups to validate. For validating image copies, run RESTORE
VALIDATE FROM DATAFILECOPY.
Example
Validating a Backup Set: Example This example validates the status of the backup
set whose primary key is 218:
VALIDATE BACKUPSET 218;
# As the output indicates, RMAN determines whether it is possible to restore the
# specified backup set.
This chapter contains descriptions of recovery catalog views. You can only access
these views if you have created a recovery catalog. For a summary of the recovery
catalog views, refer to "Summary of RMAN Recovery Catalog Views" on page 3-2.
Note: These views are not normalized, but are optimized for
RMAN usage. Hence, most catalog views have redundant values
that result from joining of several underlying tables.
RC_ARCHIVED_LOG
This view contains historical information about archived and unarchived redo logs.
It corresponds to the V$ARCHIVED_LOG view in the target database control file.
Oracle inserts an archived redo log record after the online redo log is successfully
archived. If a log that has not been archived is cleared, a record is inserted with the
NAME column set to NULL.
If the log is archived multiple times, then the view will contain multiple archived
log records with the same THREAD#, SEQUENCE#, and RESETLOGS_CHANGE#, but
with a different name.
An archived log record is also inserted when an archived log is restored from a
backup set or a copy.
Note that an archived log can have no record if the record ages out of the control
file.
RC_BACKUP_CONTROLFILE
This view lists information about control files in backup sets. Note that the
V$BACKUP_DATAFILE view contains both datafile and control file records: a
backup datafile record with file number 0 represents the backup control file. In the
recovery catalog, the RC_BACKUP_CONTROLFILE view contains only control file
records, while the RC_BACKUP_DATAFILE view contains only datafile records.
RC_BACKUP_CORRUPTION
This view lists corrupt block ranges in datafile backups. It corresponds to the
V$BACKUP_CORRUPTION view in the control file. Note that corruptions are not
tolerated in control file and archived redo log backups.
RC_BACKUP_DATAFILE
This view lists information about datafiles in backup sets. It corresponds to the
V$BACKUP_DATAFILE view. A backup datafile is uniquely identified by BDF_KEY.
RC_BACKUP_FILES
This views lists backups known to the RMAN repository as reflected in the recovery
catalog. This view corresponds to the V$BACKUP_FILES view.
Note that it is often more convenient to access this information using the LIST
BACKUP and LIST COPY commands from within RMAN.
RC_BACKUP_PIECE
This view lists information about backup pieces. This view corresponds to the
V$BACKUP_PIECE view. Each backup set contains one or more backup pieces.
Multiple copies of the same backup piece can exist, but each copy has its own
record in the control file and its own row in the view.
RC_BACKUP_REDOLOG
This view lists information about archived redo logs in backup sets. It corresponds
to the V$BACKUP_REDOLOG view.
You cannot back up online logs directly: you must first archive them to disk and
then back them up. An archived log backup set contains one or more archived logs.
RC_BACKUP_SET
This view lists information about backup sets for all incarnations of the database. It
corresponds to the V$BACKUP_SET view. A backup set record is inserted after the
backup has successfully completed.
RC_BACKUP_SPFILE
This view lists information about server parameter files in backup sets.
RC_CHECKPOINT
RC_CONTROLFILE_COPY
This view lists information about control file copies on disk. A datafile copy record
with a file number of 0 represents the control file copy in V$DATAFILE_COPY.
RC_COPY_CORRUPTION
This view lists corrupt block ranges in datafile copies. It corresponds to the
V$COPY_CORRUPTION view.
RC_DATABASE
This view gives information about the databases registered in the recovery catalog.
It corresponds to the V$DATABASE view.
RC_DATABASE_BLOCK_CORRUPTION
This view gives information about database blocks that were corrupted after the last
backup. It corresponds to the V$DATABASE_BLOCK_CORRUPTION view.
RC_DATABASE_INCARNATION
This view lists information about all database incarnations registered in the
recovery catalog. Oracle creates a new incarnation whenever you open a database
with the RESETLOGS option. Records about the current and immediately previous
incarnation are also contained in the V$DATABASE view.
RC_DATAFILE
This view lists information about all datafiles registered in the recovery catalog. It
corresponds to the V$DATAFILE view. A datafile is shown as dropped if its
tablespace was dropped.
RC_DATAFILE_COPY
This view lists information about datafile copies on disk. It corresponds to the
V$DATAFILE_COPY view.
RC_LOG_HISTORY
This view lists historical information about the online redo logs. RMAN adds a new
row during a catalog resynchronization whenever Oracle has switched out of the
online redo log. This catalog view corresponds to the V$LOG_HISTORY view.
RC_OFFLINE_RANGE
This view lists the offline ranges for datafiles. It corresponds to the V$OFFLINE_
RANGE view.
An offline range is created for a datafile when its tablespace is first altered to be
offline normal or read-only, and then subsequently altered to be online or
read/write. Note that no offline range is created if the datafile itself is altered to be
offline or if the tablespace is altered to be offline immediate.
RC_PROXY_ARCHIVEDLOG
This view contains descriptions of archived log backups that were taken using the
proxy copy functionality. It corresponds to the V$PROXY_ARCHIVEDLOG view.
In a proxy copy, the media manager takes over the operations of backing up and
restoring data. Each row represents a backup of one control file.
RC_PROXY_CONTROLFILE
This view contains descriptions of control file backups that were taken using the
proxy copy functionality. It corresponds to the V$PROXY_DATAFILE view.
In a proxy copy, the media manager takes over the operations of backing up and
restoring data. Each row represents a backup of one control file.
RC_PROXY_DATAFILE
This view contains descriptions of datafile backups that were taken using the proxy
copy functionality. It corresponds to the V$PROXY_DATAFILE view.
In a proxy copy, the media manager takes over the operations of backing up and
restoring data. Each row represents a backup of one database file.
RC_REDO_LOG
This view lists information about the online redo logs for all incarnations of the
database since the last catalog resynchronization. This view corresponds to a
combination of the V$LOG and V$LOGFILE views.
RC_REDO_THREAD
This view lists data about all redo threads for all incarnations of the database since
the last catalog resynchronization. This view corresponds to V$THREAD.
RC_RESYNC
This view lists information about recovery catalog resynchronizations. Every full
resynchronization takes a snapshot of the target database control file and
resynchronizes the recovery catalog from the snapshot.
RC_RMAN_CONFIGURATION
RC_RMAN_STATUS
This view contains information about the history of RMAN operations on all
databases associated with this recovery catalog. It contains essentially the same
information as V$RMAN_STATUS, except that it does not contain information about
current sessions.
All RMAN operations such as backups, restores, deletion of backups, and so on are
logged in this table. The table is organized to show the status of each RMAN session
(the invocation of an RMAN client, including all actions taken until the RMAN
client exits), operations executed during the session, and recursive operations.
RC_RMAN_STATUS also contains the RSR_KEY, PARENT_KEY and SESSION_
KEY columns, which do not appear in V$RMAN_STATUS.
RC_STORED_SCRIPT
This view lists information about scripts stored in the recovery catalog. The view
contains one row for each stored . (Note that RMAN’s commands for management
such as LIST NAMES and LIST provide more convenient ways of viewing this
information.)
RC_STORED_SCRIPT_LINE
This view lists information about lines of the scripts stored in the recovery catalog.
The view contains one row for each line of each stored .
RC_TABLESPACE
This view lists all tablespaces registered in the recovery catalog, all dropped
tablespaces, and tablespaces that belong to old incarnations. It corresponds to the
V$TABLESPACE view. The current value is shown for tablespace attributes.
This appendix describes Recovery Manager syntax that is deprecated and describes
preferred syntax if any exists.
Deprecated RMAN syntax continues to be supported in subsequent releases for
backward compatibility. For example, the SET AUXNAME command replaced the SET
CLONENAME command in Oracle8i, and the CONFIGURE AUXNAME command
replaced the SET AUXNAME command in Oracle9i, but you can continue to run both
SET CLONENAME and SET AUXNAME in all subsequent RMAN releases.
For example, you can use a release 9.0.1 RMAN client with:
■ A release 9.0.1 target database
■ A release 9.0.1 duplicate database
■ A release 8.1.7 recovery catalog database whose catalog tables were created
with RMAN release 9.0.1
2. Query the rcver catalog table. For example, run this query:
SQL> SELECT * FROM rcver;
VERSION
------------
08.01.05
09.00.01
If multiple versions are listed, then the last row is the current version, and the
rows before it are prior versions. In the preceding example, the current catalog
schema version is 09.00.01 and the previous version was 08.01.05.
Index-1
RECOVER, 2-199 deprecated commands
REGISTER, 2-211 Recovery Manager, A-1
RELEASE CHANNEL, 2-213, 2-215 DROP CATALOG command, 2-129
REPLACE SCRIPT, 2-216 DROP DATABASE command, 2-131
REPORT, 2-219 DUPLICATE command, 2-133
RESET DATABASE, 2-227
RESTORE, 2-230
RESYNC CATALOG, 2-245
E
RUN, 2-248 environment variables
SEND, 2-251 in RMAN strings, 1-4
SET, 2-253 EXECUTE SCRIPT command, 2-143
SHOW, 2-262 EXIT command, 2-145
SHUTDOWN, 2-265
SPOOL, 2-268 F
SQL, 2-270
STARTUP, 2-272 fileNameConversionSpec clause, 2-146
summary, 2-2, 3-2 FLASHBACK command, 2-149
SWITCH, 2-275
UNREGISTER DATABASE, 2-279 H
untilClause, 2-281
UPGRADE CATALOG, 2-284 HOST command, 2-158
VALIDATE, 2-286
compatibility K
recovery catalog, B-2
keywords
Recovery Manager, B-2
in syntax diagrams, 1-3
completedTimeSpec clause, 2-79
CONFIGURE command, 2-81
CONNECT command, 2-99 L
connectStringSpec clause, 2-102 LIST command, 2-163
control files listObjList clause, 2-184
automatic backups, 2-92
corrupt datafile blocks
maximum acceptable number, 2-258 M
corruption detection MAXCORRUPT parameter
using SET MAXCORRUPT command, 2-258 SET command, 2-258
CREATE CATALOG command, 2-111 MAXSETSIZE parameter
CREATE SCRIPT command, 2-113 BACKUP command, 2-43
CROSSCHECK command, 2-116
P
D
parameters
dates in syntax diagrams, 1-3
specifying in RMAN commands, 2-281 PL/SQL stored procedures
DELETE command, 2-121 executing within RMAN, 2-271
DELETE SCRIPT command, 2-125 PRINT SCRIPT command, 2-194
Index-2
Q @, 2-6
@@, 2-7
QUIT command, 2-196 ALLOCATE CHANNEL, 2-8, 2-15
quoted strings ALLOCATE CHANNEL FOR
environment variables, 1-4 MAINTENANCE, 2-12
ALTER DATABASE, 2-19
R archivelogRecordSpecifier clause, 2-22
BACKUP, 2-28
RC_ARCHIVED_LOG view, 2-23, 3-4
BLOCKRECOVER, 2-61
RC_BACKUP_CONTROLFILE view, 3-6
CATALOG, 2-66
RC_BACKUP_CORRUPTION view, 3-8
CHANGE, 2-70
RC_BACKUP_DATAFILE view, 3-10
completedTimeSpec, 2-79
RC_BACKUP_PIECE view, 3-15
CONFIGURE, 2-81
RC_BACKUP_REDOLOG view, 3-17
CONNECT, 2-99
RC_BACKUP_SET view, 3-19
connectStringSpec, 2-102
RC_BACKUP_SPFILE view, 3-21
CREATE CATALOG, 2-111
RC_CHECKPOINT view, 3-22
CREATE SCRIPT, 2-113
RC_CONTROLFILE_COPY view, 3-23
CROSSCHECK, 2-116
RC_COPY_CORRUPTION view, 3-25
DELETE, 2-121
RC_DATABASE recovery catalog view, 3-26
DELETE SCRIPT, 2-125
RC_DATABASE view, 2-257
DROP CATALOG, 2-129
RC_DATABASE_BLOCK_CORRUPTION
DROP DATABASE, 2-131
view, 3-27
DUPLICATE, 2-133
RC_DATABASE_INCARNATION view, 2-257,
EXECUTE SCRIPT, 2-143
3-28
EXIT, 2-145
RC_DATAFILE view, 3-29
fileNameConversionSpec, 2-146
RC_DATAFILE_COPY view, 3-31
FLASHBACK, 2-149
RC_LOG_HISTORY view, 3-33
HOST, 2-158
RC_OFFLINE_RANGE view, 3-34
LIST, 2-163
RC_PROXY_CONTROLFILE view, 3-37
listObjList, 2-184
RC_PROXY_DATAFILE view, 3-39
PRINT SCRIPT, 2-194
RC_REDO_LOG view, 3-41, 3-45
QUIT, 2-196
RC_REDO_THREAD view, 3-42
recordSpec, 2-197
RC_RESYNC view, 3-43
RECOVER, 2-199
RC_RMAN_CONFIGURATION view, 3-44
REGISTER, 2-211
RC_STORED_SCRIPT view, 3-47
RELEASE CHANNEL, 2-213
RC_STORED_SCRIPT_LINE view, 3-48
REPLACE SCRIPT, 2-216
RC_TABLESPACE view, 3-49
REPORT, 2-219
recordSpec clause, 2-197
RESET DATABASE, 2-227
RECOVER command, 2-199
RESTORE, 2-230
recovery catalog
RESYNC, 2-245
views, 3-1
RUN, 2-248
Recovery Manager
SEND, 2-251
backups
SET, 2-253
control file autobackups, 2-92
SHOW, 2-262
commands
Index-3
SHUTDOWN, 2-265 U
SPOOL, 2-268
SQL, 2-270 UNREGISTER DATABASE command, 2-279
STARTUP, 2-272 untilClause, 2-281
SWITCH, 2-275 UPGRADE CATALOG command, 2-284
UNREGISTER DATABASE, 2-279
untilClause, 2-281 V
UPGRADE CATALOG, 2-284
V$ARCHIVED_LOG view, 2-23, 2-25, 2-26, 2-179
VALIDATE, 2-286
V$BACKUP_CORRUPTION view, 2-40
compatibility, B-2
V$BACKUP_DEVICE view, 2-10, 2-13
dates in commands, 2-281
V$BACKUP_PIECE view, 2-169, 2-171, 2-174
symbolic links for filenames, 2-235
V$BACKUP_SET view, 2-168, 2-173, 2-174, 2-175,
syntax conventions, 1-2
2-176
REGISTER command, 2-211
V$DATABASE view, 2-257
RELEASE CHANNEL command (RMAN), 2-213
V$DATABASE_BLOCK_CORRUPTION
releasing a maintenance channel, 2-215
view, 2-62, 2-63, 2-65, 2-207, 2-237, 2-287
REPLACE SCRIPT command, 2-216
V$DATAFILE view, 2-119
REPORT command, 2-219
V$DATAFILE_COPY view, 2-119, 2-177, 2-178
RESET DATABASE command, 2-227
V$DATAFILE_HEADER view, 2-119
RESTORE command, 2-230
V$PROXY_DATAFILE view, 2-172
RESYNC CATALOG command, 2-245
V$SESSION view, 2-256, 2-259
RUN command, 2-248
VALIDATE command, 2-286
views
S recovery catalog, 3-1
SEND command, 2-251
SET command, 2-253
shared server
allocating channels, 2-9, 2-13
SHOW command, 2-262
SHUTDOWN command, 2-265
SPOOL command, 2-268
SQL command, 2-270
STARTUP command, 2-272
stored procedures
executing within RMAN, 2-271
SWITCH command, 2-275
symbolic links
and RMAN, 2-235
syntax conventions
Recovery Manager, 1-2
syntax diagrams
explanation of, 1-2
keywords, 1-3
parameters, 1-3
Index-4