Showing posts with label RMAN Basics. Show all posts
Showing posts with label RMAN Basics. Show all posts

Sunday, June 9, 2013

RMAN Scripting

You can use the cmdfile command-line option to call a command file while calling RMAN
from the Unix shell prompt

$ rman target=/ catalog=u/p@catalog cmdfile=cmd.rman


1:-----------------
You can call a stored script using the script parameter on the command line, as shown
here:
$ rman target=/ catalog=u/p@catalog script stored_script


2:-----------------
You can store scripts in a catalog and call them from the RMAN command prompt, as shown
here:
RMAN> run { execute script stored_script; }


3:-----------------
To execute the global script, you call that script with the clause global before it, as shown in
the following RMAN command:
RMAN> run { execute global script delete_arc_logs; }


Tuesday, June 4, 2013

RMAN Backup scenarios

Always BEST to set: configure controlfile autobackup to on;
                                                                        --------
7-1. Specifying Image Copy or Backup Set Output
RMAN> backup as backupset
database;

RMAN> backup as backupset
device type sbt
database;

RMAN> backup as copy
database;

RMAN> backup
database
format= '/u01/backup_%U ';

RMAN> backup
database
format '+dgroup1';                               --à for ASM

RMAN> backup
database
tag 'weekly_backup';


7-2. Backing Up the Control File
RMAN> configure controlfile autobackup on; 
[OR]
RMAN> backup current controlfile;
RMAN> backup tablespace users include current controlfile;


7-3. Backing Up the Server Parameter File
RMAN> backup spfile;


7-4. Backing Up Datafiles
RMAN> backup  as copy datafile 1,2,3,4
format '/u01/app/oracle/rman/%d_%U.bus';


7-5. Backing Up Tablespaces

RMAN> backup tablespace users, tools;

RMAN> backup tablespace system format '/ora01/prod1/%d_%U.bus';

RMAN> backup as copy tablespace users;

RMAN> backup incremental level 1 tablespace example;



7-6.Making a Whole-Database Backup


RMAN> backup database;                -->    Datafile + Controlfile + SPFile


RMAN> SQL "alter system archive log current"; -à to archive all the redo log generated during the
above backup was going on…


7-7. Backing Up Archived Redo Logs

RMAN> backup archivelog all;

RMAN> backup device type sbt
archivelog like '/disk%arc%'
delete all input;


RMAN> backup database plus archivelog
The above command does the below sequence of steps:

1. Run the alter system archive log current command.
2. Run the backup archivelog all command.
3. Back up the rest of the datafiles specified by the backup database command.
4. Run the alter system archive log current command.
5. Back up the new archive logs generated during the backup operation.


7-8. Backing Up Everything [ datafile+controlfile+archived log file+spfile]
RMAN> configure controlfile autobackup on;
+
RMAN> backup database plus archivelog;

7-9. Incremental backup:
RMAN> list backup by file;
RMAN> backup incremental level 0 database;
RMAN> backup incremental level 1 database;
RMAN> backup incremental level 1 cumulative database;
You can’t perform an incremental copy of a control file, archived redo log, or backup set.


7-19.Making a Compressed Backup   [binary compressed backup]

RMAN> backup
as compressed backupset
database plus archivelog;


7-20. Parallelizing Backups

run
{
allocate channel ch1 device type sbt
parms 'env=(ob_device_1=testtape1)';        
allocate channel ch2 device type sbt
parms 'env=(ob_device_2=testtape12';
backup
database channel ch1
archivelog all channel ch2;
}

OB_DEVICE[_n] --->  parameter to define which tape drives can be used for backups.



PARALLESISM :
RMAN> configure device type disk parallelism 4;
+
run
{
allocate channel d1 device type disk format '/u01/%d_backups/%U';
allocate channel d2 device type disk format '/u02/%d_backups/%U';
allocate channel d3 device type disk format '/u03/%d_backups/%U';
allocate channel d4 device type disk format '/u04/%d_backups/%U';
backup database;
}

If you want to configure persistent backup parallelism

1. First specify the degree of parallelism for the device type you want:
    configure device type disk parallelism 4;
2. Secondly, configure channels:
    configure channel 1 device type disk format '/u01/%d_backups/%U';
    configure channel 2 device type disk format '/u02/%d_backups/%U';
    configure channel 3 device type disk format '/u03/%d_backups/%U';
    configure channel 4 device type disk format '/u04/%d_backups/%U';

Sunday, June 2, 2013

RMAN 'backup database plus archivelog'

When you use the backup database plus archivelogcommand to back up archive logs as part of another backup, RMAN will perform the following operations in the sequence listed here: .
1. Run the alter system archive log currentcommand.
 2.Run the backup archivelog allcommand.
 3.Back up the rest of the datafiles specified by the backup databasecommand
4.Run the alter system archive log currentcommand.
5.Back up the new archive logs generated during the backup operation. The sequence of operations listed here means that RMAN will have all the necessary archived redo log information that it’ll need down the road if it has to perform a complete recovery of the database. ■NoteThe backup dathe entire database and all the archived redo logs as well as the current control file in a single command.See the next recipe for details

Saturday, June 1, 2013

RMAN snapshot control file

RMAN requires a consistent view of the control file under two circumstances:

• When resynchronizing with the recovery catalog
• When making a backup of the control file

To achieve these two goals, RMAN creates a temporary backup copy of the control file
called the snapshot control file, which enables RMAN to resynchronize with the recovery catalog
or back up the control file, using a read-consistent version of the control file. The default
location and name of the snapshot control file is operating system dependent. On Windows
XP, the default location is ORACLE_HOME/database, and the default name of the snapshot
control file is of the form SNCF<database name>.ORA. On Unix the default directory


Note :

Oracle allows only one RMAN session to access the snapshot control file at a time. This ensures that multiple RMAN sessions do not concurrently write and read from the snapshot control file.



CHANNEL ALLOCATION IN RMAN:

By default, RMAN comes with a single disk channel preconfigured, starting with the Oracle9i
release of the database. So, if you’re backing up to a disk, you don’t have to manually allocate
a channel. However, if you’re backing up to tape, you must either configure an automatic
channel for the tape device or manually allocate a tape (sbt) channel as part of the backup
commands you issue.

run {
allocate channel c1 device type sbt;
backup database;

}

Friday, May 31, 2013

Difference between full backup & level 0 incremental backup | Differential backup & cumulative backup

A level 0 incremental backup is physically identical to a full backup. The only difference is that the level 0 backup is recorded as an incremental backup in the RMAN repository, so it can be used as the parent for a level 1 backup.A full backup can never be part incremental backup strategy i.e it cannot be the parent for a subsequent incremental backup.

----------

Differential backup, which backs up all blocks changed after the recent incremental backup at level 1 or 0

Cumulative backup, which backs up all blocks changed after the most recent incremental backup at level 0

Note : Cumulative backups are preferable to differential backups when recovery time is more important than disk space, because during recovery each differential backup must be applied in succession. Use cumulative incremental backups instead of differential, if enough disk space is available to store cumulative incremental backups.

Oracle 26ai Grid, database installation on Linux 86_64 Step-by-Step

  Click here -->   Oracle 26ai Grid, database installation on Linux 86_64 Step-by-Step Click here -->   Oracle 26ai Grid, database ins...