RMAN

RMAN: Basic RMAN Commands

Oracle Recovery Manager (RMAN) satisfies the most pressing demands of performance, manageable backup and recovery, for all Oracle data formats.
RMAN  provides a common interface, via command line and Enterprise Manager, for backup tasks across different host operating systems.
Below are some of the commonly used RMAN commands which you can run through RMAN command line.
All the commands were tested on Oracle database version 11gR2 (11.2.0.4)
 **SHOW COMMAND**
1) Shows all parameters.  RMAN> show all;   

2) Shows the archivelog deletion policy.  
RMAN> show archivelog deletion policy;    

3) Shows the number of archivelog backup copies 
RMAN> show archivelog backup copies;    

4) Shows the auxiliary database information.  
RMAN> show auxname;    

5) Shows whether optimization is on or off.  
RMAN> show backup optimization;  

6) Shows how the normal channel and auxiliary channel are configured.  
RMAN> show [auxiliary] channel;     

7) Shows the characteristics of the channel  
RMAN> show channel for device type [disk | <media device>;    

8) Shows whether control file autobackup is on or off. 
RMAN> show controlfile autobackup;    

9) Shows the format of the autobackup control file  
RMAN> show controlfile autobackup format;    

10) Shows the number of datafile backup copies being kept.  
RMAN> show datafile backup copies;    

11) Shows the default type (disk or tape)  
RMAN> show default device type;    

12) Shows policy for datafile and control file backups and copies that RMAN marks as obsolete.  
RMAN> show retention policy;    

13) Shows the encryption algorithm currently in use.  
RMAN> show encryption algorithm;    

14) Shows the encryption for the database and every tablespace.  
RMAN> show encryption for [database | tablespace]; 

15) Shows the tablespaces excluded from the backup.  
RMAN> show exclude;    

16) Shows the maximum size for backup sets. The default is unlimited.  
RMAN> show maxsetsize;    

17) Shows the policy for datafile and control file backups and copies that RMAN marks as obsolete.  
RMAN> show retention policy;    

18) Shows the snapshot control filename.  RMAN> show snapshot controlfile name;    

19) Shows the compression algorithm in force. The default is the ZLIB algorithm.  
RMAN> show compression algorithm;

**BACKUP COMMAND**

 

1) To perform a manual backup of the current control file
 RMAN> backup current controlfile;


2) To back up the control file as part of a tablespace backup operation
 RMAN> backup tablespace users include current controlfile;

 
3) To back up the server parameter file
 RMAN> backup spfile;

 
4) To restart an RMAN backup that failed midway through a nightly backup.
 RMAN> backup not backed up since time ‘sysdate-1′ database plus archivelog;

5) To force RMAN to back up a file regardless of whether it’s identical to a previously backed up file by specifying the force option
 RMAN> backup database force;

By using the force option, you make RMAN back up all the specified files, even if the backup optimization feature is turned on.
  
6) To backup complete database
 RMAN> backup database;

  
7) To backup database plus archivelogs
 RMAN> backup database plus archivelogs;


8) To backup all archive logs
RMAN> backup archivelog all;
9) To backup specific data file
RMAN> backup datafile 5 tag dbfile_5_bkp;
A tag was also added to easily locate this datafile’s backup.
 **CATALOG COMMAND**
1) Add user-managed copies of datafile to RMAN repository
 RMAN> catalog datafilecopy ‘/u01/oracle/users.bkp’;
 RMAN> catalog datafilecopy ‘/u01/oracle/users.bkp’ level 0;  (To catalog as incremental level 0 backup)


2) Add uncataloged backup piece to RMAN repository
 RMAN> catalog backuppiece ‘ertt2lu4_1_1′;
 
3) To catalog multiple files ( say you copied production backup to target database for database cloning)
 RMAN> catalog start with ‘/backups/source_bkp’ noprompt;

The start with clause specifies that RMAN catalog all valid backup sets, datafile copies, and archived redo logs starting with the string pattern you pass.

 4) To catalog all files in the flash recovery area
 RMAN> catalog recovery area;

