Site icon IT Tutorial

Full Backup Database in Oracle via RMAN | Oracle RMAN ( Recovery Manager ) Backup Tutorials -6

Hi,

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

 

 

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

https://ittutorial.org/2019/03/25/oracle-rman-recovery-manager-backup-tutorials-1/

https://ittutorial.org/2019/03/25/oracle-rman-recovery-manager-backup-tutorials-2/

https://ittutorial.org/2019/03/25/oracle-rman-recovery-manager-backup-tutorials-3/

https://ittutorial.org/2019/03/26/oracle-rman-recovery-manager-backup-tutorials-4/

https://ittutorial.org/2019/03/26/oracle-rman-recovery-manager-backup-tutorials-5/

 

You should take backup compressed and parallel for using storage effective and increasing backup performance.

 

We will take backup of database,archivelog and controlfile with 8 parallel and compressed like following script. You should put rman commands into run block if you are using multiple commands in same script.

 

run{
ALLOCATE CHANNEL CH1 DEVICE TYPE DISK;
ALLOCATE CHANNEL CH2 DEVICE TYPE DISK;
ALLOCATE CHANNEL CH3 DEVICE TYPE DISK;
ALLOCATE CHANNEL CH4 DEVICE TYPE DISK;
ALLOCATE CHANNEL CH5 DEVICE TYPE DISK;
ALLOCATE CHANNEL CH6 DEVICE TYPE DISK;
ALLOCATE CHANNEL CH7 DEVICE TYPE DISK;
ALLOCATE CHANNEL CH8 DEVICE TYPE DISK;
BACKUP AS COMPRESSED BACKUPSET DATABASE FORMAT '/u01/backup/FULL_%d_%u_%s_%T.bkp';
BACKUP AS COMPRESSED BACKUPSET ARCHIVELOG ALL not backed up 1 times FORMAT '/u01/backup/Archivelogs_%d_%u_%s_%T.bkp';
BACKUP CURRENT CONTROLFILE FORMAT '/u01/backup/CONTROLFILE%d_%u_%s_%T.bkp';
RELEASE CHANNEL CH1;
RELEASE CHANNEL CH2;
RELEASE CHANNEL CH3;
RELEASE CHANNEL CH4;
RELEASE CHANNEL CH5;
RELEASE CHANNEL CH6;
RELEASE CHANNEL CH7;
RELEASE CHANNEL CH8;
}

 

We are taking compressed and 8 parallel full database,archivelogs and controlfile backup like following.

 

[oracle@MehmetSalih ~]$ rman target /

Recovery Manager: Release 19.0.0.0.0 - Production on Tue Mar 26 00:52:02 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> run{
ALLOCATE CHANNEL CH1 DEVICE TYPE DISK;
ALLOCATE CHANNEL CH2 DEVICE TYPE DISK;
ALLOCATE CHANNEL CH3 DEVICE TYPE DISK;
ALLOCATE CHANNEL CH4 DEVICE TYPE DISK;
2> ALLOCATE CHANNEL CH5 DEVICE TYPE DISK;
ALLOCATE CHANNEL CH6 DEVICE TYPE DISK;
ALLOCATE CHANNEL CH7 DEVICE TYPE DISK;
ALLOCATE CHANNEL CH8 DEVICE TYPE DISK;
BACKUP AS COMPRESSED BACKUPSET DATABASE FORMAT '/u01/backup/FULL_%d_%u_%s_%T.bkp';
BACKUP AS COMPRESSED BACKUPSET ARCHIVELOG ALL not backed up 1 times FORMAT '/u01/backup/Archivelogs_%d_%u_%s_%T.bkp';
BACKUP CURRENT CONTROLFILE FORMAT '/u01/backup/CONTROLFILE%d_%u_%s_%T.bkp';
RELEASE CHANNEL CH1;
RELEASE CHANNEL CH2;
RELEASE CHANNEL CH3;
RELEASE CHANNEL CH4;
RELEASE CHANNEL CH5;
RELEASE CHANNEL CH6;
RELEASE CHANNEL CH7;
RELEASE CHANNEL CH8;
}3> 4> 5> 6> 7> 8> 9> 10> 11> 12> 13> 14> 15> 16> 17> 18> 19> 20> 21>

