This topic describes preparations for the physical backup of an Oracle database. Before you perform the physical backup of an Oracle database, you must enable the archive mode of the Oracle database, obtain the Oracle System ID (SID), and query the database program directory.

Enable the archive mode

You can use the Recovery Manager (RMAN) tool to back up an Oracle database. By default, the archive mode of an Oracle database is disabled. You must enable it first.
  1. Log on to the Oracle database as the sysdba user.
  2. Execute the ARCHIVE LOG LIST statement to query the archive status of the current database. A similar output is displayed:
    Database log mode              No Archive Mode  # The archive mode is disabled.
    Automatic archival             Disabled
    Archive destination            USE_DB_RECOVERY_FILE_DEST  
    Oldest online log sequence     1    
    Current log sequence           2  
    Note If Archive Mode is returned for the Database log mode parameter, the archive mode is enabled. You can stop the Enable the archive mode operation here.
  3. Execute the SHUTDOWN IMMEDIATE statement to shut down the database because you cannot enable the archive mode when the database is in the OPEN state.
    Warning We recommend that you perform this step during off-peak hours.
  4. Execute the STARTUP MOUNT statement to turn the database to the MOUNT state.
  5. Execute the ALTER DATABASE ARCHIVELOG statement to enable the archive mode.
  6. Execute the ARCHIVE LOG LIST statement again to query the archive status. A similar output is displayed:
    Database log mode             Archive Mode # The archive mode is enabled.
    Automatic archival           Enabled 
    Archive destination          USE_DB_RECOVERY_FILE_DEST 
    Oldest online log sequence  1
    Next log sequence to archive 2 
    Currentlog sequence         2
    Note After the archive mode is enabled, the default log archive path for an Oracle database is $ORACLE_BASE/fast_recovery_area. This directory has only 4 GB of space by default and is also the default path for backup files and flashback logs. To prevent the insufficient space of this directory from causing database exceptions, you can adjust the size of the directory or change the log archive path.
  7. Execute the ALTER DATABASE OPEN statement to start the database.

Obtain the Oracle SID

  • Linux
    Run the following command:
    ps -ef | grep ora_pmon_ | grep -v grep | awk -F "ora_pmon_" '{print "oracle sid: "$NF }' | grep -v print
    The following output indicates that the Oracle SID is orcl:
    oracle sid: orcl
  • Windows
    Run the following command in cmd:
    sc query type=service | findstr SERVICE_NAME | findstr OracleService
    The following output indicates that the Oracle SID is orcl:
    SERVICE_NAME: OracleServiceORCL

Obtain the database program directory

The database program directory is the path of ORACLE_HOME.
  1. Run the su - oracle command in cmd to log on to the Oracle database.
  2. Execute the echo ORACLE_HOME statement on the Oracle database to view the path of ORACLE_HOME.
    The following output indicates that the path of ORACLE_HOME is /opt/oracle/product/19c/dbhome_1:
    ====================
    /opt/oracle/product/19c/dbhome_1
    ====================

Query the locations of files in an Oracle RAC environment

To perform a successful backup, you must check the control files, SPFILEs, data files, archived log files, and redo log files of Oracle Real Application Clusters (RAC) databases before you back up the data. The following operations are inapplicable to Oracle databases of other architectures.

The following sample code provides examples:

  • To query the locations of redo log files, execute the following statement:
    SELECT member FROM v$logfile WHERE type='ONLINE';
    The following figure shows a similar output. Each MEMBER entry starts with +. DBSBAKDAT1DG indicates the name of the Automatic Storage Management (ASM)-based database that is used to manage the files in the current Oracle RAC environment.
  • To query the locations of archived log files, execute the following SQL statement:
    SELECT name FROM v$archived_log WHERE DELETED='NO';
    The following figure shows a similar output.Each NAME entry starts with +. DBSBAKDAT1DG indicates the name of the ASM-based database that is used to manage the files in the current Oracle RAC environment.
  • To query the locations of data files, execute the following statement:
    SELECT name FROM v$datafile;
    The following figure shows a similar output. Each VALUE entry starts with +. DBSBAKDAT1DG indicates the name of the ASM-based database that is used to manage the files in the current Oracle RAC environment.
  • To query the locations of SPFILEs, execute the following statement:
    SHOW parameter spfile;
    The following figure shows a similar output. Each VALUE entry starts with +. DBSBAKDAT1DG indicates the name of the ASM-based database that is used to manage the files in the current Oracle RAC environment.
  • To query the locations of control files, execute the following statement:
    SELECT member FROM v$logfile WHERE type='ONLINE';
    The following figure shows a similar output.Each VALUE entry starts with +. DBSBAKDAT1DG indicates the name of the ASM-based database that is used to manage the files in the current Oracle RAC environment.