Nov 13, 2023

R-MAN BACKUP

Hi guys, in this blog I am going to explain you about R-MAN BACKUP.


Archivelog :

Archive log mode permits complete recovery from disk failure as well as instance failure, because all changes made to the database are permanently saved in an archived redo log. These redo log files are used with backups of your data files to perform media recovery.

Enable Archivelog Mode

SQL> Shut immediate; 


SQL> Startup mount;


SQL> alter database archivelog;



SQL> alter database open;


SQL> archive log list;





Noarchive log mode  :-

NOARCHIVELOG mode is basically the absence of ARCHIVELOG mode and has the disadvantage of not being able to recover to any point in time. NOARCHIVELOG mode does have the advantage of not having to write transactions to an archive log and thus increases the performance of the database slightly.

SQL> shut immediate;




SQL> startup mount;




SQL> alter database noarchivelog;


SQL> alter database open;




SQL> archive log list;



Consistent (Closed) Backup:

A consistent backup is often referred to as a "closed" backup. It is taken when the database is in a consistent state, typically by shutting down the database or placing it in a mode where no transactions are allowed during the backup process.

A consistent backup ensures that the entire dataset, including all committed transactions, is captured in the backup, providing a known point-in-time recovery point.

Example (using RMAN):

  SHUTDOWN IMMEDIATE;  -- Optionally, shut down the database for consistency.

  STARTUP MOUNT;       -- Mount the database but do not open it.

  BACKUP DATABASE;

  ALTER DATABASE OPEN; -- Reopen the database after the backup.

}

Inconsistent (Open) Backup:

An inconsistent backup, often referred to as an "open" backup, is taken while the database is open and transactions are still being processed. This type of backup captures the state of the database as it is at the moment the backup process begins.

Inconsistent backups might include uncommitted transactions and can be useful for regular backups that don't require downtime.

 

Example (using RMAN):

 

RMAN> CONNECT TARGET /

RMAN> BACKUP DATABASE;

 

 Partial backup:

A partial backup is similar to a full database backup, but a it does not contain all the filegroups. It contains all the data in the primary filegroup, every read/write filegroup, and any optionally-specified read-only files.
A partial backup is any operating system backup short of a full backup, taken while the database is open or shut down

.
The following are all examples of partial database backups:
a. Backup of all datafiles for an individual tablespace.
b. Backup of a single datafile.
c. Backup of a control file.


They are only useful for a database operating in ARCHIVELOG mode, because an archived redo log is present, the datafiles restored from a partial backup can be made consistent with the rest of the database during recovery procedures.


Whole backup:

A whole backup in Oracle refers to a complete backup of the entire Oracle database. This type of backup captures all the data, schema objects, and other components of the database at a specific point in time, providing a comprehensive snapshot of the entire database.

Here are key points about a whole backup in Oracle:

Database Components: A whole backup includes all data files, control files, and archived redo logs. It provides a copy of the entire database, ensuring that all schema objects, user data, and database metadata are captured.

Consistency: A whole backup is typically taken in a consistent state of the database to ensure data integrity. This often involves putting the database in a quiescent state or using mechanisms like Oracle Recovery Manager (RMAN) to create a consistent backup.

Recovery Point: Whole backups serve as a baseline for recovery. In the event of a database failure or data loss, you can use a whole backup to restore the entire database to the state it was in at the time the backup was taken.

Backup Tools: The recommended tool for taking whole backups in Oracle is Oracle Recovery Manager (RMAN). RMAN provides a set of commands and features specifically designed for managing Oracle database backups, including whole backups.

Frequency: Whole backups are often taken periodically as part of a comprehensive backup strategy. The frequency of whole backups depends on factors such as the criticality of the data, the rate of changes in the database, and the organization's recovery objectives

RMAN> CONNECT TARGET /

RMAN> BACKUP DATABASE;

 

Physical Backup:

Physical backups are copies of the database files at the operating system level. They include data files, control files, and archived redo logs.

These backups are exact copies of the database's physical files, and they are typically used for disaster recovery and restoring the database to a specific point in time.

Physical backups are performed using tools like Oracle Recovery Manager (RMAN) and operating system utilities. RMAN, in particular, is the preferred method for creating physical backups as it provides more control and features for managing the backup and recovery process.

Physical backups are generally faster to create and restore compared to logical backups because they don't require SQL queries to recreate the database's structure.

 1.Connect to RMAN:

RMAN target /

2.Take Full Database Backup:

To perform a full database backup (including data files, control files, and archived redo logs), use the following RMAN command.

BACKUP DATABASE PLUS ARCHIVELOG;

 3. Optionally Specify Backup Location and Tag:

You can specify the location where the backup files should be stored and use a tag to identify the backup set:

BACKUP DATABASE PLUS ARCHIVELOG

  TAG 'Full_Backup'

  FORMAT '/path/to/backup/location/%U';

Logical backup:

A logical backup in Oracle involves capturing a logical representation of the database, such as the database schema, tables, views, and other database objects, rather than copying the physical database files. This type of backup is often performed using Oracle Data Pump or the traditional Export and Import utilities. Logical backups are human-readable and can be used to move data between different Oracle databases or to selectively export and import specific database object

 

Export (Logical Backup):

expdp   DIRECTORY=data_pump_dir  DUMPFILE=logical_backup.dmp SCHEMAS=schema_name

Import (Restore):

impdp username/password DIRECTORY=data_pump_dir DUMPFILE=logical_backup.dmp

 

 Rman Architecture

