This topic describes the preparations that you must make before you back up an Oracle database. You need to enable the archive mode for the Oracle database, obtain the system ID (SID) of the Oracle database, and obtain the directory in which the Oracle database is installed.
Prerequisites
You are a database administrator (DBA).
Enable the archive mode
DBS uses the Recovery Manager (RMAN) tool to back up data in Oracle databases. By default, the archive mode of an Oracle database is disabled. You must manually enable the archive mode before you back up data in the database.
Run the
as sysdba
command to log on to the Oracle database as the system administrator.Execute the
ARCHIVE LOG LIST
statement to query the status of the archive mode of the database. The following output is returned: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
NoteIf
Archive 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.If the archive mode is disabled, 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.WarningWe recommend that you perform this step during off-peak hours.
Execute the
STARTUP MOUNT
statement. After the statement is executed, 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 output is returned:Databaselog 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
NoteThe default path for archiving log files of the Oracle database is $ORACLE_BASE/fast_recovery_area. By default, this directory contains only a space of 4 GB. The directory is also the default path for storing 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 archiving log files based on your business requirements.
Execute the
ALTER DATABASE OPEN
statement to start the Oracle database.
Obtain the SID of an Oracle database
Linux
Run the following command to obtain the SID of an Oracle database that is running from the system process information:
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 the Windows CLI to obtain the SID and service name of an Oracle database:
sc query type=service | findstr SERVICE_NAME | findstr OracleService
The following output indicates that the SID of the Oracle instance is
orcl
and the service name isOracleServiceORCL
:SERVICE_NAME: OracleServiceORCL
Obtain the directory in which an Oracle database is installed
ORACLE_HOME
specifies the directory in which an Oracle database is installed.
Run the
su - oracle
command in the CLI to log on to the Oracle database.Execute the
echo ORACLE_HOME
statement on the Oracle database to obtain the value ofORACLE_HOME
.The following output indicates that the value of
ORACLE_HOME
is/opt/oracle/product/19c/dbhome_1
:/opt/oracle/product/19c/dbhome_1
Query the 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, 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. Examples:
Query redo log files
SELECT member FROM v$logfile WHERE type='ONLINE';
The following figure shows the sample output.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.Query archived log files
SELECT name FROM v$archived_log WHERE DELETED='NO';
The following figure shows the sample output.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.Query data files
SELECT name FROM v$datafile;
The following figure shows the sample output.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.Query server parameter files
SHOW parameter spfile;
The following figure shows the sample output.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.Query control files
SHOW parameter control_files;
The following figure shows the sample output.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.