**REPORT COMMAND**

 1) To find out which backups you need to make in order to conform to the retention policy you put in place

 RMAN> report need backup;
The output of the report need backup command tells you that you must back up which all database files to comply with your retention policy.
 
2) To get a report about all the datafiles in a database

RMAN> report schema;
RMAN> report schema at time ‘sysdate-1′;  (from a past point in time)

3) To reports on any obsolete backups

RMAN> crosscheck backup;
RMAN> report obsolete;
Always run the crosscheck command first in order to update the status of the backups in the RMAN repository to that on disk and tape.

**LIST COMMAND**

 1) To review RMAN backups of datafiles, archived redo logs, and control files.
 RMAN> list backup;

 
2) List the backups by just the backup files
 RMAN> list backup by file;
3) Lists only backup sets and proxy copies but not image copies
 RMAN> list backupset; 


4) Lists only datafile, archived redo log, and control file copies
 RMAN> list copy;
5) Lists backups by tag:
 RMAN> list backupset tag ‘full_database_backup’;

6) To list the backups of all datafiles and archivelogs of the target database:
RMAN> list backup of database;


7) Lists all incarnations of a database
 RMAN> list incarnation;
When you perform an open resetlogs operation, it results in the creation of a new incarnation of the database. 
When performing recovery operations on such a database, you might want to check the database incarnation
8) Lists all restore points in the target database
 RMAN> list restore point;
9) Lists the names of all recovery catalog scripts
RMAN> list script names;
10) Which of the backups of the target database have an expired status in the repository.
 RMAN> list expired backup;
 
11) Which of the archived redo log backups have the expired status
 RMAN> list expired archivelog all;
 
12) To restrict the list of backups  and copies whose status is listed as available
 RMAN> list recoverable backup;

13) To view all the restore points in the database
RMAN> list restore point all;

**CROSSCHECK COMMAND**

1) Cross-checking just backup sets
RMAN> crosscheck backupset;
 
2) Cross-checking a copy of a database
RMAN> crosscheck copy of database;

 
3) Cross-checking specific backupsets
RMAN> crosscheck backupset 10, 12;
 

4) Cross-checking using a backup tag
RMAN> crosscheck backuppiece tag = ‘monthly_backup’;
 
5) Cross-checking a control file copy;
RMAN> crosscheck controlfilecopy ‘/backups/control01.ctl’; 

6) Cross-checking backups completed after a specific time
RMAN> crosscheck backup of datafile “/u01/oracle//system01.dbf” completed after ‘sysdate-7′;

7)  Cross-checking of all archivelogs and the spfile
RMAN> crosscheck backup of archivelog all spfile; 

8) Cross-checking all backups on disk and tape
RMAN> crosscheck backup;
The crosscheck command checks whether the backups still exist. The command checks backup sets, proxy copies, and image copies.

**DELETE COMMAND**

1) To remove both archived redo logs and RMAN backups
RMAN> delete backup;
RMAN always prompts you for confirmation before going ahead and deleting the backup files. You can issue the delete noprompt command to suppress the confirmation prompt. This will also remove the physical file from the backup media

 To make sure the repository and the physical media are synchronized, run “RMAN> crosscheck backup;” before running above command
2) To remove all image copies
RMAN> delete copy;

To make sure the repository and the physical media are synchronized, run “RMAN> crosscheck copy;” before running above command
3) To delete specfic backuppiece
RMAN> delete backuppiece 9; 


4) To delete copy of controlfile under /backups
RMAN> delete copy of controlfile like ‘/backups/%’;

 
5) To delete backups with specific tag
RMAN> delete backup tag=’double_bkp_prod’;

6) To delete bakups of specific tablespace
RMAN> delete backup of tablespace sysaux device type sbt;
******************

You can also use force, expired, obsolete keyword with delete commad:

delete force ..: Deletes the specified files whether they actually exist on media or not and removes their records from the RMAN repository as well

delete expired ..: Deletes only those files marked as expired  as per crosscheck command.

delete obsolete ..: Deletes datafile backups and copies and the archived redo logs and log backups that are recorded as obsolete in the RMAN repository

The delete obsolete command relies only on the backup retention policy in force.

******************
7) To delete all archived redo logs

 RMAN> delete archivelog all;

8) To delete already backed up archived redo logs
 RMAN> delete archivelog all backed up 2 times to sbt;

 9) To delete specific archived redo logs
 RMAN> delete archivelog until sequence = 1234;
10) Delete archive logs after taking backup
 RMAN> backup device type sbt archivelog all delete all input;
11) Delete stored script
 RMAN> delete script full_disk_db;

If you have two scripts—one local and one global—in the same name, then the delete script command drops the local one, not the global one. If you want to drop the global script, you must use the keyword global in the command, as shown here:

 RMAN> delete global script full_disk_db;

**CHANGE COMMAND**

1) Change the status of a backup set to unavailable
 RMAN> change backupset 6 unavailable;

You usually do it when you don’t want to delete the backup/copy but you also don’t want to delete that backup/copy (probably it is not available physically on disk)
Once you mark a backup file unavailable, RMAN won’t use that file in a restore or recover operation.

2)  Change the status of a backup set to available again
 RMAN> change backupset 6 available;

For example, say you performed a backup using an NFS-mounted disk and that disk subsequently becomes inaccessible for some reasons, just  issue the change command to set the status of the backup as unavailable. Later, once the disk becomes accessible again, you can change its status back to available.

3) To modify a regular consistent database backup into an archival backup:
 RMAN> change backup tag ‘initial_db_bkup’ keep forever;

When you make an archival backup with the keep … forever option, RMAN disregards the backup retention time for these backups.
 
4) To change the archival backup to a normal database backup
 RMAN> change backup tag ‘inital_db_backup’ nokeep;

When you run the change … nokeep command, the backup set with the tag inital_db_backup, which was previously designated as a long term archival backup, will once again come under the purview of your configured retention policy.

5) To modify the time period for which you want to retain the archival backups
 RMAN> change backupset 12 keep until time ‘sysdate+60′;
After the 60 days are up, the backup will become obsolete and is eligible for deletion by the delete obsolete command.

**VALIDATE COMMAND**

1) To check all the datafiles and the archived redo logs for physical corruption  without actually performing the backup
RMAN> backup validate database archivelog all;

2) To check for logical corruption  without actually performing the backup
RMAN> backup validate check logical database archivelog all;
The check logical clause means that RMAN will check for logical corruption only.
3) To validate a single backup set
RMAN> validate backupset 5;

4) To validate all datafiles at once
 RMAN> validate database;
Note that the validate command can check at a much more granular level than the backup … validate command. You can use the validate command with individual datafiles, backup sets, and even data blocks.

he validate command always skips all the data blocks that were never used, in each of the datafile it validates.

5)  To validate recovery area
 RMAN> validate recovery area;

6) To validate all the recovery related files
 RMAN> validate recovery files;

7) To validate the spfile
 RMAN> validate spfile;

8) To validate specific tablespace
 RMAN> validate tablespace <tablespace_name>;

9) To validate specific control file copy
 RMAN> validate controlfilecopy <filename>;

10) To validate specific backupset
 RMAN> validate backupset <primary_key>;

=====================================================================

