Home Database Tips How to Take Oracle Database Backup Step by Step with RMAN?

How to Take Oracle Database Backup Step by Step with RMAN?

2022-09-27 | Iris Lee

Table of contents
  • Oracle Backup Solutions
  • RMAN Backup Types
  • How to Back up Oracle Database Using RMAN?
  • Vinchin Automatic Oracle Database Backup
  • Conclusion

未标题-2.jpg

Oracle Database is a scalable, multi-model relational database management system (RDBMS) developed and supported by Oracle Corporation. As the most popular database worldwide according to Statista, Oracle database is widely used among global organizations. And certainly, its backup gets a huge amount of attention considering the importance of database backup for companies.

Oracle Backup Solutions

Typically, there are 2 ways in Oracle to back up the database, which are:

 1.     Oracle Recovery Manager (RMAN): A program built into Oracle databases to perform database backup and recovery operations.

2.     User Managed: Manual way of database backup by running SQL Plus commands and host operating commands specific to the users’ OS.

RMAN comes out on top among the two options because the method provides a single common interface to back up Oracle databases automatically across different operating systems, making the backup process user-friendly and easy. Thus, I’ll introduce mainly how to backup Oracle database with RMAN step by step in this blog.

RMAN Backup Types

There are multiple Oracle backup types in the database backup strategy, and to effectively use them, let’s get to know its types before we dive deeply into the database backup steps.

Full Backup: A backup that stores all of the file’s data block into the image copy or used data block into the backup set, neither of them cannot be used as the parent or a part of a subsequent incremental backup.

Incremental Backup (Level 0/1 Backup): A incremental backup falls into 2 categories: level 0 backup that contains used data block in the file, or a level 1 backup that stores changed data blocks since the parent backup was taken. Level 0 backup serves as the parent for a level 1 backup.

Multilevel Incremental Backups:

Differential Backup (Level 0/1 Incremental Backup): The default type of incremental backup that backs up all blocks modified since the last incremental backup at level 0 or 1.

Cumulative Backup (Level 0 Incremental Backup): Backs up all blocks modified since the last backup at level 0.

How to Back up Oracle Database Using RMAN?

1.     Start RMAN and connect it to an Oracle DB.

Connect to an Oracle database with “connect target” command.

% rman

RMAN> CONNECT TARGET Example

target database Password: password

connected to target database: Example (DBID=00000000)

2.     Show the current RMAN configurations and change some parameters.

Run the “show all” command to view configurations.

RMAN> SHOW ALL

Change parameters as you wanted.

Change backup location:

RMAN> CONFIGURE CHANNEL DEVICE TYPE DISK FORMAT '/changed backup/location _%t_%s_%p ';

Specify retention time:

RMAN> CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF XX DAYS;

Compress the backup sets:

CONFIGURE DEVICE TYPE DISK/sbt BACKUP TYPE TO COMPRESSED BACKUPSET;

You can verify those changes by executing the “show all” command and add the “CLEAR” to the end of configuration command lines to restore default settings if you want.

3.     Backup Oracle databases.

1)      You can take an Oracle backup to backup set or image copy format, and it is recommended to use the former because only RMAN can access the format.

2)      Make sure the Oracle database is running before you enter the RMAN commands.

Full backup without the archive logs:

RMAN> BACKUP AS BACKUPSET DATABASE

Backup archived redo logs while the Oracle DB is open:

RMAN> BACKUP AS BACKUPSET DATABASE PLUS ARCHIVELOG;

Backup tablespace only:

RMAN> BACKUP AS BACKUPSET TABLESPACE;

Incremental backups of the database:

Create a level 0 incremental backup as the base:

BACKUP INCREMENTAL LEVEL 0 DATABASE;

Create a level 1 cumulative incremental backup:

BACKUP INCREMENTAL LEVEL 1 CUMULATIVE DATABASE;

Create a level 1 differential incremental backup:

BACKUP INCREMENTAL LEVEL 1 DATABASE; 

Implement incrementally updated backups:

It is an incremental backup strategy based on a level 0 datafile copy.

RECOVER COPY OF DATABASE

  WITH TAG 'incr_update';

BACKUP

  INCREMENTAL LEVEL 1

  FOR RECOVER OF COPY WITH TAG 'incr_update'

  DATABASE;

To see the RMAN backup files, add “Is” before on the created directory; and to see all the files, use “LIST” command at the RMAN prompt.

4.     Assign backup tags to manage.

RMAN> BACKUP AS BACKUPSET TAG 'TAGNAME' TABLESPACE DBNAME;

 5.     Compress the RMAN backup.

RMAN> BACKUP AS COMPRESSED BACKUPSET TAG 'TAGNAME' TABLESPACE DBNAME;

Despite the convenience of backing up using Oracle RMAN, the tool also comes with quite a few questions, for instance, maintaining and managing multiple databases can be challenging; the overhead generated from separate instance catalog machines and high-consumption regular backups will degrade the database performance.

Vinchin Automatic Oracle Database Backup

Vinchin Backup & Recovery is a comprehensive and compatible virtual machine and database protection solution that supports the backup and recovery of Oracle, MySQL, SQL Server, MariaDB, Postgres Pro, and PostgreSQL .

image.png

Automatic Oracle DB Backup: Vinchin Backup & Recovery automates Oracle database backup with detailed backup schedules running at set time points and email notifications that send alerts to subscribers should any pre-set scenarios happen, such as the storage shortage.

Smart and Flexible Backup Strategies: Choose full backup, incremental backup, differential backup, and archive log backup by simply checking the boxes without complicated command lines, and keep the data based on the number of restore points/days. You can also enable the encrypted transmission to encrypt the backup data for safe data transfer.

Saving Backup Storage: Reduce nearly 70% of the database backup without taking up the production environment CPU by turning on data reception technologies and Oracle database compression, which greatly enhances backup efficiency and storage utilization.

Anti-Ransomware Backup Protection: The I/O detector of the solution only allows the Vinchin applications to modify data, and any other suspicious visits will be rejected to protect backups in the Vinchin server.

Advanced Oracle Support: Vinchin Backup & Recovery allows for faster multi-threading transmission and streamlined RAC backup node authorization for Oracle users with a centralized management console for all database tasks.

Vinchin Backup & Recovery simplifies Oracle backup within 3 steps after the database backup preparation, you can download the 60-day free trial of the solution now below to explore more.


Conclusion


There are three ways for the Oracle backup: built-in RMAN, manual commands, or a smart database backup solution Vinchin Backup & Recovery integrates with backup and recovery for 12 virtualizations, physical servers, and NAS. The former two involve tricky command lines and lack automation. You can choose the Vinchin solution for your unattended Oracle database backup and secure all backups with the anti-ransomware IO monitor of it.

Share on:

Categories: Database Tips