using target database control file instead of recovery catalog
allocated channel: CH1
channel CH1: SID=73 device type=DISK

allocated channel: CH2
channel CH2: SID=86 device type=DISK

allocated channel: CH3
channel CH3: SID=87 device type=DISK

allocated channel: CH4
channel CH4: SID=90 device type=DISK

allocated channel: CH5
channel CH5: SID=88 device type=DISK

allocated channel: CH6
channel CH6: SID=70 device type=DISK

allocated channel: CH7
channel CH7: SID=92 device type=DISK

allocated channel: CH8
channel CH8: SID=64 device type=DISK

Starting backup at 26-MAR-19
channel CH1: starting compressed full datafile backup set
channel CH1: specifying datafile(s) in backup set
input datafile file number=00001 name=/oradata/19c/DEVECI19C/system01.dbf
channel CH1: starting piece 1 at 26-MAR-19
channel CH2: starting compressed full datafile backup set
channel CH2: specifying datafile(s) in backup set
input datafile file number=00003 name=/oradata/19c/DEVECI19C/sysaux01.dbf
channel CH2: starting piece 1 at 26-MAR-19
channel CH3: starting compressed full datafile backup set
channel CH3: specifying datafile(s) in backup set
input datafile file number=00004 name=/oradata/19c/DEVECI19C/undotbs01.dbf
channel CH3: starting piece 1 at 26-MAR-19
channel CH4: starting compressed full datafile backup set
channel CH4: specifying datafile(s) in backup set
input datafile file number=00007 name=/oradata/19c/DEVECI19C/users01.dbf
channel CH4: starting piece 1 at 26-MAR-19
channel CH3: finished piece 1 at 26-MAR-19
piece handle=/u01/backup/FULL_DEVECI19_0tttc45u_29_20190326.bkp tag=TAG20190326T005213 comment=NONE
channel CH3: backup set complete, elapsed time: 00:00:03
channel CH4: finished piece 1 at 26-MAR-19
piece handle=/u01/backup/FULL_DEVECI19_0uttc45u_30_20190326.bkp tag=TAG20190326T005213 comment=NONE
channel CH4: backup set complete, elapsed time: 00:00:04
channel CH2: finished piece 1 at 26-MAR-19
piece handle=/u01/backup/FULL_DEVECI19_0sttc45u_28_20190326.bkp tag=TAG20190326T005213 comment=NONE
channel CH2: backup set complete, elapsed time: 00:00:26
channel CH1: finished piece 1 at 26-MAR-19
piece handle=/u01/backup/FULL_DEVECI19_0rttc45u_27_20190326.bkp tag=TAG20190326T005213 comment=NONE
channel CH1: backup set complete, elapsed time: 00:00:56
Finished backup at 26-MAR-19

Starting backup at 26-MAR-19
current log archived
skipping archived logs of thread 1 from sequence 3 to 4; already backed up
channel CH1: starting compressed archived log backup set
channel CH1: specifying archived log(s) in backup set
input archived log thread=1 sequence=5 RECID=3 STAMP=1003884793
channel CH1: starting piece 1 at 26-MAR-19
channel CH1: finished piece 1 at 26-MAR-19
piece handle=/u01/backup/Archivelogs_DEVECI19_0vttc47q_31_20190326.bkp tag=TAG20190326T005314 comment=NONE
channel CH1: backup set complete, elapsed time: 00:00:07
Finished backup at 26-MAR-19

