Using Oracle Backup with RMAN (Consistent and Inconsistent)

Recovery Manager (RMAN) is a powerful database backup and recover tool provided by Oracle.


Let's understand a little about some concepts of Backup, we can say that we have two types of backups, those that are consistent and those that are inconsistent.



Consistent RMAN Backups


Consistent Backup: These are those where we must stop the Banco de Bados completely, leaving it turned off until the end of the backup. This method means that you can open the Bank and restore it without performing the recovery action on the media, with the result that the backup does not save the transactions that occurred after the backup was created.


It is generally used when a database does not undergo many changes during its work.

Backup can be done as follows:

Enter RMAN:

rman target / 

We will have to interrupt the Database, so be careful not to do it at the time you are working or making transactions in the instance.

RMAN>shutdown immediate;

Place the database in the mount state;

RMAN>startup mount;

Now let's do the full backup;

RMAN> backup database; 

Full backup performed successfully, to see the backups made and just list.

RMAN> list backup;

NOTE: If you want to do a PDB backup in NOARCHIVELOG mode this is not allowed. The following error RMAN-06817 will appear: Pluggable Database backups are not allowed when the Database is in NOARCHIVELOG mode. Close the container database and perform a full backup using the BACKUP DATABASE command.


Inconsistent RMAN Backups


All backups that are not consistent, Oracle considers inconsistent, that is, Backup with the Database open, performed after a failure in the instance and the use of the shutdown abort.

Inconsistent backup, cannot be in NOARCHIVELOG mode, we must change the database to ARCHIVELOG mode.


Database changed to ARCHIVELOG;


Use SQLPLUS to make the change;

sqlplus / as sysdba

Let's see the status of the database with the following command:

SQL>  archive log list;
Database log mode                  No Archive Mode
Automatic archival                 Disabled
Archive destination                USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence         6
Current log sequence               8
SQL> 

Automatic archival is Disabled. We make changes with the following commands.


We will stop the Database, to change the parameter (Automatic archival), the actions must be done in MOUNT mode.

SQL>shutdown immediate;

Place the database in the mount state;

SQL> startup mount;

Enabling the archivelog;

SQL> alter database archivelog;
Database altered.

We list it again with the archive log list command, and it is already in the Enabled state;

SQL> archive log list;
Database log mode              Archive Mode
Automatic archival             Enabled
Archive destination            USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence     6
Next log sequence to archive   8
Current log sequence           8
SQL>

Now we just need to put the Database open for use;

SQL> alter database open;
Database altered.

We will initialize all existing PDBS in your CDB.

SQL> alter pluggable database all open;
Pluggable database altered.

Starting a Backup in RMAN ARCHIVELOG (Inconsistent).


Enter RMAN:

rman target /

To take a full backup of the database with the archive logs, do the following:

RMAN> backup database plus archivelog;

RMAN> list backup;

Your Backup full archivelog was done successfully!