Oracle8i Recovery Manager User's Guide and Reference
Release 2 (8.1.6)

A76990-01

Library

Product

Contents

Index

Prev Up Next

Recovery Manager Command Syntax, 47 of 50


switch

Syntax


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 ALTER DATABASE RENAME DATAFILE statement: Oracle renames the files in the control file but does not actually rename them on your operating system. Note that this command updates the records for the datafile copy in the recovery catalog and the control file to status AVAILABLE.

Requirements

Keywords and Parameters

datafile datafileSpec 

specifies the datafile that you wish to rename. After the switch, the control file no longer views the specified file as current. For example, this command points the control file from tbs_1.f to cp1.f:

switch datafile '$/dbs/tbs_1.f' to datafilecopy '$/dbs/copies/cp1.f';

If you do not specify a to option, then RMAN uses the filename specified on a prior set newname command (see "set_run_option") for this file number as the switch target.  

 

to datafilecopy 

specifies the input copy file for the switch, that is, the datafile copy that you wish to rename. For example, if you issue:

switch datafile 2 to datafilecopy '/oracle/dbs/df2.copy';

The control file will list df2.copy as the filename for datafile 2.

You can also specify the datafile copy by tag. If the tag is ambiguous, then the most current copy is used, that is, the one that requires the least media recovery.

When the tag is not unique, then RMAN understands the tag to refer to the most recently created copy. Thus, the command:

switch datafile 3 to datafilecopy tag mondayPMcopy; 

switches datafile 3 to the most recently created Monday evening copy. 

datafile all 

specifies that all datafiles for which a set newname for datafile command (see "set_run_option") has been issued in this job are switched to their new name. 

Examples

Switching After a Restore

This example allocates one disk device and one tape device to allow RMAN to restore both from disk and tape.

run {  
     allocate channel dev1 type disk;  
     allocate channel dev2 type 'sbt_tape';  
     sql "ALTER TABLESPACE tbs_1 OFFLINE IMMEDIATE";  
     set newname for datafile 'disk7/oracle/tbs11.f' 
       to 'disk9/oracle/tbs11.f';  
     restore tablespace tbs_1; 
     switch datafile all;  
     recover tablespace tbs_1;  
     sql "ALTER TABLESPACE tbs_1 ONLINE";  
}  

Related Topics

"printScript"

"restore"

"run"

"set"


Prev Up Next
Oracle
Copyright © 1999 Oracle Corporation.

All Rights Reserved.

Library

Product

Contents

Index