Call now: 252-767-6166  
Oracle Training Oracle Support Development Oracle Apps

 
 Home
 E-mail Us
 Oracle Articles
New Oracle Articles


 Oracle Training
 Oracle Tips

 Oracle Forum
 Class Catalog


 Remote DBA
 Oracle Tuning
 Emergency 911
 RAC Support
 Apps Support
 Analysis
 Design
 Implementation
 Oracle Support


 SQL Tuning
 Security

 Oracle UNIX
 Oracle Linux
 Monitoring
 Remote s
upport
 Remote plans
 Remote
services
 Application Server

 Applications
 Oracle Forms
 Oracle Portal
 App Upgrades
 SQL Server
 Oracle Concepts
 Software Support

 Remote S
upport  
 Development  

 Implementation


 Consulting Staff
 Consulting Prices
 Help Wanted!

 


 Oracle Posters
 Oracle Books

 Oracle Scripts
 Ion
 Excel-DB  

Don Burleson Blog 


 

 

 


 

 

 
 

RMAN COPY Command Tips

Oracle Database Tips by Donald BurlesonJune 4, 2015

Question:  What is the proper syntax for the RMAN COPY command?

Answer:  As of Oracle 10g the RMAN COPY command has been deprecated. 

The current preferred syntax is to use the BACKUP as COPY command.  The reasoning behind this change was that when you create a backup with the COPY command you had to use RMAN to extract individual datafiles from a given backup set. 

The BACKUP AS COPY command creates image copies and removes the need to extract them from a backup set.  This BACKUP AS COPY command allows you to copy a database, tablespaces, datafiles, archived redo logs as well as control files.

One great use of the BACKUP AS COPY command is in the creation of an image of the controlfile.  The following command can be used:

 RMAN> backup as copy current controlfile format 'c:\bkp_controlfile.ctl';  

This creates the following: c:\bkp_controlfile.ctl

This is actually a binary copy of the current controlfile.  In the event all controlfiles are lost, this file can be used directly without RMAN restoration.

The following example from the Rampant TechPress book Oracle Backup and Recovery by Kamran Agayev shows the creation of the image copy of the controlfile and how the database can be recovered from the loss of all controlfiles using this image file:

C:\>rman target \
RMAN> backup as copy current controlfile format 'c:\control.ctl';  


#We take image copy of current control file
<....... output omitted .......>

output filename=C:\control.ctl tag=tag20090819t134500 recid=1 stamp=695310300
RMAN> exit

Recovery Manager complete.  

C:\>sqlplus "/ as sysdba"
SQL>
shutdown immediate
SQL>
host  
C:\>cd c:\oracle\product\10.2.0\oradata\test


#Below, after shutting down the database, we delete all control files and copy newly created image copy of control file to original destination

C:\oracle\product\10.2.0\oradata\test>del *.ctl
C:\>copy control.ctl
c:\oracle\product\10.2.0\oradata\test

1 file(s) copied.

C:\>exit  
SQL> startup nomount
SQL> alter system set control_files='c:\oracle\product\10.2.0\oradata\test\control.ctl' scope=spfile;  

System altered.


#Above, in startup nomount mode, we change control_files parameter in spfile and indicate newly create image copy of control file. Then shutdown the database and bring it to mount mode.  

SQL> shutdown immediate
SQL> startup mount
SQL>
alter
database open;
alter database open
*  

Error at line 1: ORA-01589: must use resetlogs or noresetlogs option for database open

#Now, we do not need to open database in resetlogs mode, or we lose data in redo log files. So we connect to RMAN and recover the database. RMAN automatically finds proper redo log file and apply all changes to datafiles

SQL>
exit
C:\>rman target /  

RMAN> recover database;  

<....... output omitted .......>

archive log thread 1 sequence 2 is already on disk as file C:\oracle\product\10.2.0\oradata\test\redo01.log
archive log
filename=C:\oracle\product\10.2.0\oradata\test\redo01.log thread=1
sequence=2

media recovery complete, elapsed time: 00:00:01
 
Finished recover at 19-AUG-09  

#Now, we can easily open the database using resetlogs option  

RMAN> alter database open resetlogs;  

database opened
RMAN>  

 An RMAN backup set can be made from the control file created above.  To do that, use the backup controlfilecopy command as shown below:  

RMAN> backup as copy current controlfile format 'c:\control.ctl';
RMAN> backup controlfilecopy 'c:\control.ctl';  

channel ora_disk_1: starting full datafile backupset
input control file copy name=C:\control.ctl
RMAN>

The syntax of the BACKUP AS COPY command looks like the following for tablespace users, datafile, spfile and archivelogs:

RMAN> backup as copy tablespace users format 'c:\users01.dbf';
RMAN> backup as copy datafile 4 format 'c:\datafile4.dbf';
RMAN> backup as copy spfile format 'c:\image_copy_spfile.ora';
RMAN> backup as copy archivelog all format 'c:\arch_%U.arc';

 

 
 
 
Get the Complete
Oracle Backup & Recovery Details 

The landmark book "Oracle Backup & Recovery: Expert secrets for using RMAN and Data Pump " provides real world advice for resolving the most difficult Oracle performance and recovery issues. Buy it for 40% off directly from the publisher.
 

 


 

 

Burleson is the American Team

Note: This Oracle documentation was created as a support and Oracle training reference for use by our DBA performance tuning consulting professionals.  Feel free to ask questions on our Oracle forum.

Verify experience! Anyone considering using the services of an Oracle support expert should independently investigate their credentials and experience, and not rely on advertisements and self-proclaimed expertise. All legitimate Oracle experts publish their Oracle qualifications.

Errata?  Oracle technology is changing and we strive to update our BC Oracle support information.  If you find an error or have a suggestion for improving our content, we would appreciate your feedback.  Just  e-mail:  

and include the URL for the page.


                    









Burleson Consulting

The Oracle of Database Support

Oracle Performance Tuning

Remote DBA Services


 

Copyright © 1996 -  2020

All rights reserved by Burleson

Oracle ® is the registered trademark of Oracle Corporation.

 

 

��  
 
 
Oracle Training at Sea
 
 
 
 
oracle dba poster
 

 
Follow us on Twitter 
 
Oracle performance tuning software 
 
Oracle Linux poster