REPORT OBSOLETE REDUNDANCY 1; RMAN> CONFIGURE DEFAULT DEVICE TYPE clear; list backup summary; RMAN>DELETE OBSOLETE; RMAN>DELETE NOPROMPT OBSOLETE; RMAN>DELETE EXPIRED BACKUP; RMAN>CROSSCHECK BACKUP; RMAN Delete Command The RMAN DELETE command deletes backups from disk and/or from the catalog To delete all backups for the target database use: RMAN> DELETE BACKUP; Delete Backupset To delete a backup set specify the set number e.g. 23: RMAN> DELETE BACKUPSET 23; NOPROMPT keyword By default the DELETE command will prompt for confirmation before deleting any backup files Do you really want to delete the above objects (enter YES or NO)? To suppress the prompt specify the NOPROMPT keyword. For example: RMAN> DELETE NOPROMPT BACKUP; Image Copies To delete all datafile copies: RMAN> DELETE DATAFILECOPY ALL; To delete an individual datafile copy use: RMAN> DELETE DATAFILECOPY <key>; For example: RMAN> DELETE DATAFILECOPY 26; Alternatively specify the datafile image copy name. For example: RMAN> DELETE DATAFILECOPY '/u01/app/oracle/copy/users01.dbf'; To delete a specific controlfile copy use: RMAN> DELETE CONTROLFILECOPY <key>; For example: RMAN> DELETE CONTROLFILECOPY 20; Alternatively specify the control file copy name e.g.: RMAN> DELETE CONTROLFILECOPY '/u01/app/oracle/copy/cf_D-TEST_id-2066695660_1tqek8bd'; To delete all backups of the USERS tablespace use: RMAN> DELETE BACKUP OF TABLESPACE USERS; Expired Backups To delete any expired backups detected by the CROSSCHECK command use: RMAN> DELETE EXPIRED BACKUP;



 RESTORE DATABASE IN NEW HOST MACHINE
 ====================================


[oracle@pcguy ~]$ rman target /

Recovery Manager: Release 11.2.0.3.0 - Production on Fri MAY 6 09:28:13 2017

Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.

connected to target database (not started)


RMAN> startup nomount;

startup failed: ORA-01078: failure in processing system parameters
LRM-00109: could not open parameter file '/opt/oracle/product/11.2.0/dbhome_1/dbs/initsha.ora'

starting Oracle instance without parameter file for retrieval of spfile
Oracle instance started

Total System Global Area 158662656 bytes

Fixed Size 2226456 bytes
Variable Size 104859368 bytes
Database Buffers 46137344 bytes
Redo Buffers 5439488 bytes

RMAN> restore spfile from 'restore spfile from '/u01/tmp_bkup/o1_mf_ncsnf_TAG20170528T165953_dlof6cxs_.bkp';

Starting restore at 06-JAN-12
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=171 device type=DISK

channel ORA_DISK_1: restoring spfile from AUTOBACKUP /opt/flash_recovery_area/backup/SILVER/SP_SILVER_65n00dpa_1_1
channel ORA_DISK_1: SPFILE restore from AUTOBACKUP complete
Finished restore at 06-JAN-12


RMAN> shutdown immediate;

Oracle instance shut down

RMAN> startup nomount;

connected to target database (not started)
Oracle instance started

Total System Global Area 626327552 bytes

Fixed Size 2230952 bytes
Variable Size 478152024 bytes
Database Buffers 138412032 bytes
Redo Buffers 7532544 bytes
 

RMAN> startup nomount;

connected to target database (not started)
Oracle instance started

Total System Global Area 626327552 bytes

Fixed Size 2230952 bytes
Variable Size 478152024 bytes
Database Buffers 138412032 bytes
Redo Buffers 7532544 bytes


RMAN> set dbid 2121303953; or set ORACLE_SID=sha in command prompt

executing command: SET DBID

RMAN> restore controlfile from 'restore spfile from '/u01/tmp_bkup/o1_mf_ncsnf_TAG20170528T165953_dlof6cxs_.bkp';

Starting restore at 06-JAN-12
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=10 device type=DISK

channel ORA_DISK_1: restoring control file

channel ORA_DISK_1: restore complete, elapsed time: 00:00:01
output file name=/opt/oradata/SILVER/control01.ctl
output file name=/opt/flash_recovery_area/SILVER/control02.ctl
Finished restore at 06-JAN-12

 
RMAN> sql "alter database mount";

sql statement: alter database mount
released channel: ORA_DISK_1


