• Aucun résultat trouvé

Purpose

Use the PRINT SCRIPT command to print a local or global stored script to standard output or to a file.

Prerequisites

Execute PRINT SCRIPT only at the RMAN prompt. RMAN must be connected to a target database and a recovery catalog. The recovery catalog database must be open.

If the specified script is a local script, then RMAN must be connected to the target database that it was connected to when you created or replaced the script.

Usage Notes

If GLOBAL is not specified, then RMAN looks for a local or global script script_name to print. If a local script is found, then it is printed. If no local script is found, but a global script script_name is found, then the global script is printed.

Syntax

printScript::=

Semantics

Examples

Example 2–92 Printing a Script to a File

This example prints a script to the file /tmp/global_backup_db.rman:

RMAN> PRINT GLOBAL SCRIPT global_backup_db TO FILE "/tmp/global_backup_db.rman";

Example 2–93 Printing a Script to the Screen

This example prints a stored script to standard output (and includes sample output):

RMAN> PRINT SCRIPT backup_whole;

printing stored script: backup_whole Syntax Element Description

GLOBAL Identifies the script as global.

If GLOBAL is specified, then a global script with the specified name must already exist in the recovery catalog. Otherwise, RMAN returns error RMAN-06004.

See Also: "Usage Notes" on page 2-104 for an explanation of the difference between global and local scripts

script_name Specifies the name of the script to print. Quotes must be used around the script name when the name contains either spaces or reserved words.

TO FILE 'filename' Sends output to the specified file instead of standard output.

PRINT

GLOBAL

SCRIPT

script_name

’ TO FILE ’ filename ’

;

{

BACKUP

INCREMENTAL LEVEL 0 TAG backup_whole FORMAT "/disk2/backup/%U"

DATABASE PLUS ARCHIVELOG;

}

QUIT

Purpose

Use the QUIT command to shut down the Recovery Manager utility. This command is functionally equivalent to the EXIT command.

Prerequisites

Execute only at the RMAN prompt.

Syntax

quit::=

Example

Example 2–94 Quitting RMAN

This example terminates RMAN (sample output included):

RMAN> QUIT

Recovery Manager complete.

QUIT

RECOVER

Purpose

Use the RECOVER command to perform one of the following distinct tasks:

Perform complete recovery of the whole database or one or more restored datafiles

Perform point-in-time recovery of a database (DBPITR) or tablespace (TSPITR)

Apply incremental backups to a datafile image copy (not a restored datafile) to roll it forward in time

Recover a corrupt data block or set of data blocks within a datafile

Prerequisites

All redo or incremental changes required for the recovery must exist on disk or in SBT.

If RMAN needs to restore incremental backups or archived redo logs during recovery, then you must either have automatic channels configured or manually allocate channels of the same type that created these backups.

If you perform media recovery on an encrypted tablespace, then the Oracle wallet must be open when performing media recovery of this tablespace. See Oracle Database Administrator's Guide to learn about encrypted tablespaces.

The following prerequisites apply to RECOVER BLOCK:

The target database must run in ARCHIVELOG mode and be open or mounted with a current control file.

The target database must not be a standby database.

You can only recover blocks marked media corrupt. The V$DATABASE_BLOCK_

CORRUPTION view indicates which blocks in a file were marked corrupt since the most recent BACKUP or BACKUP ... VALIDATE command was run against the file.

The backups of the datafiles containing the corrupt blocks must be full backups and not proxy backups. If only proxy backups exist, then you can restore them to a nondefault location on disk, in which case RMAN considers them datafile copies.

You can then use the datafile copies for block media recovery.

RMAN can use only archived redo logs for recovery. Block media recovery cannot survive a missing or inaccessible log, although it can sometimes survive missing or inaccessible records (see Oracle Database Backup and Recovery User's Guide).

For RMAN to be able to search the flashback logs for good copies of corrupt blocks, Flashback Database must be enabled on the target database.

Usage Notes

By default, RMAN performs complete recovery. For point-in-time recovery, the best practice is to enter a SETUNTIL command before both the RESTORE and RECOVER commands in a RUN command so that the UNTIL time applies to both commands. If you run SET UNTIL after restoring the database, then you may not be able to recover the database to the target time because the restored files may have timestamps later

See Also: Oracle Database Backup and Recovery User's Guide to learn how to recover datafiles

option after incomplete recovery or recovery with a backup control file.

Incremental Backups and Archived Redo Log Files

With the exception of RECOVER BLOCK, RMAN can use both incremental backups and archived redo logs for recovery. RMAN uses the following search order:

1. Incremental backup sets on disk or tape 2. Archived redo logs on disk

3. Archived redo log backups on disk 4. Archived redo log backup sets on tape

When RMAN chooses a destination to restore archived redo logs, it uses the following order of precedence:

1. SET ARCHIVELOG DESTINATION

2. The LOG_ARCHIVE_DEST_n parameter whose value is set to LOCATION=USE_

DB_RECOVERY_FILE_DEST 3. LOG_ARCHIVE_DEST_1

RMAN can apply incremental backups to datafiles that were not restored from an incremental backup. If overlapping levels of incremental backup exist, then RMAN automatically chooses the level covering the longest period of time.

Recovery Through RESETLOGS

You must RESTORE datafiles before you can recover them. RMAN can recover through RESETLOGS operations transparently if the datafiles to be recovered are from a parent incarnation. If required, the RECOVER command can also restore and apply archived logs and incremental backups from previous database incarnations, even if those logs were generated in previous releases of Oracle Database.

When recovering through an OPEN RESETLOGS, ensure that you have all logs needed for recovery. In a previous database incarnation, you must have the logs from the time of the backup until the SCN that is 1 less than the RESETLOGS SCN. The incarnation table must have a complete history of RESETLOGS operations from the creation time of the database backup. If the complete metadata is not found in V$DATABASE_

INCARNATION, then you can re-create this metadata by using CATALOG for the archived redo logs from the missing incarnations.

Syntax

recover::=

(deviceSpecifier::= on page 3-15, recoverObject::= on page 2-185, recoverOptionList::= on page 2-186)

See Also: RESTORE on page 2-218 command for explanation of the default location for restoring archived redo logs. Note that RMAN automatically specifies the MAXSIZE option when staging logs in the flash recovery area.

RECOVER

DEVICE TYPE deviceSpecifier ,

recoverSpec ;