Skip Headers

Oracle9i Recovery Manager Reference
Release 2 (9.2)

Part Number A96565-01
Go To Documentation Library
Home
Go To Product List
Book List
Go To Table Of Contents
Contents
Go To Index
Index

Master Index

Feedback

Go to previous page Go to beginning of chapter Go to next page

RMAN Commands , 56 of 59


SWITCH

Syntax

Text description of switch.gif follows
Text description of the illustration switch.gif


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

Restrictions and Usage Notes

Keywords and Parameters

Syntax Element Description

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 '/oracle/dbs/tbs_1.f' TO DATAFILECOPY 
'/oracle/dbs/copies/cp1.f';

If you do not specify a TO option, then RMAN uses the filename specified on a prior SET NEWNAME command for this file number as the switch target.

TO DATAFILECOPY {'filename' | TAG = 'tag_name'}

Specifies the input copy file for the switch, that is, the datafile copy that you wish to rename. Specify the file by filename or tag. For example, the following command sets df2.copy as the filename for datafile 2:

SWITCH DATAFILE 2 TO DATAFILECOPY '/oracle/dbs/df2.copy';

Note that if you specify a tag and more than one copy uses this tag name, then RMAN uses the most current copy, that is, the one needing the least recovery.

The following command switches datafile 3 to the most recently created Monday evening copy:

SWITCH DATAFILE 3 TO DATAFILECOPY TAG mondayPMcopy; 

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

Switching Datafile Filenames After a Restore: Example

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

RUN
{  
  ALLOCATE CHANNEL dev1 DEVICE TYPE DISK RATE 1000;  
  ALLOCATE CHANNEL dev2 DEVICE TYPE sbt;  
  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";  
}

Go to previous page Go to beginning of chapter Go to next page
Oracle
Copyright © 1996, 2002 Oracle Corporation.

All Rights Reserved.
Go To Documentation Library
Home
Go To Product List
Book List
Go To Table Of Contents
Contents
Go To Index
Index

Master Index

Feedback