Starting backup at 26-MAR-19
channel CH1: starting full datafile backup set
channel CH1: specifying datafile(s) in backup set
including current control file in backup set
channel CH1: starting piece 1 at 26-MAR-19
channel CH1: finished piece 1 at 26-MAR-19
piece handle=/u01/backup/CONTROLFILEDEVECI19_10ttc481_32_20190326.bkp tag=TAG20190326T005321 comment=NONE
channel CH1: backup set complete, elapsed time: 00:00:01
Finished backup at 26-MAR-19

Starting Control File and SPFILE Autobackup at 26-MAR-19
piece handle=/u01/backup/ControlFilec-4027228950-20190326-00.rman comment=NONE
Finished Control File and SPFILE Autobackup at 26-MAR-19

released channel: CH1

released channel: CH2

released channel: CH3

released channel: CH4

released channel: CH5

released channel: CH6

released channel: CH7

released channel: CH8

RMAN>

 

 

You can backup database,archivelog and controlfile in one command like following if you don’t want to use multiple commands.

BACKUP AS COMPRESSED BACKUPSET DATABASE INCLUDE CURRENT CONTROLFILE PLUS ARCHIVELOG FORMAT '/u01/backup/FULL_DATABASE_%d_%u_%s_%T.bkp';

 

You can use this command in run block and backup database,archivelog and controlfile like following.



[oracle@MehmetSalih ~]$ rman target /

Recovery Manager: Release 19.0.0.0.0 - Production on Tue Mar 26 01:03:55 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> run{
ALLOCATE CHANNEL CH1 DEVICE TYPE DISK;
ALLOCATE CHANNEL CH2 DEVICE TYPE DISK;
ALLOCATE CHANNEL CH3 DEVICE TYPE DISK;
ALLOCATE CHANNEL CH4 DEVICE TYPE DISK;
BACKUP AS COMPRESSED BACKUPSET DATABASE INCLUDE CURRENT CONTROLFILE PLUS ARCHIVELOG FORMAT '/u01/backup/FULL_DATABASE_%d_%u_%s_%T.bkp';
RELEASE CHANNEL CH1;
RELEASE CHANNEL CH2;
RELEASE CHANNEL CH3;
RELEASE CHANNEL CH4;
}2> 3> 4> 5> 6> 7> 8> 9> 10> 11>

allocated channel: CH1
channel CH1: SID=86 device type=DISK

allocated channel: CH2
channel CH2: SID=87 device type=DISK

allocated channel: CH3
channel CH3: SID=70 device type=DISK

allocated channel: CH4
channel CH4: SID=92 device type=DISK


Starting backup at 26-MAR-19
current log archived
channel CH1: starting compressed archived log backup set
channel CH1: specifying archived log(s) in backup set
input archived log thread=1 sequence=5 RECID=3 STAMP=1003884793
channel CH1: starting piece 1 at 26-MAR-19
channel CH2: starting compressed archived log backup set
channel CH2: specifying archived log(s) in backup set
input archived log thread=1 sequence=6 RECID=4 STAMP=1003885446
input archived log thread=1 sequence=7 RECID=5 STAMP=1003885500
channel CH2: starting piece 1 at 26-MAR-19
channel CH3: starting compressed archived log backup set
channel CH3: 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 CH3: starting piece 1 at 26-MAR-19
channel CH2: finished piece 1 at 26-MAR-19
piece handle=/u01/backup/FULL_DATABASE_DEVECI19_13ttc4tt_35_20190326.bkp tag=TAG20190326T010500 comment=NONE
channel CH2: backup set complete, elapsed time: 00:00:01
channel CH3: finished piece 1 at 26-MAR-19
piece handle=/u01/backup/FULL_DATABASE_DEVECI19_14ttc4tt_36_20190326.bkp tag=TAG20190326T010500 comment=NONE
channel CH3: backup set complete, elapsed time: 00:00:01
channel CH1: finished piece 1 at 26-MAR-19
piece handle=/u01/backup/FULL_DATABASE_DEVECI19_12ttc4tt_34_20190326.bkp tag=TAG20190326T010500 comment=NONE
channel CH1: backup set complete, elapsed time: 00:00:07
Finished backup at 26-MAR-19

