Till sometime back, RMAN really eluded me. But personally I think its over-rated(No offence, RMAN fans!!)
Here, I would be discussing simple steps for setting up RMAN. The settings I mention here are the very basic ones. Tweaking them depends heavily on the environment, requirements and trade-offs.
Lets suppose our requirements are the ones listed below.
1. Retain only 1 backup of each datafile and controlfile.
2. Optimize backup by skipping the backup of files in certain circumstances if the identical file or an identical version of the file has already been backed up.
3. Backup database to disk, instead of tape
4. Backup controlfile along with the datafiles
5. Backup the controlfile to a specific location on disk, say, /mount/cntFileBkp/
6. Parallelism of say, 4
7. Compressed backup
8. Backup in the form of backup sets, instead of image copies
9. Each backup set to be max of 2000 M
10. Backup datafiles to a specific location on disk, say, /mount/dataFileBkp/
The above mentioned requirements can be implemented by the following simple steps:
1. Start the rman utility
2. On the rman prompt, connect to the target database
RMAN> connect target;
connected to target database: TEST (DBID=528243886)
3. Start configuring to suit your requirements
• For point 1(requirements)
CONFIGURE RETENTION POLICY TO REDUNDANCY 1;
• For point 2
CONFIGURE BACKUP OPTIMIZATION ON;
• For point 3
CONFIGURE DEFAULT DEVICE TYPE TO DISK;
• For point 4
CONFIGURE CONTROLFILE AUTOBACKUP ON;
• For point 5
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO
'/mount/cntFileBkp/%F';
• For points 6, 7 and 8
CONFIGURE DEVICE TYPE DISK PARALLELISM 4 BACKUP TYPE TO COMPRESSED BACKUPSET;
• For points 9 and 10
CONFIGURE CHANNEL DEVICE TYPE DISK FORMAT '/mount/dataFileBkp/%U'
MAXPIECESIZE 2000 M;
4. Confirm your settings by
RMAN> show all;
using target database control file instead of recovery catalog
RMAN configuration parameters are:
CONFIGURE RETENTION POLICY TO REDUNDANCY 1;
CONFIGURE BACKUP OPTIMIZATION ON;
CONFIGURE DEFAULT DEVICE TYPE TO DISK; # default
CONFIGURE CONTROLFILE AUTOBACKUP ON;
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '/mount/cntFileBkp/%F';
CONFIGURE DEVICE TYPE DISK PARALLELISM 4 BACKUP TYPE TO COMPRESSED BACKUPSET;
CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE CHANNEL DEVICE TYPE DISK FORMAT '/mount/dataFileBkp/%U' MAXPIECESIZE 2000 M;
CONFIGURE MAXSETSIZE TO UNLIMITED; # default
CONFIGURE ENCRYPTION FOR DATABASE OFF; # default
CONFIGURE ENCRYPTION ALGORITHM 'AES128'; # default
CONFIGURE ARCHIVELOG DELETION POLICY TO NONE; # default
CONFIGURE SNAPSHOT CONTROLFILE NAME TO '/mount/oracle/testdb/10.2.0/dbs/snapcf_TEST.f'; # default
5. And now we are ready to take a backup(online) of our db, on the following assumptions
• DB is in archivelog mode
• Directory structures for backup locations are in place
6. Run the following backup script to take an online backup of your DB
run {
allocate channel backup_disk1 type disk format '/mount/dataFileBkp/%U' maxpiecesize 2000 M;
allocate channel backup_disk2 type disk format '/mount/dataFileBkp/%U' maxpiecesize 2000 M;
allocate channel backup_disk3 type disk format '/mount/dataFileBkp/%U' maxpiecesize 2000 M;
allocate channel backup_disk4 type disk format '/mount/dataFileBkp/%U' maxpiecesize 2000 M;
backup incremental level 0 cumulative filesperset = 10 as COMPRESSED BACKUPSET tag '%TAG' database;
release channel backup_disk1;
release channel backup_disk2;
release channel backup_disk3;
release channel backup_disk4;
}
release channel;
7. incremental level 0 here refers to a FULL backup, to be used for subsequent incremental backups
8. cumulative refers to copying the data blocks used since the most recent level 0 backup
9. filesperset refers to max no. of datafiles to be included in one backupset
Now, the catch here is, though it all seems very easy to setup and implement, tweaking it to suit your needs/trade-offs can be quite tricky.
For instance, the purpose of taking a compressed backup is to save disk space, but during compressed backup, the CPU utilization is extremely high.
So basically it’s a trade-off between performance and affordable disk space.
Simple-Nice post
ReplyDeleteThanks