Archivelog Mode: RMAN Architecture

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 9

Recovery Manager (RMAN)

RMAN can do everything a normal backup can do, however RMAN has its own backup catalog to
record the backups that took place. The database can be in two formats archivelog mode or
nonarchivelog mode

 archivelog - Oracle saves the filled redo logs files, which means you can recovery the database
to any point in time using the archived logs
 nonarchivelog - the redo logs are overwritten and not saved, but can only be recovery from the
last backup.

There are several types of backup

 whole backup - you backup the database as a whole which includes the controlfiles and spfile
 partial backup - you back only a part of the database such a tablespace, one data file
 consistent -  a consistent backup does not need to go through recover when being restored,
normally associated with a closed backup
 inconsistent - a inconsistent backup always needs to be recovered
 open - is backup taken when the database is running, also known as a hot, warm, online backup
 closed - is a backup taken when the database is shutdown also know as a cold, offline backup

The benefits to using RMAN are

 Human error is minimized as RMAN keeps tracks of all the backups


 Simple command interface
 Unused block compression lets you skip unused data blocks, thus saving space and time.
 RMAN can be fully automated
 Supports high-speed incremental backups
 Can perform error checking when backing up or during recovery
 Can perform image copies which are similar to operating system backup
 Can be used with 3rd party backup management software like Veritas Netbackup
 It is well integrated into OEM, so you can make use of Oracle's scheduler

RMAN Architecture

RMAN operates via a server session connecting to the target database, it gets the metadata from the
target, this is called the RMAN repository. The repository will contain information on

 Data file backup sets and copies


 Archived redo log copies and backup sets
 Tablespaces and data file information
 Stored scripts (only can be used if using a recovery catalog)
 RMAN configuration settings

The Recovery Catalog

RMAN will use the controlfile on the target database to store repository information regarding any
backups for that server, this information can also be stored in a recovery catalog (optional) which resides
on a rman server its own database (default size should be about 115MB) which should be dedicated to
RMAN, information is still written to controlfile even if a recovery catalog is used.

The information stored in the controlfile is stored in the reusable sections called circular reuse records
and non-circular reuse records. The circular reuse records have non-critical information that can be
overwritten if needed. Some of the non-circular re-useable sections consists of data files and redo log
information. RMAN can backup archive logs, controlfile, data files, spfile and tablespaces it does not
backup temporary tablespaces, redo logs, password file, init.ora.

The controlfile based repository will retain data for only the time specified by the instance parameter
CONTROL_FILE_RECORD_KEEP_TIME this defaults to seven days.

Useful View
V$CONTROLFILE_RECORD_SECTION displays information about the control file record sections

Media Management Layer

If you backup to tapes you require additional software called MML (media management layer) or media
manager. MML is a API that interfaces with different vendors tape libraries.

RMAN terminology

 backup piece - operating system file containing the backup of a data file, controlfile, etc
 backup set - logical structure that contains one or more backup pieces, all relevant backup pieces
are contained in a backup set
 image copy -  similar to operating system copies like cp or dd, they will contain all block if if not
used (disk only)
 proxy copy - media manger is given control of the copying process
 channel -  Channel allocation is a method of connecting rman and the target database while also
specifying the type of backup i.e. disk or tape, they can created manually or automatically.

Connecting to RMAN

There are a number of ways to connect to RMAN and it depends on where the recovery catalog is

c:\> set ORACLE_SID=D01


set the Oracle SID
ORACLE_SID=D01; export ORACLE_SID
c:\> rman 
connect to the target server use oracle_sid rman> connect target /
and local controlfile
c:\> rman target=sys/<password>@d01
rman> connect catalog
connect the recovery manager catalog rman_user/password@d01
rman> connect target orcl catalog
connect target & recovery manager catalog rman_user/password@d01

Configuring RMAN persistent settings