RMAN>catalog start with ‘/backups/source_bkp’ noprompt;

RMAN> run {
2> allocate channel ch1 device type disk;
3> allocate channel ch2 device type disk;
4> restore database;
5> }

allocated channel: ch1
channel ch1: SID=11 device type=DISK

........

channel ch1: starting datafile backup set restore
channel ch1: specifying datafile(s) to restore from backup set
channel ch1: restoring datafile 00001 to /opt/oradata/SILVER/system01.dbf
........
released channel: ch2

RMAN> sql "alter database open resetlogs";

sql statement: alter database open resetlogs



RMAN Cloning / Duplicate Database

Step by Step - Duplicating Oracle Database using RMAN Backup with connection to source database.

Source Server: 192.168.56.110
Clone Server: 192.168.56.111

As we are duplicating to a different we can use same SID for both Source and Clone. My source DBID is DG

Step1. Put your target database in Archive log mode.

Step2. Start RMAN at Source and Configure CONTROLFILE AUTOBACKUP ON
RMAN> CONFIGURE CONTROLFILE AUTOBACKUP ON;

Take Backup of Source Database
RMAN> BACKUP DATABASE PLUS ARCHIVELOG

Step3. Configure tnsnames and listener at source and clone server as below:

At Source Database Server
--------------------------------------------------------------------
DUP_CONNECT =
 (DESCRIPTION =
 (ADDRESS_LIST =
 (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.56.111)(PORT = 1522))
 )
 (CONNECT_DATA =
 (SERVICE_NAME = dg)
 )
 )
---------------------------------------------------------------------
At Clone Server
----------------------------------------------------------------------
SID_LIST_LISTENER =
 (SID_LIST =
 (SID_DESC =
 (GLOBAL_DBNAME = HCL)
 (ORACLE_HOME = /u01/app/oracle/product/11.2.0/dbhome_1)
 (SID_NAME = dg)
 )
 )

LISTENER =
 (DESCRIPTION =
 (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.56.111)(PORT = 1522))
 )
------------------------------------------------------------------------

Step4: create orapwd file at clone server's dbs directory
orapwd file=orapwDGL password=oracle entries=10

Step5. Create pfile of Source Database and copy pfile to Clone Server's dbs directory
SQL> create pfile from spfile;

Copy pfile to Clone Server
scp oracle@192.168.195.110:/u01/app/oracle/product/11.2.0/dbhome_1/dbs/initDG.ora /u01/app/oracle/product/11.2.0/dbhome_1/dbs/

Step6. Create required directories at Clone server. Here I'm using same filesystem as source so no need to use DB_FILE_NAME_CONVERT

mkdir -p /u01/app/oracle/oradata/DG
mkdir -p /u01/app/oracle/flash_recovery_area/DG
mkdir -p /u01/app/oracle/admin/DG
cd /u01/app/oracle/admin/DG
mkdir adump dpdump

Step7. Copy backupfile to Clone Server from Source Server
scp -r oracle@192.168.56.110:/u01/app/oracle/flash_recovery_area/HCL/ /u01/app/oracle/flash_recovery_area/

Step8. At Remote Server set ORACLE_SID=DG and start the Clone Server in NOMOUNT mode
SQL> STARTUP NOMOUNT;

Step9: start RMAN at source and connect RMAN to clone as well
At Source
RMAN TARGET /
connect auxiliary sys/oracle@DUP_CONNECT


RMAN> exit


Recovery Manager complete.
[oracle@dg admin]$ rman target /

Recovery Manager: Release 11.2.0.1.0 - Production on Sun Mar 11 00:35:40 2018

Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.

connected to target database: DG (DBID=1883217583)

RMAN> connect auxiliary sys/oracle@dup_connect

connected to auxiliary database: DG (not mounted)

RMAN> DUPLICATE TARGET DATABASE TO DG NOFILENAMECHECK;

Starting Duplicate Db at 11-MAR-18
using target database control file instead of recovery catalog
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: SID=21 device type=DISK

