This topic describes the operations that you must perform before you perform physical backup tasks for an Oracle database. The required operations include enabling the archive mode for the Oracle database, obtaining the system ID (SID) of the Oracle database, and obtaining the directory in which the Oracle database client is installed.
Prerequisites
The database administrator (DBA) permissions are granted to you.Enable the archive mode
- Run the
as sysdba
command to log on to the Oracle database as the system administrator of the database. - Execute the
ARCHIVE LOG LIST
statement to query the status of the archive mode of the database. The following sample code shows a sample response: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 IfArchive Mode
is returned as the value of theDatabase log mode
parameter, the archive mode is enabled. In this case, you do not need to enable the archive mode again. For information about how to enable the archive mode for an Oracle database, see Enable the archive mode. - Execute the
SHUTDOWN IMMEDIATE
statement to shut down the Oracle database. If the Oracle database is in theOPEN
state, you cannot enable the archive mode for the Oracle database.Warning We recommend that you perform this step during off-peak hours. - Execute the
STARTUP MOUNT
statement. After this operation is completed, the database is in the MOUNT state. - Execute the
ALTER DATABASE ARCHIVELOG
statement to enable the archive mode. - Execute the
ARCHIVE LOG LIST
statement again to query the status of the archive mode. The following sample code shows a sample response: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 you enable the archive mode, the default path for archived log files of the Oracle database is $ORACLE_BASE/fast_recovery_area. This directory contains only 4 GB of space by default. The same directory is also the default path for backup files and log files of flashback operations. If the space of the directory becomes insufficient, the database service is interrupted. To ensure sufficient space for files, you can change the size of the directory to a greater value or change the path for archived log files. - Execute the
ALTER DATABASE OPEN
statement to start the Oracle database.
Obtain the SID of the Oracle database
- LinuxRun the following command:
ps -ef | grep ora_pmon_ | grep -v grep | awk -F "ora_pmon_" '{print "oracle sid: "$NF }' | grep -v print
In the following sample response, the SID of the Oracle database isorcl
:oracle sid: orcl
- WindowsRun the following command in the CLI:
sc query type=service | findstr SERVICE_NAME | findstr OracleService
In the following sample response, the SID of the Oracle database isorcl
:SERVICE_NAME: OracleServiceORCL
Obtain the directory in which the database client is installed
ORACLE_HOME
specifies the directory in which the Oracle database client is installed. - Run the
su - oracle
command to log on to the Oracle database. - Execute the
echo ORACLE_HOME
statement on the Oracle database to obtain the value ofORACLE_HOME
.In the following sample response, the value ofORACLE_HOME
is/opt/oracle/product/19c/dbhome_1
:==================== /opt/oracle/product/19c/dbhome_1 ====================
Query the locations of files in an Oracle RAC database
To ensure that data in an Oracle database that is in the Real Application Clusters (RAC) architecture can be backed up, you must check the control files, server parameter files (SPFILEs), data files, archived log files, and redo log files of the database before you back up data. If your Oracle database is not in the RAC architecture, the following operations are not required.
Sample requests and sample responses:
- To query the locations of redo log files, execute the following statement:
SELECT member FROM v$logfile WHERE type='ONLINE';
Sample response:Each MEMBER entry starts with a plus sign (
+
).DBSBAKDAT1DG
indicates the name of the automatic storage management (ASM)-based database that is used to store files for your RAC database. - To query the locations of archived log files, execute the following SQL statement:
SELECT name FROM v$archived_log WHERE DELETED='NO';
Sample response:Each NAME entry starts with a plus sign (
+
).DBSBAKDAT1DG
indicates the name of the ASM-based database that is used to store files for your RAC database. - To query the locations of data files, execute the following statement:
SELECT name FROM v$datafile;
Sample response:Each VALUE entry starts with a plus sign (
+
).DBSBAKDAT1DG
indicates the name of the ASM-based database that is used to store files for your RAC database. - To query the locations of SPFILEs, execute the following statement:
SHOW parameter spfile;
Sample response:Each VALUE entry starts with a plus sign (
+
).DBSBAKDAT1DG
indicates the name of the ASM-based database that is used to store files for your RAC database. - To query the locations of control files, execute the following statement:
SELECT member FROM v$logfile WHERE type='ONLINE';
Sample response:Each VALUE entry starts with a plus sign (
+
).DBSBAKDAT1DG
indicates the name of the ASM-based database that is used to store files for your RAC database.