Oracle RMAN ( Recovery Manager ) Backup Tutorials -4

Hi,

I will continue to tell you about the RMAN (Recovery Manager) tool in this fourth article of my tutorial series .

Oracle RMAN2

 

Read Older articles of my rman backup tutorial series before this article with following links.

 

 

Archivelog Backup: Archivelog backup is very important for us to recover database to the exact point of any disaster. For example: If our database is Crash today at 10 o’clock, the most recent full backup was taken yesterday, this full backup is restored first, we need to recover database until at 10 o’clock with Archivelogs. if you delete these files, you need to restore Archivelog files from Archivelog backups.

If the last Archivelog backup is taken 1 hour ago, we should restore archivelogs and recover database until 1 hour ago then if Onlinelogs exist, we can recover until crash time with onlinelogs. As it is understood from the scenario that I have given, it is important to take Backup of Archivelogs, such as take Database in Backup. The backup of the Archivelog files is taken with the following command.

 

[oracle@MehmetSalih ~]$ rman target /

Recovery Manager: Release 19.0.0.0.0 - Production on Mon Mar 25 18:26:00 2019
Version 19.2.0.0.0

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

connected to target database: DEVECI19 (DBID=4027228950)

RMAN> BACKUP ARCHIVELOG ALL;

Starting backup at 25-MAR-19
current log archived
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=81 device type=DISK
channel ORA_DISK_1: starting archived log backup set
channel ORA_DISK_1: specifying archived log(s) in backup set
input archived log thread=1 sequence=3 RECID=1 STAMP=1003861571
channel ORA_DISK_1: starting piece 1 at 25-MAR-19
channel ORA_DISK_1: finished piece 1 at 25-MAR-19
piece handle=/oradata/install/dbs/07ttbdi5_1_1 tag=TAG20190325T182613 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 25-MAR-19

Starting Control File and SPFILE Autobackup at 25-MAR-19
piece handle=/oradata/install/dbs/c-4027228950-20190325-03 comment=NONE
Finished Control File and SPFILE Autobackup at 25-MAR-19

 

 

You can specify format parameter to take archivelog backup to spesific path like following.

RMAN> BACKUP ARCHIVELOG ALL FORMAT '/u01/backup/Archivelog_%d_%t_%s.rman';

Starting backup at 25-MAR-19
current log archived
using channel ORA_DISK_1
channel ORA_DISK_1: starting archived log backup set
channel ORA_DISK_1: specifying archived log(s) in backup set
input archived log thread=1 sequence=3 RECID=1 STAMP=1003861571
input archived log thread=1 sequence=4 RECID=2 STAMP=1003861685
channel ORA_DISK_1: starting piece 1 at 25-MAR-19
channel ORA_DISK_1: finished piece 1 at 25-MAR-19
piece handle=/u01/backup/Archivelog_DEVECI19_1003861685_9.rman tag=TAG20190325T182805 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 25-MAR-19

Starting Control File and SPFILE Autobackup at 25-MAR-19
piece handle=/oradata/install/dbs/c-4027228950-20190325-04 comment=NONE
Finished Control File and SPFILE Autobackup at 25-MAR-19

RMAN>

Each Archivelog file has a sequence number. Due to the flexible structure of RMAN, we can say that you can take backup of the archivelogs from a certain sequence number as follows.

RMAN> BACKUP ARCHIVELOG FROM SEQUENCE 1453;

We can take archivelog backup From a particular Sequence and also we can say that take backup archivelogs until certain sequence number as follows.

RMAN> BACKUP ARCHIVELOG UNTIL SEQUENCE = 1453;

You can backup Archivelogs until a certain time period like following. For example; Backup archivelogs until time 3 days ago.

RMAN> BACKUP ARCHIVELOG UNTIL TIME 'SYSDATE-3';
we can take the backup of the archivelogs in specific date range with the command below. For example; Backup archivelogs from 10 days ago until time 2 days ago.
RMAN> BACKUP ARCHIVELOG FROM TIME 'SYSDATE-10' UNTIL TIME 'SYSDATE-2';

Besides, Archivelogs backup can be taken according to SCN (System Change Number) with following command.

RMAN> BACKUP ARCHIVELOG UNTIL SCN = 1453;

Backup of Archivelogs in spesific SCN range is taken with the following command.

RMAN> BACKUP ARCHIVELOG SCN BETWEEN 1453 AND 2019;


Control File Backup: I explained the importance of Control File as the brain of our database. The instant manual Backup of controlfile that is so important is taken with the following command.

RMAN> BACKUP CURRENT CONTROLFILE;

Starting backup at 25-MAR-19
using channel ORA_DISK_1
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
including current control file in backup set
channel ORA_DISK_1: starting piece 1 at 25-MAR-19
channel ORA_DISK_1: finished piece 1 at 25-MAR-19
piece handle=/oradata/install/dbs/0bttbf8j_1_1 tag=TAG20190325T185514 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 25-MAR-19

Starting Control File and SPFILE Autobackup at 25-MAR-19
piece handle=/oradata/install/dbs/c-4027228950-20190325-05 comment=NONE
Finished Control File and SPFILE Autobackup at 25-MAR-19

RMAN>
  

You can take backup of controlfile to spesific path or disk like following.