Starting backup at 26-MAR-19
channel CH1: starting compressed full datafile backup set
channel CH1: specifying datafile(s) in backup set
input datafile file number=00001 name=/oradata/19c/DEVECI19C/system01.dbf
channel CH1: starting piece 1 at 26-MAR-19
channel CH2: starting compressed full datafile backup set
channel CH2: specifying datafile(s) in backup set
input datafile file number=00003 name=/oradata/19c/DEVECI19C/sysaux01.dbf
channel CH2: starting piece 1 at 26-MAR-19
channel CH3: starting compressed full datafile backup set
channel CH3: specifying datafile(s) in backup set
input datafile file number=00004 name=/oradata/19c/DEVECI19C/undotbs01.dbf
channel CH3: starting piece 1 at 26-MAR-19
channel CH4: starting compressed full datafile backup set
channel CH4: specifying datafile(s) in backup set
including current control file in backup set
channel CH4: starting piece 1 at 26-MAR-19
channel CH3: finished piece 1 at 26-MAR-19
piece handle=/oradata/install/dbs/17ttc4u5_1_1 tag=TAG20190326T010509 comment=NONE
channel CH3: backup set complete, elapsed time: 00:00:05
channel CH3: starting compressed full datafile backup set
channel CH3: specifying datafile(s) in backup set
input datafile file number=00007 name=/oradata/19c/DEVECI19C/users01.dbf
channel CH3: starting piece 1 at 26-MAR-19
channel CH4: finished piece 1 at 26-MAR-19
piece handle=/oradata/install/dbs/18ttc4u6_1_1 tag=TAG20190326T010509 comment=NONE
channel CH4: backup set complete, elapsed time: 00:00:03
channel CH3: finished piece 1 at 26-MAR-19
piece handle=/oradata/install/dbs/19ttc4ua_1_1 tag=TAG20190326T010509 comment=NONE
channel CH3: backup set complete, elapsed time: 00:00:01
channel CH2: finished piece 1 at 26-MAR-19
piece handle=/oradata/install/dbs/16ttc4u5_1_1 tag=TAG20190326T010509 comment=NONE
channel CH2: backup set complete, elapsed time: 00:00:31
channel CH1: finished piece 1 at 26-MAR-19
piece handle=/oradata/install/dbs/15ttc4u5_1_1 tag=TAG20190326T010509 comment=NONE
channel CH1: backup set complete, elapsed time: 00:01:01
Finished backup at 26-MAR-19

Starting backup at 26-MAR-19
current log archived
channel CH1: starting compressed archived log backup set
channel CH1: specifying archived log(s) in backup set
input archived log thread=1 sequence=8 RECID=6 STAMP=1003885570
channel CH1: starting piece 1 at 26-MAR-19
channel CH1: finished piece 1 at 26-MAR-19
piece handle=/u01/backup/FULL_DATABASE_DEVECI19_1attc503_42_20190326.bkp tag=TAG20190326T010611 comment=NONE
channel CH1: backup set complete, elapsed time: 00:00:01
Finished backup at 26-MAR-19

Starting Control File and SPFILE Autobackup at 26-MAR-19
piece handle=/u01/backup/ControlFilec-4027228950-20190326-01.rman comment=NONE
Finished Control File and SPFILE Autobackup at 26-MAR-19

released channel: CH1

released channel: CH2

released channel: CH3

released channel: CH4

RMAN>


You need to take backup of database,archivelogs and controlfile for regular backup in a production database. Because if you take only database backup, you cannot open database with just database backup. Because Oracle needs firstly controlfile then database backup finally archivelogs for recover database.

 

 

 

Do you want to learn Oracle Database for Beginners, then read the following articles.

https://ittutorial.org/oracle-database-19c-tutorials-for-beginners/

Exit mobile version