Skip to content

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

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? The database is 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.

Further reading: How Oracle Check Archivelog Mode.

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 were 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?

2 thoughts on “How to Resolve RMAN-06149: cannot BACKUP DATABASE in NOARCHIVELOG mode”

  1. In chapter 2, ‘startup open read only;’ did not work in my Oracle 21c in RMAN. But in SQL*Plus. So this worked for me:

    PS C:\Users\Dirk> sqlplus
    SQL*Plus: Release 21.0.0.0.0 - Production on Do Mai 19 11:33:15 2022
    Version 21.3.0.0.0
    Copyright (c) 1982, 2021, Oracle. All rights reserved.
    Benutzernamen eingeben: sys as sysdba
    Kennwort eingeben: ************
    Verbunden mit:
    Oracle Database 21c Express Edition Release 21.0.0.0.0 - Production
    Version 21.3.0.0.0
    SQL> shutdown immediate;
    Datenbank geschlossen.
    Datenbank dismounted.
    ORACLE-Instanz heruntergefahren.
    SQL> startup open read only;
    ORACLE-Instanz hochgefahren.
    Total System Global Area 1610608792 bytes
    Fixed Size 9855128 bytes
    Variable Size 905969664 bytes
    Database Buffers 687865856 bytes
    Redo Buffers 6918144 bytes
    Datenbank mounted.
    Datenbank geöffnet.
    SQL> exit
    Verbindung zu Oracle Database 21c Express Edition Release 21.0.0.0.0 - Production
    Version 21.3.0.0.0 beendet
    PS C:\Users\Dirk> rman
    Recovery Manager: Release 21.0.0.0.0 - Production on Do Mai 19 11:35:01 2022
    Version 21.3.0.0.0
    Copyright (c) 1982, 2021, Oracle and/or its affiliates. All rights reserved.
    RMAN> connect target /
    Mit Zieldatenbank verbunden: XE (DBID=2985372807)
    RMAN> backup database tag '19.05.2022 11:35';
    backup wird gestartet bei 19.05.22
    Kanal ORA_DISK_1 wird verwendet
    Kanal ORA_DISK_1: Vollständiges Backup Set für Datendatei wird begonnen
    Kanal ORA_DISK_1: Datendateien in Backup Set werden angegeben
    Dateinummer der Eingabedate=00012, Name=C:\APP\DIRK\PRODUCT\21C\ORADATA\XE\XEPDB1\USERS01.DBF
    Dateinummer der Eingabedate=00010, Name=C:\APP\DIRK\PRODUCT\21C\ORADATA\XE\XEPDB1\SYSAUX01.DBF
    Dateinummer der Eingabedate=00009, Name=C:\APP\DIRK\PRODUCT\21C\ORADATA\XE\XEPDB1\SYSTEM01.DBF
    Dateinummer der Eingabedate=00011, Name=C:\APP\DIRK\PRODUCT\21C\ORADATA\XE\XEPDB1\UNDOTBS01.DBF
    Kanal ORA_DISK_1: Piece 1 wird auf 19.05.22 begonnen
    Kanal ORA_DISK_1: Piece 1 auf 19.05.22 beendet
    Piece Handle=C:\APP\DIRK\PRODUCT\21C\DBHOMEXE\DATABASE\010TST0O_1_1_1, Tag=19.05.2022 11:35, Kommentar=NONE
    Kanal ORA_DISK_1: Backupset abgeschlossen, abgelaufene Zeit: 00:00:07
    Kanal ORA_DISK_1: Vollständiges Backup Set für Datendatei wird begonnen
    Kanal ORA_DISK_1: Datendateien in Backup Set werden angegeben
    Dateinummer der Eingabedate=00001, Name=C:\APP\DIRK\PRODUCT\21C\ORADATA\XE\SYSTEM01.DBF
    Dateinummer der Eingabedate=00003, Name=C:\APP\DIRK\PRODUCT\21C\ORADATA\XE\SYSAUX01.DBF
    Dateinummer der Eingabedate=00004, Name=C:\APP\DIRK\PRODUCT\21C\ORADATA\XE\UNDOTBS01.DBF
    Dateinummer der Eingabedate=00007, Name=C:\APP\DIRK\PRODUCT\21C\ORADATA\XE\USERS01.DBF
    Kanal ORA_DISK_1: Piece 1 wird auf 19.05.22 begonnen
    Kanal ORA_DISK_1: Piece 1 auf 19.05.22 beendet
    Piece Handle=C:\APP\DIRK\PRODUCT\21C\DBHOMEXE\DATABASE\020TST10_2_1_1, Tag=19.05.2022 11:35, Kommentar=NONE
    Kanal ORA_DISK_1: Backupset abgeschlossen, abgelaufene Zeit: 00:00:03
    Kanal ORA_DISK_1: Vollständiges Backup Set für Datendatei wird begonnen
    Kanal ORA_DISK_1: Datendateien in Backup Set werden angegeben
    Dateinummer der Eingabedate=00006, Name=C:\APP\DIRK\PRODUCT\21C\ORADATA\XE\PDBSEED\SYSAUX01.DBF
    Dateinummer der Eingabedate=00005, Name=C:\APP\DIRK\PRODUCT\21C\ORADATA\XE\PDBSEED\SYSTEM01.DBF
    Dateinummer der Eingabedate=00008, Name=C:\APP\DIRK\PRODUCT\21C\ORADATA\XE\PDBSEED\UNDOTBS01.DBF
    Kanal ORA_DISK_1: Piece 1 wird auf 19.05.22 begonnen
    Kanal ORA_DISK_1: Piece 1 auf 19.05.22 beendet
    Piece Handle=C:\APP\DIRK\PRODUCT\21C\DBHOMEXE\DATABASE\030TST13_3_1_1, Tag=19.05.2022 11:35, Kommentar=NONE
    Kanal ORA_DISK_1: Backupset abgeschlossen, abgelaufene Zeit: 00:00:01
    backup wurde beendet bei 19.05.22
    Control File and SPFILE Autobackup wird gestartet bei 19.05.22
    Piece Handle=C:\APP\DIRK\PRODUCT\21C\DBHOMEXE\DATABASE\C-2985372807-20220519-00, Kommentar=NONE
    Control File and SPFILE Autobackup wurde beendet bei 19.05.22
    RMAN> shutdown immediate;
    Kontrolldatei der Zieldatenbank wird anstelle des Recovery-Katalogs verwendet
    Datenbank geschlossen
    Datenbank nicht angeschlossen
    Oracle-Instanz heruntergefahren
    RMAN> startup;
    mit Zieldatenbank verbunden (nicht gestartet)
    Oracle-Instanz gestartet
    Datenbank angeschlossen
    Datenbank geöffnet
    Gesamte System Global Area 1610608792 Byte
    Fixed Size 9855128 Byte
    Variable Size 905969664 Byte
    Database Buffers 687865856 Byte
    Redo Buffers 6918144 Byte
    RMAN> exit
    PS C:\Users\Dirk>

Leave a Reply

Your email address will not be published.