RMAN’s persistent settings which are stored in the controlfile (reason why must be in mount mode) of
the target database (#default means that parameter is at default setting) or a recovery catalog if used

You can use format options with backup commands to specify a


location and name for backup pieces

%F - combines database identifier (DBID), day, month, year


and sequence number 
Format options %U - Specifies a system generated unique filename (default) 
%u - specifies an 8 character name 
%d - name of database 
%s - backup set number 
%t - backup set timestamp 
%p - piece number within the backup set
rman> show all

CONFIGURE RETENTION POLICY TO REDUNDANCY 1; # default 


CONFIGURE BACKUP OPTIMIZATION OFF; # default 
CONFIGURE DEFAULT DEVICE TYPE TO DISK; # default 
CONFIGURE CONTROLFILE AUTOBACKUP OFF; 
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK
TO '%F'; 
CONFIGURE DEVICE TYPE DISK BACKUP TYPE TO COMPRESSED
BACKUPSET PARALLELISM 1; 
Displaying 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 'z:/orabackup/%U'; 
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
'C:\ORACLE\PRODUCT\10.2.0\DB_1\DATABASE\SNCFD01.ORA';#default
set default
device to be a configure default device type to sbt;
tape drive
set default
device to be a configure default device type to disk;
disk drive
set default
backup to be a configure device type disk backup type to copy;
image copy
default disk
backup to a
configure device type disk backup type to compressed
compressed backupset;
backupset (upto
20% ratio)
default tape
backup to a
configure device type sbt backup type to compressed
compressed backupset;
backupset (upto
20% ratio)
Set degree of configure device type disk parallelism 4;
parallelism configure device type sbt parallelism 4;
configure backup optimization on;
Backup
optimization Note: this will ensure that RMAN doesn't perform a backup if
it has already backed up identical versions.
CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 30 DAYS 
CONFIGURE CONTROLFILE AUTOBACKUP ON 
CONFIGURE DEVICE TYPE DISK BACKUP TYPE TO BACKUPSET
PARALLELISM 1
My basic rman
config CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK
TO 's:\ora_backup\controlfile_%F'

CONFIGURE CHANNEL DEVICE TYPE DISK FORMAT 's:\ora_backup\ora_


%d_T%t_S%s_P%p'

Channel Parameters/Options

The parameters/options are use to control the resources used by RMAN, there are many options
probably best to consult the oracle documentation.

 channel device type  - set default location of backups can be disk or sbt
 channel rate - limits i/o bandwith KB, MB or GB
 channel maxpiecesize - limits the size of the backup pieces
 channel maxsetsize - limits the size of the backup sets
 channel connect - instructs a specific instance to perform an operation
 duration - controls time for backup job (hours/mins)
 parms - send specific instructions to tape library

rman> configure channel device type disk format


‘s:\ora_backup\ora_dev_f%t_s%s_s%p’; 
rman> configure channel device type disk rate = 5m; 
examples rman> configure channel device type disk maxpiecesize =
2g; 
rman> configure channel device type disk maxsetsize =
10g;

Backup Retention

Default is redundancy 1 which means always attempt to have one backup image or backupset of every
data file, archive log and controlfile
keep backups for 30 rman> configure retention policy to recover window of 30
days days;
keep aleast 2 copies rman> configure retention policy to redundancy 2;
reset back to 1 rman> configure retention policy clear;
(default)
extend the retention rman> change backupset tag monthly_backup keep until time
period ’01-dec-07’ logs;

Backup Tagging

rman> backup database tag “monthly_backup”; 


examples rman> backup database as copy tag “monthly_backup”;

Controlfile Backup

rman> backup current controlfile;


rman> configure controlfile autobackup on; (default location
flash recovery area)
examples
rman> configure controlfile autobackup format for device type
disk to       ‘z:\orabackup\controlfile_%F’;

Tablespace Excludes

rman> configure exclude from tablespace test; (exclude test


tablespace from backup)
rman> configure exclude from tablespace test clear; (remove
examples the exclude test tablespace from backup)
rman> backup database noexeclude (ignore any exclude
settings)

Creating Backups

Backup Sets rman> run { 


  allocate channel c1 type disk; 
  backup database format ‘db_%u_%d_%s’; (the
backup set name for the data file) 
  backup format ‘log_t%t_s%s_p%p’; (the backup
set name from the archive logs) 
  (archivelog all); 
}

rman> run { 
  allocate channel c1 type disk;
  allocate channel c2 type disk; 
  backup 
  (datafile 1,2,3 channel c1) 
  (archivelog all channel c2); 
}

rman> backup as compressed backupset


database; 
rman> backup incremental level 0 database; -
baseline incremental backup (a full backup ) 
rman> backup incremental level 1 database; -
incremental backup must have baseline backup 
rman> backup incremental level 1 cumulative
database; - backs up from last level 0 backup
(NOT FULL)

rman> backup as backupset copy of tablespace


sysaux; (create a backupset from a image copy)

## make that all redo logs are archived -


see redo 
rman> backup database (archivelog all); 

rman> run { 
  allocate channel c1 type disk; 
  copy datafile 1 to
‘z:\orabackup\system01.dbf’, current
controlfile to ‘z:\orabackup\control01.ctl’; 
Backup Images }

rman> backup as copy database;


rman> backup as copy copy of database;
rman> backup copy as copy tablespace sysaux;
rman> backup as copy datafile 2;
rman> configure device type disk parallelism
3; (must have 3 channels)

Note : You only configure the number of


Parallel Streams streams to the number of channels, if you
configure more they will not start. Remember
that you need multiple channels configured to
use the streams.
# need to clear the 'controlfile autoback
format' then the flash recovery area will be
Backup controlfile and spfile to flash used. 
recovery area rman> configure controlfile autobackup format
for device type disk clear
rman> backup current controlfile;
Other examples rman> backup device type disk copies 2
datafile 1 format ''disk1/df1_%U',
'/disk2/df1_%U';
rman> backup as copy copy of database
from tag 'test' check logical tag
'duptest';
rman> backup database plus archivelog;
rman> backup as copy duration 04:00
minimize time database;
rman> backup as compressed backupset
database plus archivelog;

Note:
logical - perform logical check of the
backup files
duration - time limit to perform the
backup 
minimize - perform the backup as fast as
it can
compressed - compress the backup set,
remember it will take longer to recovery
as it needs to uncompress

Validating/Cross Checking Backups

You can validate a backup set before you restore which ensures that backup files exist in the proper
locations and that they are readable and free from any logical and physical corruptions, you can also
crosscheck backup sets to make sure they are available and have not been deleted (backup sets can be
deleted from the operating system level).

Validate a backup rman> validate backupset 1;


crosscheck rman> crosscheck backupset 1;

Viewing backups

The v$ views information regarding backups is always located in the target database’s or target
database’s controlfile.

The list commands are used to determine files impacted by the change, crosscheck and delete
commands. The report command is accurate when the control and RMAN repository are synchronized
which can be performed by the change, crosscheck and delete commands

rman> list copy;


list all image copies rman> list archivelog all;
rman> list backup; 
list all backups rman> list backupset by backup
[summary|verbose];
list backed up files rman> list backupset by file;
list backed up databases; rman> list backup of database;
rman> list backup of datafile
list all datafile number 1 backups 1;
rman> list backup of
list backed up controlfiles controlfile;
rman> list script names;
list backup scripts rman> list global script
names;
list all backups no longer required according to rman> report obsolete;
retention policy
list all the physical datafiles rman> report schema;
list files that require backing up rman> report need backup
Useful Views
displays information about the control
v$controlfile_record_Section
file record sections
lists each file backed up, also has
v$backup_files
compressed option
v$backup_set lists backup sets
v$backup_piece lists backup pieces
v$backup_redolog lists archived backup logs
v$backup_spfile lists spfiles
names of SBT devices that have been
v$backup_device
linked to rman
lists all changed configurations settings
v$rman_configuration
(good point to check config)
v$rman_status Status of all completed rman jobs
provides important corruption
v$backup_corruption
information
provides important corruption
v$copy_corruption
information

Deleting Backups

 To removed old archive logs use "delete all" option, if all is missed only the archive logs in the primary
destination will be deleted.

rman> delete backupset 12; 


rman> delete backupset tag=monthly_backup; 
rman> delete copy of datafile 6; 
rman> delete copy of archivelog all; 
Examples rman> delete obsolete;

Note:
obsolete - delete all backups no longer needed due to
retention levels

Catalog commands
The catalog command helps you identify and catalog any files that aren't recorded in RMAN's
repository and thus are known to RMAN

rman> catalog datafilecopy


catalog all data files copies 'c:\oracle\backup\users01.dbf';
rman> catalog backuppiece
catalog all backup pieces copies ':c\oracle\backup\backup_20.bkp';
Search for uncatalog files in a rman> catalog start with ':c\oracle\backup';
directory
rman> delete force noprompt archivelog
Delete discrepancy in catalog sequence 40;

Block change tracking

Block change tracking is used to backup very large databases,when you enable change block tracking a
new process CTWR is then started:

alter database enable block change tracking using file


Enabling ‘c:\oracle\tracking\block_tracking.log’
select filename, status, bytes from
Viewing v$block_change_tracking;
Disabling alter database disable block change tracking;

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy