【ORACLE】 Enable archiving mode

(1) Check if the database is in archive mode

SQL> archive log list;
Database log mode              No Archive Mode
Automatic archival             Disabled
Archive destination            USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence     8
Current log sequence           10

(B) Close the database, start the database to the MOUNT state

SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> exit

SQL> startup mount
ORACLE instance started.

Total System Global Area 754974720 bytes
Fixed Size 2928968 bytes
Variable Size 570429112 bytes
Database Buffers 176160768 bytes
Ready Buffers 5455872 bytes
Database mounted.

(3) Open the archive and start the database

SQL> alter database archivelog;

Database altered.

SQL> alter database open;

Database altered.

(4) Check if the database is in archive mode

SQL> archive log list;
Database log mode             Archive Mode
Automatic archival            Enabled
Archive destination           USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence     8
Next log sequence to archive   10
Current log sequence           10

(5) Archive log directory

SQL> show parameter DB_RECOVERY_FILE_DEST
 
NAME TYPE VALUE
 ------------------------------------ ------ ----- ------------------------------ 
db_recovery_file_dest                   string        / usr / oracle / fast_recovery_area 
db_recovery_file_dest_size big integer 4560M 

PS: default Use the flash recovery area to store archived logs.

(6) Modify the archive log storage directory

SQL> alter system set log_archive_dest_1='location=/home/oracle/archivelog';
System altered.

SQL> archive log list;
Database log mode             Archive Mode
Automatic archival             Enabled
Archive destination            /home/oracle/archivelog
Oldest online log sequence     8
Next log sequence to archive   10
Current log sequence           10

 

The differences between DB_RECOVERY_FILE_DEST, LOG_ARCHIVE_DEST, and LOG_ARCHIVE_DEST_n are described as follows: DB_RECOVERY_FILE_DEST : Specify the path to the flash recovery area. LOG_ARCHIVE_DEST : Specify the path where the archive file is stored. This path can only be the local disk, and the default is ''. LOG_ARCHIVE_DEST_n : The default value is ''. Oracle supports up to 10 log files to be archived, n from 1 to 10. The archive address can be a local disk or a network device. The relationship between the three:









 1.If DB_RECOVERY_FILE_DEST is set, LOG_ARCHIVE_DEST cannot be set. The default archive log is stored in the flash recovery area specified by DB_RECOVERY_FILE_DEST. You can set LOG_ARCHIVE_DEST_n. If so, the archive logs are no longer stored in DB_RECOVERY_FILE_DEST, but in the directory set by LOG_ARCHIVE_DEST_n. 
  If you want to keep the archive logs in DB_RECOVERY_FILE_DEST, you can use the following command: alter systemsetlog_archive_dest_1 = 'location =USE_DB_RECOVERY_FILE_DEST'; 2If LOG_ARCHIVE_DEST is set, LOG_ARCHIVE_DEST_n and DB_RECOVERY_FILE_DEST cannot be set. If LOG_ARCHIVE_DEST_n is set, LOG_ARCHIVE_DEST cannot be set. In other words, the LOG_ARCHIVE_DEST parameter and DB_RECOVERY_FILE_DEST, LOG_ARCHIVE_DEST_n will not coexist. DB_RECOVERY_FILE_DEST and LOG_ARCHIVE_DEST_n can coexist. 3. LOG_ARCHIVE_DEST can only coexist with LOG_ARCHIVE_DUPLEX_DEST . In this way, two archive paths can be set. LOG_ARCHIVE_DEST sets a primary archive path, LOG_ARCHIVE_DUPLEX_DEST sets a secondary archive path. All archive paths must be local . 4. If the path set by LOG_ARCHIVE_DEST_n is not correct, then Oracle will archive in the upper-level directory set.

 

Guess you like

Origin www.cnblogs.com/CL-learning/p/12722351.html