contents of Memory Script:
{
 sql clone "alter system set db_name = 
 ''DG'' comment=
 ''Modified by RMAN duplicate'' scope=spfile";
 sql clone "alter system set db_unique_name = 
 ''DG'' comment=
 ''Modified by RMAN duplicate'' scope=spfile";
 shutdown clone immediate;
 startup clone force nomount
 restore clone primary controlfile;
 alter clone database mount;
}
executing Memory Script

sql statement: alter system set db_name = ''DG'' comment= ''Modified by RMAN duplicate'' scope=spfile

sql statement: alter system set db_unique_name = ''DG'' comment= ''Modified by RMAN duplicate'' scope=spfile

Oracle instance shut down

Oracle instance started

Total System Global Area 2538741760 bytes

Fixed Size 2216024 bytes
Variable Size 1409290152 bytes
Database Buffers 1124073472 bytes
Redo Buffers 3162112 bytes

Starting restore at 11-MAR-18
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: SID=18 device type=DISK

channel ORA_AUX_DISK_1: starting datafile backup set restore
channel ORA_AUX_DISK_1: restoring control file
channel ORA_AUX_DISK_1: reading from backup piece /u01/app/oracle/flash_recovery_area/DG/autobackup/2018_03_11/o1_mf_s_970446459_fb8bo3jd_.bkp
channel ORA_AUX_DISK_1: ORA-19870: error while restoring backup piece /u01/app/oracle/flash_recovery_area/DG/autobackup/2018_03_11/o1_mf_s_970446459_fb8bo3jd_.bkp
ORA-19505: failed to identify file "/u01/app/oracle/flash_recovery_area/DG/autobackup/2018_03_11/o1_mf_s_970446459_fb8bo3jd_.bkp"
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3

failover to previous backup

channel ORA_AUX_DISK_1: starting datafile backup set restore
channel ORA_AUX_DISK_1: restoring control file
channel ORA_AUX_DISK_1: reading from backup piece /u01/app/oracle/flash_recovery_area/DG/backupset/2018_03_11/o1_mf_ncsnf_TAG20180311T001226_fb89t0mh_.bkp
channel ORA_AUX_DISK_1: piece handle=/u01/app/oracle/flash_recovery_area/DG/backupset/2018_03_11/o1_mf_ncsnf_TAG20180311T001226_fb89t0mh_.bkp tag=TAG20180311T001226
channel ORA_AUX_DISK_1: restored backup piece 1
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:01
output file name=/u01/app/oracle/dg/control01.ctl
output file name=/u01/app/oracle/flash_recovery_area/dg/control02.ctl
Finished restore at 11-MAR-18

database mounted

contents of Memory Script:
{
 set until scn 1629751;
 set newname for datafile 1 to 
 "/u01/app/oracle/dg/system01.dbf";
 set newname for datafile 2 to 
 "/u01/app/oracle/dg/sysaux01.dbf";
 set newname for datafile 3 to 
 "/u01/app/oracle/dg/undotbs01.dbf";
 set newname for datafile 4 to 
 "/u01/app/oracle/dg/users01.dbf";
 set newname for datafile 5 to 
 "/u01/app/oracle/dg/example01.dbf";
 restore
 clone database
 ;
}
executing Memory Script

executing command: SET until clause

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

Starting restore at 11-MAR-18
using channel ORA_AUX_DISK_1

