Showing posts with label recovery. Show all posts
Showing posts with label recovery. Show all posts

Thursday

New Backup and Recovery Features for Oracle 11g Release 2

The following Backup and Recovery features are new in Oracle Database 11g Release 2 (11.2):

 

 

 Oracle Secure Backup (OSB) Cloud Module
 
Users can take advantage of the Internet-based data storage services offered by Amazon Simple Storage Service (Amazon S3) for their RMAN backup and recovery tasks. The OSB Cloud Module interface extends the Amazon S3 functionality and provides an easy-to-manage, cost-efficient, and scalable alternative to maintaining in-house data storage and a local, fully configured backup infrastructure.


DUPLICATE Database Command Enhancements

Users can duplicate a database without connecting to a target database. The only requirements for this operation are a connection to a catalog and an auxiliary database. This new functionality is useful when the target database is not always available.
Users can also duplicate a database without connecting to a target database and a recovery catalog. In this case, the only requirement is that you provide a disk backup location where RMAN can find all the backups, data file copies, archived logs, and control file copies for database duplication. This database duplication enhancement is helpful when it is not possible to connect to the target database and the recovery catalog.
When you duplicate from a target database, RMAN determines if any excluded tablespaces contain SYS-owned objects, materialized views, and identifies tablespaces that are not self-contained before starting any duplication operations.

RMAN Tablespace Point-in-Time Recovery (TSPITR) Enhancements

TSPITR can be used to recover a dropped tablespace and to recover to a point in time before the tablespace was brought online. The latter TSPITR operation can be repeated as many times as necessary.(Before this release, TSPITR did not operate on dropped tablespaces.)


Automatic Block Repair

