Oracle8i Backup and Recovery Guide Release 8.1.5 A67773-01 |
|
To specify that a datafile copy is now the current datafile, i.e., 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 switching deletes the records for the datafile copy in the recovery catalog and the control file.
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 switch datafile '$/dbs/tbs_1.f' to datafile copy '$/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, i.e., 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 You can also specify the datafile copy by tag. If the tag is ambiguous, then the most current copy is used, i.e., 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 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. |
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"; }