channel ORA_AUX_DISK_1: starting datafile backup set restore
channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_AUX_DISK_1: restoring datafile 00001 to /u01/app/oracle/dg/system01.dbf
channel ORA_AUX_DISK_1: restoring datafile 00002 to /u01/app/oracle/dg/sysaux01.dbf
channel ORA_AUX_DISK_1: restoring datafile 00003 to /u01/app/oracle/dg/undotbs01.dbf
channel ORA_AUX_DISK_1: restoring datafile 00004 to /u01/app/oracle/dg/users01.dbf
channel ORA_AUX_DISK_1: restoring datafile 00005 to /u01/app/oracle/dg/example01.dbf
channel ORA_AUX_DISK_1: reading from backup piece /u01/app/oracle/flash_recovery_area/DG/backupset/2018_03_11/o1_mf_nnndf_TAG20180311T002642_fb8bmbs7_.bkp
channel ORA_AUX_DISK_1: piece handle=/u01/app/oracle/flash_recovery_area/DG/backupset/2018_03_11/o1_mf_nnndf_TAG20180311T002642_fb8bmbs7_.bkp tag=TAG20180311T002642
channel ORA_AUX_DISK_1: restored backup piece 1
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:45
Finished restore at 11-MAR-18

contents of Memory Script:
{
 switch clone datafile all;
}
executing Memory Script

datafile 1 switched to datafile copy
input datafile copy RECID=4 STAMP=970447023 file name=/u01/app/oracle/dg/system01.dbf
datafile 2 switched to datafile copy
input datafile copy RECID=5 STAMP=970447024 file name=/u01/app/oracle/dg/sysaux01.dbf
datafile 3 switched to datafile copy
input datafile copy RECID=6 STAMP=970447024 file name=/u01/app/oracle/dg/undotbs01.dbf
datafile 4 switched to datafile copy
input datafile copy RECID=7 STAMP=970447024 file name=/u01/app/oracle/dg/users01.dbf
datafile 5 switched to datafile copy
input datafile copy RECID=8 STAMP=970447024 file name=/u01/app/oracle/dg/example01.dbf

contents of Memory Script:
{
 set until scn 1629751;
 recover
 clone database
 delete archivelog
 ;
}
executing Memory Script

executing command: SET until clause

Starting recover at 11-MAR-18
using channel ORA_AUX_DISK_1

starting media recovery

channel ORA_AUX_DISK_1: starting archived log restore to default destination
channel ORA_AUX_DISK_1: restoring archived log
archived log thread=1 sequence=27
channel ORA_AUX_DISK_1: reading from backup piece /u01/app/oracle/flash_recovery_area/DG/backupset/2018_03_11/o1_mf_annnn_TAG20180311T002607_fb8bl7h6_.bkp
channel ORA_AUX_DISK_1: piece handle=/u01/app/oracle/flash_recovery_area/DG/backupset/2018_03_11/o1_mf_annnn_TAG20180311T002607_fb8bl7h6_.bkp tag=TAG20180311T002607
channel ORA_AUX_DISK_1: restored backup piece 1
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:07
archived log file name=/u01/app/oracle/flash_recovery_area/DG/archivelog/2018_03_11/o1_mf_1_27_fb8c6xhy_.arc thread=1 sequence=27
channel clone_default: deleting archived log(s)
archived log file name=/u01/app/oracle/flash_recovery_area/DG/archivelog/2018_03_11/o1_mf_1_27_fb8c6xhy_.arc RECID=25 STAMP=970447029
channel ORA_AUX_DISK_1: starting archived log restore to default destination
channel ORA_AUX_DISK_1: restoring archived log
archived log thread=1 sequence=28
channel ORA_AUX_DISK_1: reading from backup piece /u01/app/oracle/flash_recovery_area/DG/backupset/2018_03_11/o1_mf_annnn_TAG20180311T002737_fb8bo22h_.bkp
channel ORA_AUX_DISK_1: piece handle=/u01/app/oracle/flash_recovery_area/DG/backupset/2018_03_11/o1_mf_annnn_TAG20180311T002737_fb8bo22h_.bkp tag=TAG20180311T002737
channel ORA_AUX_DISK_1: restored backup piece 1
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:01
archived log file name=/u01/app/oracle/flash_recovery_area/DG/archivelog/2018_03_11/o1_mf_1_28_fb8c70bn_.arc thread=1 sequence=28
channel clone_default: deleting archived log(s)
archived log file name=/u01/app/oracle/flash_recovery_area/DG/archivelog/2018_03_11/o1_mf_1_28_fb8c70bn_.arc RECID=26 STAMP=970447032
media recovery complete, elapsed time: 00:00:00
Finished recover at 11-MAR-18