The enhancements to corrupt block detection make block repair more efficient and increase availability. The automatic block repair enhancement complements the Oracle Database 11g Release 1 automatic block corruption detection.
A detected corrupt block (for example, through a user's SQL query) is now automatically repaired by using a good block from a physical standby database. With automatic block repair, a user querying data in the corrupt block no longer sees the corrupt block error message displayed (ORA-01578). Instead, there is a pause while the corrupt block is repaired, and then the results of the SQL query are returned. The automatic block repair is transparent to the user unless the repair fails. Block recovery is faster because no redo must be applied to the block that is taken from the physical standby database.
Automatic block repair requires an Oracle Active Data Guard license because real-time query mode must be enabled on the physical standby database.
The operation occurs automatically but can also be explicitly invoked with the RMAN RECOVER BLOCK command.

 SET NEWNAME Options

The SET NEWNAME command is more powerful and easier to use. You can use this command on a specific tablespace or on all data files and temp files. You can also change the names for multiple files in the database.A new string format identifier "%b" makes it easier to move files around. Using SET NEWNAME with the format identifier "%b" enables you to designate a file name without its directory path. This option is particularly useful when you want to keep the names of your data files the same but move the data files to a different directory location.
 
 CONVERT DATABASE Option

A new option, SKIP UNNECESSARY DATAFILES, is now supported for the CONVERT DATABASE command. When the option is invoked, the only data files that are converted are those that require RMAN processing during transfer between the specified platforms. The rest of the data files can be used by the destination database through shared storage or path name. By skipping the conversion of data files that do not contain undo segments, overall database transport time can be reduced. You can use this option when converting at the source or converting ON DESTINATION PLATFORM.


 Expanded Backup Compression Levels

RMAN now offers a wider range of compression levels with the Advanced Compression Option (ACO). Although the existing BASIC compression option may be suitable for most environments, you may want to explore the ACO backup compression levels (LOW, MEDIUM, and HIGH) to achieve better performance or higher compression ratios.

 INCARNATION Specifier Enhancement

Incarnations may now be used to further qualify archived redo log ranges for the BACKUP, RESTORE, and LIST commands. You can now specify ALL or CURRENT or designate a particular incarnation number when listing ranges of archived logs.

TO DESTINATION 

 Syntax has been added to the BACKUP command. This addition enables you to designate a specific directory location for backups to disk and is primarily for use with the BACKUP RECOVERY AREA command. If backup optimization is enabled, then RMAN only skips backups of identical files that reside in the directory location specified by the TO DESTINATION option.




Wednesday

The Most Used RMAN (Recovery Manager) Commands

Most Used RMAN Commands and Explanations:


RMAN Commands List (Oracle 11g)

Here is the list of key RMAN commands that are used for Backup and related activities:

  • LIST Commands :
LIST Commands are generic RMAN commands that will show/list various types of information when executed within RMAN utility.

RMAN> list backup;
It lists all the backups taken using RMAN utility.
RMAN> list backup of database;
The above command lists out all the (individual) files that are in the backup.
RMAN> list backup of tablespace system;
The above command lists out all the files that are in the backup that belong to the tablespace ‘system’.
RMAN> list backup of control file;
The above command lists out all backups of the control file.

  • CONFIGURE Commands :
CONFIGURE commands in RMAN are used to configure/setup various initial settings:

RMAN>CONFIGURE RETENTION POLICY TO REDUNDANCY2;
The above commands indicates how many days the backup copies need to be retained. Default is 1 day.
RMAN> CONFIGURE RETENTION POLICY CLEAR;
The above command resets the Retention policy to the default value of 1 day.
CONFIGURE BACKUP OPTIMIZATION ON;
The above command verifies to make sure that identical files are NOT backed up to the device specified.
CONFIGURE BACKUP OPTIMIZATION CLEAR;
The above command resets the Optimization option to the default value.

  • SHOW Commands :
Show commands are used to show/display the configuration setting values.

RMAN> show all;
The above command shows all the current configuration settings on the screen.
RMAN> show retention policy;
The above command shows the current retention policy.
RMAN> show default device type;
The above command shows the default device type configured for backups.
RMAN> show datafile backup copies;
The above command shows the number of backup copies available in the target database.

  • BACKUP Commands :
Backup commands are the real commands which do the actual backup work.

RMAN> backup database;
The above command backs up the database (target).
RMAN> backup database include current controlfile plus archive log;
The above command backs up the target database and the current control file and archive log files.

  • REPORT Commands :
Report commands list/report specific information. The difference between report and list command is report command output is in a better format.

RMAN> report obsolete;
The above command reports which backups can be deleted.

  • DELETE Commands :
Delete commands delete/remove specific items from the server, repository catalog.

RMAN> delete obsolete;
The above command deletes all the backups that are older based on the retention policy setup.

What is RMAN ?

 RMAN (Recovery Manager)


This post i will summarize and explain the most used rman commands.

What is RMAN ?  :

 

RMAN (Recovery Manager) is a backup and recovery manager supplied for Oracle databases created by the Oracle Corporation. It provides database backup, restore. and recovery capabilities, addressing high availability and disaster recovery concerns. Oracle Corporation recommends RMAN as its preferred method for backup and recovery and has written command-line and graphical (via Oracle Enterprise Manager) interfaces for the product.

What to backup in a database:  

  • Database Files
  • Control Files 
  • Offline Redolog Files
  • INIT.ORA
  • Password Files


We use RMAN to backup up Database Files,Control Files, and Offline Redolog Files.

What are the benefits of using RMAN instead of traditional backup strategies:

  • You can take advantage of the powerful Data Recovery Advisor feature, which enables you to easily diagnose and repair data failures and corruption (Chapter 20 discusses the Data Recovery Advisor).
  • There are simpler backup and recovery commands.
  • It automatically manages the backup files without DBA intervention.
  •   It automatically deletes unnecessary backup datafiles and archived redo log files both from disk and tape.
  •   It provides you with detailed reporting of backup actions.
  • It provides considerable help in duplicating a database or creating a standby database.
  • It lets you test whether you can recover your database, without actually restoring data.
  • It lets you verify that available backups are usable for recovery.
  • It lets you make incremental backups, which isn’t possible by any other means of backup.
  • It lets you perform database duplication without backups by using the network-enabled database duplication feature, also known as active duplication.
  • It automatically detects corrupt data blocks during backups, with the corruption relevant information recorded in the V$DATABASE_BLOCK_CORRUPTION view.
  • When only a few data blocks are corrupted, you can recover at the data block level, instead of recovering an entire datafile.
  • You can take advantage of the unused block compression feature, wherein RMAN skips unused data blocks during a backup.
  • Only RMAN provides the ability to perform encrypted backups.
  • You can use RMAN with a variety of third-party storage systems.
  • You can use a powerful yet easy-to-use scripting language, which lets you write custom backup and recovery scripts quickly

Architectural components:

1.RMAN executable
2.Server processes
3.Channels
4.Target database
5.Recovery catalog database (optional)
6.Media management layer (optional)
7.Backups, backup sets, and backup pieces

RMAN Executable:

The RMAN executable, usually named rman, is the program that manages all backup and recovery operations. You interact with the RMAN executable to specify backup and recovery operations you want to perform.

Server Processes:

RMAN server processes are background processes, started on the server, used to communicate between RMAN and the databases. When you connect the RMAN client to the target database server, RMAN allocates server sessions on the target instance and directs them to perform the backup and recovery operations. The RMAN client itself does not perform the backup, restore, or recovery.

Channels:

A channel is an RMAN server process started when there is a need to communicate with an I/O device, such as a disk or a tape. A channel is what reads and writes RMAN backup files. It is through the allocation of channels that you govern I/O characteristics such as:
  • Type of I/O device being read or written to, either a disk or an sbt_tape
  • Number of processes simultaneously accessing an I/O device
  • Maximum size of files created on I/O devices
  • Maximum rate at which database files are read
  • Maximum number of files open at a time
Target Database:

The target database is the database on which RMAN performs backup, restore, and recovery operations. This is the database that owns the datafiles, control files, and archived redo files that are backed up, restored, or recovered.

Note:-- that RMAN does not back up the online redo logs of the target database

Recovery Catalog Database:

The recovery catalog database is an optional repository used by RMAN to record information concerning backup and recovery activities performed on the target. This includes information such as:
  • Details about the physical structure of the target database
  • A log of backup operations performed on the target database's datafiles, control files, and archived redo log files
  • Stored scripts containing frequently used sequences of RMAN commands
Why is the catalog optional? 

Because RMAN manages backup and recovery operations, it requires a place to store necessary information about the database. RMAN always stores this information in the target database control file. You can also store RMAN metadata in a recovery catalog schema contained in a separate database. The recovery catalog
schema must be stored in a database other than the target database.

Contents of the Recovery Catalog

The recovery catalog contains information about RMAN operations, including:
  • Datafile and archived redo log backup sets and backup pieces
  • Datafile copies
  • Archived redo logs and their copies
  • Tablespaces and datafiles on the target database
  • Stored scripts, which are named user-created sequences of RMAN commands
  • Persistent RMAN configuration settings
Media Management Layer

The Media Management Layer (MML) is a third-party piece of software that manages the reading and writing of files to and from tape

Backups, Backup Sets, and Backup Pieces

When you issue an RMAN backup command, RMAN creates backup sets, which are logical groupings of physical files. The physical files that RMAN creates on your backup media are called backup pieces.

RMAN backup

A backup of all or part of your database. This results from issuing an RMAN backup command. A backup consists of one or more backup sets.

Backup set

A logical grouping of backup files -- the backup pieces -- that are created when you issue an RMAN backup command. A backup set is RMAN's name for a collection of files associated with a backup. A backup set is composed of one or more backup pieces.

Backup piece

A physical binary file created by RMAN during a backup. Backup pieces are written to your backup medium, whether to disk or tape. They contain blocks from the target database's datafiles, archived redo log files, and control files. When RMAN constructs a backup piece from datafiles, there are a several rules that it follows:
  • A datafile cannot span backup sets
  • A datafile can span backup pieces as long as it stays within one backup set
  • Datafiles and control files can coexist in the same backup sets
  • Archived redo log files are never in the same backup set as datafiles or control files RMAN is the only tool that can operate on backup pieces. If you need to restore a file from an RMAN backup, you must use RMAN to do it. There's no way for you to manually reconstruct database files from the backup pieces. You must use RMAN to restore files from a backup piece. 

  •