oracle archive mode

The Oracle database has an online redo log, which records the modifications made to the database, such as inserting, deleting, updating data, etc. These operations will be recorded in the online redo log.

What is Oracle Archive Modeedit

The Oracle database has an online redo log, which records the modifications made to the database, such as inserting, deleting, updating data, etc. These operations will be recorded in the online redo log. A general database must have at least 2 online redo log groups . When an online redo log group is full, log switching will occur. At this time, online redo log group 2 becomes the currently used log. When online redo log group 2 is full, log switching will occur again. , to write online redo log group 1, and so on.
If the database is in non-archive mode, the online log will be discarded when switching. In archive mode, when a log switch occurs, the switched log will be archived. For example, online redo log 1 is currently being used. When log 1 is full, log switching occurs, and online redo log 2 starts to be written. At this time, the content of online redo log 1 will be copied to another specified directory. This directory is called the archive directory, and the copied files are called archived redo logs.
Disaster recovery is only possible when the database is running in archive mode.
1. The difference between archive log mode and non- archive log mode
The non-archive mode can only do cold backups , and can only do full backups during recovery. The data from the last full backup to the system failure period cannot be recovered.
Archive mode can do hot backup , incremental backup , and partial recovery.
Use ARCHIVE LOG LIST to see if the current schema state is archived or non-archived.

oracle archive mode configuration database archive mode

edit
1. Change non-archive mode to archive mode:
1) SQL> conn / as sysdba (connect to database as DBA)
2)SQL> shutdown immediate; (close the database immediately)
3) SQL> startup mount (starts the instance and loads the database, but does not open)
4) SQL> alter database archivelog; (change the database to archive mode)
5) SQL> alter database open; (open the database)
6) SQL> alter system archive log start; (enable automatic archiving)
7) SQL> exit (exit)
Do a full backup, because the backup log generated in non-archive log mode is no longer available for archive mode. This step is not very important!
2. Change archive mode to non-archive mode:
1)SQL>SHUTDOWN NORMAL/IMMEDIATE;
2)SQL>STARTUP MOUNT;
3)SQL>ALTER DATABASE NOARCHIVELOG;
4)SQL>ALTER DATABASE OPEN;
3. Enable automatic archiving: LOG_ARCHIVE_START=TRUE
In archive mode, the log file group is not allowed to be overwritten (rewritten). When the log file is full, if no manual archive is performed, the system will suspend until the archive is completed.
At this time, you can only read and not write.
Shutting down and restarting the archive log process while it is running
SQL>ARCHIVE LOG STOP
SQL>ARCHIVE LOG START
4. Manual archive: LOG_ARCHIVE_START=FALSE
Archive the current log file
SQL>ALTER SYSTEM ARCHIVE LOG CURRENT;
Archive log file with sequence number 052
SQL>ALTER SYSTEM ARCHIVE LOG SEQUENCE 052;
Archive all log files
SQL>ALTER SYSTEM ARCHIVE LOG ALL;
Change archive log destination
SQL>ALTER SYSTEM ARCHIVE LOG CURRENT TO '&PATH';
5. Conversion between archive mode and non-archive mode
Reverse process of step 4.
6. Configure multiple archiving processes
Q: When do you need to use multiple archiving processes?
A: If the archiving process consumes a lot of time, you can start multiple archiving processes. This is a dynamic parameter that can be dynamically modified with ALTER SYSTEM.
SQL>ALTER SYSTEM SET LOG_ARCHIVE_MAX_PROCESSES=10;
Up to 10 archiving processes can be specified in Oracle9i
Dynamic performance view related to archiving process
v$bgprocess,v$archive_processes
7. Configure archive target, multiple archive target, remote archive target, archive log format
Archive destination LOG_ARCHIVE_DEST_n
Local archive target:
SQL>LOG_ARCHIVE_DEST_1 = "LOCATION=D:ORACLEARCHIVEDLOG";
Remote Archive Target:
SQL>LOG_ARCHIVE_DEST_2 = "SERVICE=STANDBY_DB1";
Forced archive target, if error, retry after 600 seconds:
SQL>ALTER SYSTEM SET LOG_ARCHIVE_DEST_4 = "LOCATION=E:ORACLEARCHIVEDLOG MANDATORY REOPEN=600";
Optional archive destination, to discard archive if error occurs:
SQL>ALTER SYSTEM SET LOG_ARCHIVE_DEST_3 = "LOCATION=E:ORACLEARCHIVEDLOG OPTIONAL";
Archive Target Status: Close Archive Target and Open Archive Target
close archive target 1
SQL>ALTER SYSTEM SET LOG_ARCHIVE_DEST_STATE_1 = DEFER
open archive target 2
SQL>ALTER SYSTEM SET LOG_ARCHIVE_DEST_STATE_2 = ENABLE
Archive log format
LOG_ARCHIVE_FORMAT
8. Get archive log information
V$ARCHIVED_LOG
V$ARCHIVE_DEST
V$LOG_HISTORY
V$DATABASE
V$ARCHIVE_PROCESSES
ARCHIVE LOG LIST;

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326864624&siteId=291194637