7 3 Backup Database Advanced
7 3 Backup Database Advanced
SQL> startup
############################################
##################
--If you get an error about disk space run the commands below. We will learn
details in further lectures.
RMAN> CROSSCHECK BACKUP;
--Recovery Window
RMAN> CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 2 DAYS;
--Backup Redundancy
RMAN> CONFIGURE RETENTION POLICY TO REDUNDANCY 2;
--generate a report to see the effect of these copies under a recovery window-based
backup retention policy
RMAN> REPORT OBSOLETE RECOVERY WINDOW OF 1 DAYS;
#######################################
--to back up backup sets from disk to tape
--If you are backing up a subset of available backup sets, then obtain their
primary keys.
RMAN> LIST BACKUPSET SUMMARY;
--back up all disk backup sets to tape and then delete the input disk backups
RMAN> BACKUP BACKUPSET ALL
DELETE INPUT;
--back up only the backup sets with the primary key 1 and 2 to tape and then delete
the input disk backups
RMAN> BACKUP BACKUPSET 1,2
DELETE INPUT;
--back up the latest image copies of a database to tape and delete the input disk
backups
RMAN> BACKUP DEVICE TYPE sbt
COPY OF DATABASE
DELETE INPUT;
$ cd /home/oracle/backups
$ ls -ltr
--to only back up files that were not backed up after a specified date
RMAN> BACKUP
NOT BACKED UP SINCE TIME 'SYSDATE-14'
DATABASE PLUS ARCHIVELOG;
--to make two copies of each backup set in the default DISK location
RMAN> BACKUP AS BACKUPSET
DEVICE TYPE DISK
COPIES 2
DATAFILE 20;
$ vi sqlnet.ora
ENCRYPTION_WALLET_LOCATION =
(SOURCE =(METHOD = FILE)(METHOD_DATA =
(DIRECTORY = /u01/app/oracle/admin/ORCL/encryption_keystore/)))
--create keystore
$ sqlplus / as sysdba