The Oracle Recovery Manager (RMAN) architecture is designed to provide a comprehensive and integrated solution for managing database backup and recovery operations in Oracle databases. The key components of the RMAN architecture include:

RMAN Client:

The RMAN client is the user interface through which database administrators interact with the RMAN utility. It can be a command-line interface or an interface provided by Oracle Enterprise Manager (EM) for RMAN.

Target Database:

 

The target database is the Oracle database that you want to perform backup and recovery operations on. RMAN interacts directly with the target database to execute backup and recovery commands.

Recovery Catalog (Optional):

The recovery catalog is an optional but recommended component. It is a separate schema within an Oracle database or a separate database altogether. The recovery catalog stores metadata and information about RMAN backups, making it independent of the control file.

Control File:

The control file is a critical component of the Oracle database that contains metadata about the database structure and configuration. RMAN uses information stored in the control file to track the status of backups and recovery operations.

Media Management Software:

The media management software is responsible for handling the physical I/O operations during backup and recovery, including reading and writing data to storage devices such as tape or disk. RMAN communicates with the media management software through the media management interface.

Media Management Interface:

The media management interface acts as a bridge between RMAN and the media management software. It facilitates communication and coordination of data transfer between RMAN and the storage devices.

Backup Sets and Pieces:

RMAN creates backups in the form of backup sets. A backup set is a logical grouping of backup data, and it consists of one or more physical files called pieces. Backup pieces are the individual files that store the actual backup data.

RMAN Repository:

The RMAN repository is a storage location within the control file or the recovery catalog. It stores metadata about RMAN backups, including information about backup sets, archived redo logs, and datafile copies.

Parallelization and Channels:

RMAN can take advantage of parallelization to improve backup and recovery performance. Parallelization is achieved through channels, where each channel represents a parallel process. The number of channels used is configurable.

Backup and Recovery Operations:

RMAN is capable of performing a variety of backup and recovery operations, including full database backups, incremental backups, datafile backups, and more. It supports point-in-time recovery and can recover databases to specific SCN (System Change Number) or timestamp.

Understanding the RMAN architecture is crucial for efficiently managing backup and recovery tasks in Oracle databases. It provides a centralized and integrated approach to ensure data protection and minimize downtime in the event of data loss or system failures.

 Flash Recovery Area :

FRA stands for Flash Recovery Area in Oracle Database. The Flash Recovery Area is a designated storage location that Oracle uses to store and manage backup and recovery-related files. It provides a centralized and automatic storage location for various database-related files, including backups, redo logs, and archived logs.

 

Here are key features and aspects of the Flash Recovery Area (FRA):

 

Automatic Management:

The FRA is designed to be managed automatically by Oracle. It simplifies backup and recovery operations by handling the creation, storage, and deletion of backup files and archived redo logs.

Backup and Recovery Files:

The FRA stores various types of files, such as RMAN backups, archived redo logs, control file copies, and datafile copies. These files are crucial for database backup and recovery operations.

Redundancy and Retention Policies:

The FRA allows you to specify redundancy and retention policies to manage the space used by backup and recovery files. You can configure how long files are retained, and Oracle will automatically delete files that are no longer needed based on your policies.

Automatic Log Archiving:

The FRA is often used for storing archived redo logs, which are critical for point-in-time recovery and maintaining a complete history of database changes. The automatic archiving of redo logs to the FRA ensures data integrity and recovery capabilities.

Simplified Backup and Recovery:

By using the FRA, you can simplify the backup and recovery process. Oracle automatically manages space and file maintenance in the FRA, reducing the need for manual intervention.

Initialization Parameters:

The initialization parameters related to the Flash Recovery Area include DB_RECOVERY_FILE_DEST (specifies the location of the FRA) and DB_RECOVERY_FILE_DEST_SIZE (sets the maximum size of the FRA).

Backup Destination for RMAN:

When using Oracle Recovery Manager (RMAN) for backups, you can direct RMAN to use the FRA as the destination for backups. This simplifies backup commands and ensures that backup files are stored in the FRA.

Backup Retention:

The FRA helps in managing backup retention and space usage. It automatically deletes obsolete backups and archived logs based on the retention policies you define.

Using the Flash Recovery Area is considered a best practice in Oracle database administration as it provides a centralized and organized approach to managing backup and recovery files, simplifying the administration of these critical operations.

 

 

When setting up the Flash Recovery Area (FRA) in Oracle and configuring backups, you typically need to perform several steps. The FRA is a designated storage location used by Oracle for backup and recovery-related files, including backups, archived redo logs, and other essential files. Here are the general steps to set up the FRA and configure backups:

 Configure Flash Recovery Area:

1.Option A: Use Oracle Enterprise Manager (EM):

2.Open Oracle Enterprise Manager in your web browser.

3.Navigate to "Database" and select your target database.

4.Go to the "Availability" tab and then "Recovery Settings."

5.Set the Flash Recovery Area location and size.

Connect to your Oracle database using SQL*Plus or another SQL client with DBA privileges.

Set the Flash Recovery Area location and size by running SQL commands:

ALTER SYSTEM SET DB_RECOVERY_FILE_DEST='/your/path/to/recovery_area' SCOPE=BOTH;

ALTER SYSTEM SET DB_RECOVERY_FILE_DEST_SIZE=10G SCOPE=BOTH; 

Enable Flash Recovery Area:

         ALTER SYSTEM SET DB_RECOVERY_FILE_DEST_SIZE=10 

         SCOPE=BOTH;

 



No comments:

Post a Comment

If you have any doubt or question, please contact us.