Skip to Content
Oracle RMAN Pocket Reference
book

Oracle RMAN Pocket Reference

by Darl Kuhn, Scott Schulze
November 2001
Intermediate to advanced
126 pages
3h
English
O'Reilly Media, Inc.
Content preview from Oracle RMAN Pocket Reference

Name

SWITCH

Synopsis

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.

Syntax

SWITCH 
{ DATAFILE datafileSpec 
  [ TO DATAFILECOPY { 'filename' | TAG [=] [']tag_name['] }] 
| DATAFILE ALL
};

Example

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"; ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

Oracle Utilities Pocket Reference

Oracle Utilities Pocket Reference

Sanjay Mishra
Oracle Built-in Packages

Oracle Built-in Packages

Steven Feuerstein, Charles Dye, John Beresniewicz
Oracle RMAN 11g Backup and Recovery

Oracle RMAN 11g Backup and Recovery

Robert Freeman, Matthew Hart

Publisher Resources

ISBN: 0596002335Errata Page