contents of Memory Script:
{
 shutdown clone immediate;
 startup clone nomount;
 sql clone "alter system set db_name = 
 ''DG'' comment=
 ''Reset to original value by RMAN'' scope=spfile";
 sql clone "alter system reset db_unique_name scope=spfile";
 shutdown clone immediate;
 startup clone nomount;
}
executing Memory Script

database dismounted
Oracle instance shut down

connected to auxiliary database (not started)
Oracle instance started

Total System Global Area 2538741760 bytes

Fixed Size 2216024 bytes
Variable Size 1409290152 bytes
Database Buffers 1124073472 bytes
Redo Buffers 3162112 bytes

sql statement: alter system set db_name = ''DG'' comment= ''Reset to original value by RMAN'' scope=spfile

sql statement: alter system reset db_unique_name scope=spfile

Oracle instance shut down

connected to auxiliary database (not started)
Oracle instance started

Total System Global Area 2538741760 bytes

Fixed Size 2216024 bytes
Variable Size 1409290152 bytes
Database Buffers 1124073472 bytes
Redo Buffers 3162112 bytes
sql statement: CREATE CONTROLFILE REUSE SET DATABASE "DG" RESETLOGS ARCHIVELOG 
 MAXLOGFILES 16
 MAXLOGMEMBERS 3
 MAXDATAFILES 100
 MAXINSTANCES 8
 MAXLOGHISTORY 292
 LOGFILE
 GROUP 1 SIZE 50 M ,
 GROUP 2 SIZE 50 M ,
 GROUP 3 SIZE 50 M 
 DATAFILE
 '/u01/app/oracle/dg/system01.dbf'
 CHARACTER SET WE8MSWIN1252


contents of Memory Script:
{
 set newname for tempfile 1 to 
 "/u01/app/oracle/dg/temp01.dbf";
 switch clone tempfile all;
 catalog clone datafilecopy "/u01/app/oracle/dg/sysaux01.dbf", 
 "/u01/app/oracle/dg/undotbs01.dbf", 
 "/u01/app/oracle/dg/users01.dbf", 
 "/u01/app/oracle/dg/example01.dbf";
 switch clone datafile all;
}
executing Memory Script

executing command: SET NEWNAME

renamed tempfile 1 to /u01/app/oracle/dg/temp01.dbf in control file

cataloged datafile copy
datafile copy file name=/u01/app/oracle/dg/sysaux01.dbf RECID=1 STAMP=970447046
cataloged datafile copy
datafile copy file name=/u01/app/oracle/dg/undotbs01.dbf RECID=2 STAMP=970447046
cataloged datafile copy
datafile copy file name=/u01/app/oracle/dg/users01.dbf RECID=3 STAMP=970447046
cataloged datafile copy
datafile copy file name=/u01/app/oracle/dg/example01.dbf RECID=4 STAMP=970447046

datafile 2 switched to datafile copy
input datafile copy RECID=1 STAMP=970447046 file name=/u01/app/oracle/dg/sysaux01.dbf
datafile 3 switched to datafile copy
input datafile copy RECID=2 STAMP=970447046 file name=/u01/app/oracle/dg/undotbs01.dbf
datafile 4 switched to datafile copy
input datafile copy RECID=3 STAMP=970447046 file name=/u01/app/oracle/dg/users01.dbf
datafile 5 switched to datafile copy
input datafile copy RECID=4 STAMP=970447046 file name=/u01/app/oracle/dg/example01.dbf

contents of Memory Script:
{
 Alter clone database open resetlogs;
}
executing Memory Script

database opened
Finished Duplicate Db at 11-MAR-18

RMAN>

One thought on “RMAN

Leave a Reply

Your email address will not be published. Required fields are marked *

87 + = 96