How to Resolve RMAN-06149: cannot BACKUP DATABASE in NOARCHIVELOG mode

  • by

RMAN-06149

Trying to backup a database in the development environment. But failed with "RMAN-06149: cannot BACKUP DATABASE in NOARCHIVELOG mode".

RMAN> backup database tag 'BEFORE-IMPORT-PRODUCTION-2018Q1';

Starting backup at 18-APR-18
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=352 device type=DISK
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of backup command at 04/18/2018 11:08:26
RMAN-06149: cannot BACKUP DATABASE in NOARCHIVELOG mode

What? I cannot backup database in NOARCHIVELOG mode? Oh, I forgot that I am in the development environment. Since the database is for development, it doesn't need high level protection on data, so I put it in NOARCHIVELOG mode on purpose.

Rationale

If we're in ARCHIVELOG mode, then we can backup the database with open READ WRITE. That is, we backup the database while it is running and changing every second. It results an inconsistent backup of data files inside. Even though, the gaps among data files in the backup can be filled by necessary archived logs, which turns this backup into a consistent one. So we don't have to worry about it. This is an effective backup.

Since we are in NOARCHIVELOG mode, there's no archived logs that can fill the inconsistent gaps. Hence, no consistent backups can be guaranteed when you backup the database with READ WRITE. Therefore, RMAN refuses such unreasonable backup.

Further reading about consistent backup can be found at: How to Make a Self-Contained and Consistent Full Backup Set

Solutions

You have several options to solve the problem:

  1. Switch to ARCHIVELOG mode, then backup database
  2. You have to shutdown the database and startup to mount state, then issue:

    SQL> shutdown immediate; SQL> startup mount; SQL> alter database archivelog; SQL> alter database open;

    Then, you can run whatever RMAN scripts you want. No more RMAN-06149: cannot BACKUP DATABASE in NOARCHIVELOG mode, because it has been switched to ARCHIVELOG mode.

    You can find out more Managing Archived Redo Log Files at Oracle documentation.

    But if you don't want to change NOARCHIVELOG mode, please continue reading the following two ways.

  3. Backup the database with READ ONLY
  4. You have to bounce the database server to read-only, then perform your backups.

    RMAN> shutdown immediate; RMAN> startup open read only; RMAN> backup database tag 'BEFORE-IMPORT-PRODUCTION-2018Q1';

    I have tried this solution. It works as I expected. The drawback is that you have to bounce the database again to bring the database back to READ WRITE. Which means, you have to bounce the database twice in this way, it may be a little annoying for your users.

    RMAN> shutdown immediate; RMAN> startup;
  5. Backup the database with MOUNT state
  6. Since the development database does not need any archived logs for easy maintenance, I choose to keep NOARCHIVELOG mode unchanged. Here I demonstrate how I implement this solution.

    First of all, bounce the database to MOUNT state. Please notice that all actions can be done in RMAN command prompt.

    RMAN> shutdown immediate;

    database closed
    database dismounted
    Oracle instance shut down

    RMAN> startup mount;

    connected to target database (not started)
    Oracle instance started
    database mounted

    Total System Global Area   20199768064 bytes

    Fixed Size                     3721224 bytes
    Variable Size              10133440504 bytes
    Database Buffers            9999220736 bytes
    Redo Buffers                  63385600 bytes

    Perform a database backup.

    RMAN> backup database tag 'BEFORE-IMPORT-PRODUCTION-2018Q1';

    Starting backup at 18-APR-18
    allocated channel: ORA_DISK_1
    channel ORA_DISK_1: SID=701 device type=DISK
    channel ORA_DISK_1: starting full datafile backup set
    channel ORA_DISK_1: specifying datafile(s) in backup set
    input datafile file number=00003 name=/oradata/ORCL/undotbs01.dbf
    input datafile file number=00002 name=/oradata/ORCL/sysaux01.dbf
    input datafile file number=00001 name=/oradata/ORCL/system01.dbf
    input datafile file number=00004 name=/oradata/ORCL/users01.dbf
    channel ORA_DISK_1: starting piece 1 at 18-APR-18
    ...
    RMAN> list backup of database summary;


    List of Backups
    ===============
    Key     TY LV S Device Type Completion Time #Pieces #Copies Compressed Tag
    ------- -- -- - ----------- --------------- ------- ------- ---------- ---
    ...
    87      B  F  A DISK        18-APR-18       1       1       NO         BEFORE-IMPORT-PRODUCTION-2018Q1

    Good! No more RMAN-06149: cannot BACKUP DATABASE in NOARCHIVELOG mode.

    Next, open the database

    RMAN> alter database open;

    Statement processed

  7. Hot BACKUP Mode
  8. If your database service can not be interrupted at this moment, you can enter BEGIN BACKUP mode in order to copy all data files as a database image for an alternative, which is a very different backup strategy from RMAN. For more cold backups, you can refer to: Are All Oracle Full Backups Consistent?

Leave a Reply

Your email address will not be published. Required fields are marked *