7 2 Backup Database
7 2 Backup Database
7 2 Backup Database
SQL> startup
############################################
#######################
--back up without catalog database
$ rman target /
RMAN> BACKUP
DEVICE TYPE DISK
DATABASE;
####OPTION######
--if you have tape unite in your system you can arrange sbt as device type
RMAN> BACKUP
DEVICE TYPE SBT
DATABASE;
$ ls -ltr
--backup of tablespace
--when connected to pdb1
RMAN> BACKUP TABLESPACE tbs_data;
--backup of datafile
SQL> sqlplus / as sysdba
##########################
--To back up a database to multiple disk drives
--Allocate one DISK channel for each disk drive and specify a format so that the
file names are on different disks.
RMAN> RUN
{
ALLOCATE CHANNEL disk1 DEVICE TYPE DISK FORMAT '/disk1/%d_backups/%U';
ALLOCATE CHANNEL disk2 DEVICE TYPE DISK FORMAT '/disk2/%d_backups/%U';
ALLOCATE CHANNEL disk3 DEVICE TYPE DISK FORMAT '/disk3/%d_backups/%U';
BACKUP AS COPY DATABASE;
}
--You can configure multiple disk channels so that backups will be distributed to
multiple disk drives by default
RMAN> CONFIGURE DEVICE TYPE DISK PARALLELISM 3;
RMAN> CONFIGURE DEFAULT DEVICE TYPE TO DISK;
RMAN> CONFIGURE CHANNEL 1 DEVICE TYPE DISK FORMAT '/disk1/%d_backups/%U';
RMAN> CONFIGURE CHANNEL 2 DEVICE TYPE DISK FORMAT '/disk2/%d_backups/%U';
RMAN> CONFIGURE CHANNEL 3 DEVICE TYPE DISK FORMAT '/disk3/%d_backups/%U';
RMAN> BACKUP AS COPY DATABASE;
##########################
--Making Compressed Backups
RMAN> BACKUP
AS COMPRESSED BACKUPSET
DATABASE
FORMAT "/home/oracle/backups/backupcmprs_%U";
$ du -h backup*
--To make a differential incremental backup. It only backs up those data blocks
changed since the most recent level 1 or level 0 backup.
RMAN> BACKUP
INCREMENTAL LEVEL 1
DATABASE
TAG 'INCREMENTAL_DIFFERENTIAL';
--To make a cumulative incremental backup, backing up all blocks changed since the
most recent level 0 backup.
RMAN> BACKUP
INCREMENTAL LEVEL 1 CUMULATIVE
DATABASE;
TAG 'INCREMENTAL_CUMULATIVE';
--Basic Incremental Update Script
RMAN> RUN
{
RECOVER COPY OF DATABASE
WITH TAG 'full_copy';
BACKUP
INCREMENTAL LEVEL 1
FOR RECOVER OF COPY WITH TAG 'full_copy'
DATABASE;
}
--You can also create the change tracking file in a location that you choose
yourself
ALTER DATABASE ENABLE BLOCK CHANGE TRACKING
USING FILE '/home/oracle/backups/rman_change_track.f' REUSE;
$ cd /home/oracle/backups
$ ls -ltr