November 2001
Intermediate to advanced
126 pages
3h
English
SWITCH
This command is analogous to the SQL ALTER DATABASE RENAME file command. It specifies that a datafile copy is now the current datafile and must be run from within the RUN command.
SWITCH
{ DATAFILE datafileSpec
[ TO DATAFILECOPY { 'filename' | TAG [=] [']tag_name['] }]
| DATAFILE ALL
};The following example copies the datafile for the USERS tablespace to a different location. After doing so, the SWITCH command modifies the control file to make the datafile copy the current datafile.
RMAN>sql"alter database datafile ''/d02/oradata/brdstn/users_01.dbf'' offline";RMAN> sql statement: alter database datafile 2> ''/d02/oradata/brdstn/users_01.dbf'' offline RMAN>run {2>copy datafile '/d02/oradata/brdstn/users_01.dbf'3>to '/d03/oradata/brdstn/users_01.dbf';4>switch datafile '/d02/oradata/brdstn/users_01.dbf'5>to datafilecopy '/d03/oradata/brdstn/users_01.dbf';6>}Starting copy at 10-JUL-01 allocated channel: ORA_DISK_1 channel ORA_DISK_1: copied datafile 6 output filename=/d03/oradata/brdstn/users_01.dbf recid=4 stamp=434740922 Finished copy at 10-JUL-01 datafile 6 switched to datafile copy input datafilecopy recid=4 stamp=434740922 filename=/d03/ oradata/brdstn/users_01.dbf RMAN>recover datafile '/d03/oradata/brdstn/users_01.dbf';Starting recover at 10-JUL-01 using channel ORA_DISK_1 starting media recovery media recovery complete Finished recover at 10-JUL-01 RMAN>sql "alter database datafile''/d03/oradata/brdstn/foo_01.dbf'' online"; ...
Read now
Unlock full access