===============================
ORACLE DATABASE BACKUPS
===============================
*********** RAFFEEK ***********
===============================
1. logfileical backup (exp/imp --> 9i , expdp/impdp --> 10g)
2. Physical backup
2.A) User Managed backup( Cold and Hot backup)
2.B) Server Manager backup( RMAN )
2.B) RMAN - Recovery manager (RMAN) is a command line utility used to perform backup and recovery. RMAN provide greater ease of
management and administration of the backup and recovery operations.
* V$RMAN_OUTPUT - This is an in-memory view of the messages reported by RMAN holding a maximum of 32767 rows. Since this information
is not recorded in the controlfile it is lost on instance restart.
* V$RMAN_STATUS - This view displays progress and status information for in-progress and complete RMAN jobs. The information for the
in-progress jobs is memory only, while the complete job information comes from the controlfile.
* V$BACKUP_FILES - This view display information about RMAN image copies, backupsets and archived logs, similar to the information
listed by the RMAN commands LIST BACKUP and LIST COPY. This view relies on the DBMS_RCVMAN.SETDATABASE procedure being run to set the
database.
Note: Database must be open.
RMAN will take online Archive log as one Backupset(BS)
Then it will take actuall datafiles
Then it will take controlfile and spfile
Then it will take actual archive log files
* Set oracle environment
. oraenv
<cts>
rman
RMAN>connect target /
RMAN> show all --> it will display the default parameter files
RMAN configuration parameters are:
CONFIGURE RETENTION POLICY TO REDUNDANCY 1; # default
--> only(one) last backup will be valid since redundance is 1 remaining backup will be obsolete.
CONFIGURE BACKUP OPTIMIZATION OFF; # default
--> if its ON, datafile will not be backedup if there is no changes in datafile blocks.
CONFIGURE DEFAULT DEVICE TYPE TO DISK; # default
--> Bakup will go to disk( we can mention TAPE also)
CONFIGURE CONTROLFILE AUTOBACKUP OFF; # default
--> If its ON, Controlfile will be backedup even if we take one datafile as well.
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '%F'; # default -->controlfile backup will go to disk.
CONFIGURE DEVICE TYPE DISK PARALLELISM 1 BACKUP TYPE TO BACKUPSET; # default
-->we can increase the parallelsim but we shold have more CPUs in our server.
CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
-->only one copy of datafiles backup will happen if we take database backup .
CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
-->only one copy of archive files backup will happen if we take archivefiles.
CONFIGURE MAXSETSIZE TO UNLIMITED; # default
--> we can define the size of backup piece.
CONFIGURE ENCRYPTION FOR DATABASE OFF; # default
CONFIGURE ENCRYPTION ALGORITHM 'AES128'; # default
CONFIGURE ARCHIVELOG DELETION POLICY TO NONE; # default
--> We can delete the archivefiles using delete input or sysdate-1 or none
CONFIGURE SNAPSHOT CONTROLFILE NAME TO '/u01/app/oracle/product/10.2.0/db_1/dbs/snapcf_citi.f'; # default
> How to take full backup?
RMAN>BACKUP DATABASE PLUS ARCHIVELOG;
*it will take four backup sets (current archivelog file, Datafiles, controlfile and spfile, actual archivelog files) each backup set
contains one or more backup pieces.
> How to take incremental backup?
RMAN>BACKUP INCREMENTAL LEVEL 1 DATABASE;
> How to check the backup details?
RMAN>list backup;
RMAN>list backup summary;
>How to valiate backup?
RMAN>validate backupset 2;
(or)
RMAN>validate backupset 2,3,4;
> How to check backup of datafiles?
RMAN>list backup of database;
> How to check backup of archivelog?
RMAN> list backup of archivelog all;
>How to check backup of controlfiles?
RMAN> list backup of controlfile;
>What is mean by obsolete and expiry?
* Obsolete -> Invalid backup
* Expairy -> Backup not found in os level(physically deleted)
RMAN>report obsolete;
RMAN>list expired backup;
>Types of RMAN backup?
* L0 bakup or Full backup
* L1 bckup or Incremental bckup ( it will take only changed block after last backup)
>Can we give the database commands in RMAN prompt?
sample commands:
RMAN>startup
RMAN>startup mount
RMAN>shutdown immediate
RMAN>alter database open;
>What is cross check?
If any arhivelog file is physially deleted we can't take backup of archivelogs, so we can give the below command then we can take the
backup.
RMAN>crosscheck archivelog all;
>Full database backup command?
Example for DISK BACKUP:
=======================
. oraenv
<DB NAME>
rman target /
configure default device type to disk;
configure controlfile autobackup on;
configure channel device type disk format '<Disk_Location>/df_%t_%s_%p';
CONFIGURE SNAPSHOT CONTROLFILE NAME TO '<Disk_Location>/snapcf_oid.f';
run
{
backup current controlfile;
backup database plus archivelog;
}
Example for TAPE BACKUP:
========================
Before taking backup to tape we need to configure Tivoli client(TSM) or some other media library softwares to connect with TAPE.
. oraenv
<DB NAME>
rman
RMAN>connect target;
run {
allocate channel t1 type 'sbt_tape'
parms 'ENV=(TDPO_OPTFILE=/u001/app/TDP/dbname/tdpo.opt)'
format '%d_inc0_%U.rbck';
backup incremental level 0 database tag OPEN_INC0_DAY;
release channel t1;
}
sql 'alter system archive log current';
change archivelog all crosscheck;
run {
allocate channel a1 type 'sbt_tape'
parms 'ENV=(TDPO_OPTFILE=/u001/app/TDP/dbname/tdpo.opt)'
format '%d_arch_%U.rbck';
backup archivelog all not backed up 3 times tag ARCHIVE_Backup ;
delete archivelog until time = 'sysdate-7';
release channel a1;
}
run {
allocate channel c1 type 'sbt_tape'
parms 'ENV=(TDPO_OPTFILE=/u001/app/TDP/dbname/tdpo.opt)'
format '%d_controlfile_%U.rbck';
backup current controlfile tag CONTROLFILE_DAY;
release channel c1;
}
exit
ORACLE DATABASE BACKUPS
===============================
*********** RAFFEEK ***********
===============================
1. logfileical backup (exp/imp --> 9i , expdp/impdp --> 10g)
2. Physical backup
2.A) User Managed backup( Cold and Hot backup)
2.B) Server Manager backup( RMAN )
2.B) RMAN - Recovery manager (RMAN) is a command line utility used to perform backup and recovery. RMAN provide greater ease of
management and administration of the backup and recovery operations.
* V$RMAN_OUTPUT - This is an in-memory view of the messages reported by RMAN holding a maximum of 32767 rows. Since this information
is not recorded in the controlfile it is lost on instance restart.
* V$RMAN_STATUS - This view displays progress and status information for in-progress and complete RMAN jobs. The information for the
in-progress jobs is memory only, while the complete job information comes from the controlfile.
* V$BACKUP_FILES - This view display information about RMAN image copies, backupsets and archived logs, similar to the information
listed by the RMAN commands LIST BACKUP and LIST COPY. This view relies on the DBMS_RCVMAN.SETDATABASE procedure being run to set the
database.
Note: Database must be open.
RMAN will take online Archive log as one Backupset(BS)
Then it will take actuall datafiles
Then it will take controlfile and spfile
Then it will take actual archive log files
* Set oracle environment
. oraenv
<cts>
rman
RMAN>connect target /
RMAN> show all --> it will display the default parameter files
RMAN configuration parameters are:
CONFIGURE RETENTION POLICY TO REDUNDANCY 1; # default
--> only(one) last backup will be valid since redundance is 1 remaining backup will be obsolete.
CONFIGURE BACKUP OPTIMIZATION OFF; # default
--> if its ON, datafile will not be backedup if there is no changes in datafile blocks.
CONFIGURE DEFAULT DEVICE TYPE TO DISK; # default
--> Bakup will go to disk( we can mention TAPE also)
CONFIGURE CONTROLFILE AUTOBACKUP OFF; # default
--> If its ON, Controlfile will be backedup even if we take one datafile as well.
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '%F'; # default -->controlfile backup will go to disk.
CONFIGURE DEVICE TYPE DISK PARALLELISM 1 BACKUP TYPE TO BACKUPSET; # default
-->we can increase the parallelsim but we shold have more CPUs in our server.
CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
-->only one copy of datafiles backup will happen if we take database backup .
CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
-->only one copy of archive files backup will happen if we take archivefiles.
CONFIGURE MAXSETSIZE TO UNLIMITED; # default
--> we can define the size of backup piece.
CONFIGURE ENCRYPTION FOR DATABASE OFF; # default
CONFIGURE ENCRYPTION ALGORITHM 'AES128'; # default
CONFIGURE ARCHIVELOG DELETION POLICY TO NONE; # default
--> We can delete the archivefiles using delete input or sysdate-1 or none
CONFIGURE SNAPSHOT CONTROLFILE NAME TO '/u01/app/oracle/product/10.2.0/db_1/dbs/snapcf_citi.f'; # default
> How to take full backup?
RMAN>BACKUP DATABASE PLUS ARCHIVELOG;
*it will take four backup sets (current archivelog file, Datafiles, controlfile and spfile, actual archivelog files) each backup set
contains one or more backup pieces.
> How to take incremental backup?
RMAN>BACKUP INCREMENTAL LEVEL 1 DATABASE;
> How to check the backup details?
RMAN>list backup;
RMAN>list backup summary;
>How to valiate backup?
RMAN>validate backupset 2;
(or)
RMAN>validate backupset 2,3,4;
> How to check backup of datafiles?
RMAN>list backup of database;
> How to check backup of archivelog?
RMAN> list backup of archivelog all;
>How to check backup of controlfiles?
RMAN> list backup of controlfile;
>What is mean by obsolete and expiry?
* Obsolete -> Invalid backup
* Expairy -> Backup not found in os level(physically deleted)
RMAN>report obsolete;
RMAN>list expired backup;
>Types of RMAN backup?
* L0 bakup or Full backup
* L1 bckup or Incremental bckup ( it will take only changed block after last backup)
>Can we give the database commands in RMAN prompt?
sample commands:
RMAN>startup
RMAN>startup mount
RMAN>shutdown immediate
RMAN>alter database open;
>What is cross check?
If any arhivelog file is physially deleted we can't take backup of archivelogs, so we can give the below command then we can take the
backup.
RMAN>crosscheck archivelog all;
>Full database backup command?
Example for DISK BACKUP:
=======================
. oraenv
<DB NAME>
rman target /
configure default device type to disk;
configure controlfile autobackup on;
configure channel device type disk format '<Disk_Location>/df_%t_%s_%p';
CONFIGURE SNAPSHOT CONTROLFILE NAME TO '<Disk_Location>/snapcf_oid.f';
run
{
backup current controlfile;
backup database plus archivelog;
}
Example for TAPE BACKUP:
========================
Before taking backup to tape we need to configure Tivoli client(TSM) or some other media library softwares to connect with TAPE.
. oraenv
<DB NAME>
rman
RMAN>connect target;
run {
allocate channel t1 type 'sbt_tape'
parms 'ENV=(TDPO_OPTFILE=/u001/app/TDP/dbname/tdpo.opt)'
format '%d_inc0_%U.rbck';
backup incremental level 0 database tag OPEN_INC0_DAY;
release channel t1;
}
sql 'alter system archive log current';
change archivelog all crosscheck;
run {
allocate channel a1 type 'sbt_tape'
parms 'ENV=(TDPO_OPTFILE=/u001/app/TDP/dbname/tdpo.opt)'
format '%d_arch_%U.rbck';
backup archivelog all not backed up 3 times tag ARCHIVE_Backup ;
delete archivelog until time = 'sysdate-7';
release channel a1;
}
run {
allocate channel c1 type 'sbt_tape'
parms 'ENV=(TDPO_OPTFILE=/u001/app/TDP/dbname/tdpo.opt)'
format '%d_controlfile_%U.rbck';
backup current controlfile tag CONTROLFILE_DAY;
release channel c1;
}
exit
Cloud Ace Technologies is offering Implementation Services on Cloud Computing, Cloud Services, IT Security, Storage solutionsCommvault Backup Solution in chennai
ReplyDeleteHi,
ReplyDeleteThanks for share this post.
Hi,
ReplyDeleteNice blog. Thanks for sharing.
Thank you for providing this kind of useful informationoracle training in chennai
ReplyDelete