RMAN> BACKUP CURRENT CONTROLFILE FORMAT '/u01/backup/ControlFile_%d_%t_%s.rman';

Starting backup at 25-MAR-19
using channel ORA_DISK_1
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
including current control file in backup set
channel ORA_DISK_1: starting piece 1 at 25-MAR-19
channel ORA_DISK_1: finished piece 1 at 25-MAR-19
piece handle=/u01/backup/ControlFile_DEVECI19_1003863689_13.rman tag=TAG20190325T190128 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 25-MAR-19

Starting Control File and SPFILE Autobackup at 25-MAR-19
piece handle=/u01/backup/ControlFilec-4027228950-20190325-06.rman comment=NONE
Finished Control File and SPFILE Autobackup at 25-MAR-19

 

 

The backups of the databases belonging to the production systems are usually taken automatically and recommended. Instant backups, just like the above operations, is a backup that will not being prefered. Control file ‘s automatically backup during each backup operation is taken with the following script.

RMAN> CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '/u01/backup/ControlFile%F.rman';

new RMAN configuration parameters:
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '/u01/backup/ControlFile%F.rman';
new RMAN configuration parameters are successfully stored

 

Spfile Backup: Spfile backup can be taken with the following command.

 

RMAN> backup spfile format '/u01/backup/Spfile.rman';

Starting backup at 25-MAR-19
using channel ORA_DISK_1
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
including current SPFILE in backup set
channel ORA_DISK_1: starting piece 1 at 25-MAR-19
channel ORA_DISK_1: finished piece 1 at 25-MAR-19
piece handle=/u01/backup/Spfile.rman tag=TAG20190325T190357 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 25-MAR-19

Starting Control File and SPFILE Autobackup at 25-MAR-19
piece handle=/u01/backup/ControlFilec-4027228950-20190325-07.rman comment=NONE
Finished Control File and SPFILE Autobackup at 25-MAR-19

RMAN>

The Spfile file can be automatically backed up just like the Control file. If, as above, the controlfile backup file is automatically taken, a backup copy of the Spfile will be copied to the location where Autobackup was set.

Tablespace and Datafile Backup: You can take not only Full and archive-level Backups in Oracle databases but also Backup Tablespace or Datafile. Backups of tablespace and datafiles are taken with the following commands.

You can take backup of system, sysaux and users tablespaces backup like following.

RMAN> backup tablespace system,sysaux,users;

Starting backup at 25-MAR-19
using channel ORA_DISK_1
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00001 name=/oradata/19c/DEVECI19C/system01.dbf
input datafile file number=00003 name=/oradata/19c/DEVECI19C/sysaux01.dbf
input datafile file number=00007 name=/oradata/19c/DEVECI19C/users01.dbf
channel ORA_DISK_1: starting piece 1 at 25-MAR-19
channel ORA_DISK_1: finished piece 1 at 25-MAR-19
piece handle=/oradata/install/dbs/0httbfv8_1_1 tag=TAG20190325T190720 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:15
Finished backup at 25-MAR-19

Starting Control File and SPFILE Autobackup at 25-MAR-19
piece handle=/u01/backup/ControlFilec-4027228950-20190325-08.rman comment=NONE
Finished Control File and SPFILE Autobackup at 25-MAR-19

 

Or You can take backup of spesific datafile like following.

RMAN> backup datafile 1;

Starting backup at 25-MAR-19
using channel ORA_DISK_1
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00001 name=/oradata/19c/DEVECI19C/system01.dbf
channel ORA_DISK_1: starting piece 1 at 25-MAR-19
channel ORA_DISK_1: finished piece 1 at 25-MAR-19
piece handle=/oradata/install/dbs/0jttbg17_1_1 tag=TAG20190325T190823 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:07
Finished backup at 25-MAR-19

Starting Control File and SPFILE Autobackup at 25-MAR-19
piece handle=/u01/backup/ControlFilec-4027228950-20190325-09.rman comment=NONE
Finished Control File and SPFILE Autobackup at 25-MAR-19

 

Mehmet Salih Deveci

I am Certified Expert about Oracle & SQL Server database, Goldengate, Exadata Machine, Oracle Database Appliance administrator with 10+years experience.I have OCA, OCP, OCE RAC Expert Certificates I have worked 100+ Banking, Insurance, Finance, Telco and etc. clients as a Consultant, Insource or Outsource.I have done 200+ Operations in this clients such as Exadata Installation & PoC & Migration & Upgrade, Oracle & SQL Server Database Upgrade, Oracle RAC Installation, SQL Server AlwaysOn Installation, Database Migration, Disaster Recovery, Backup Restore, Performance Tuning, Periodic Healthchecks.I have done 2000+ Table replication with Goldengate or SQL Server Replication tool for DWH Databases in many clients.If you need Oracle DBA, SQL Server DBA, APPS DBA,  Exadata, Goldengate, EBS Consultancy and Training you can send my email adress mehmetsalih.deveci@outlook.com.Oracle DBA, SQL Server DBA, APPS DBA,  Exadata, Goldengate, EBS ve linux Danışmanlık ve Eğitim için  mehmetsalih.deveci@outlook.com a mail atabilirsiniz.

Leave a Reply

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