Oracle Archiving and non-archival mode

Source: Internet
Author: User

I. What is Oracle archive mode

The Oracle database has an online redo log, which records changes made to the database, such as inserting, deleting, updating data, etc., which are recorded in the online redo log. A generic database must have at least 2 online redo log groups. When an online redo log group is written full, a log switch occurs, the online redo log Group 2 becomes the currently used log, when the online redo log Group 2 is full, the log switch, to write online redo log Group 1, so repeated.

If the database is in non-archive mode, the online log is discarded when it switches. In archive mode, when a log switch occurs, the log that is toggled is archived. For example, in the current use of online redo log 1, when 1 is full, a log switch occurs, start to write online redo log 2, the contents 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 archive redo logs.

A database can be run with an archive for catastrophic recovery. The differences between the archive log mode and the non-archived log mode are as follows:

Non-archive mode only makes cold backups, and only full backups can be made when recovering. Data cannot be recovered during the last full backup to system error.

Archive mode can do hot backup, and can do incremental backup, can do partial recovery.

Second, check whether the Oracle database is an archive mode

1 Select  from v$database; 2 log list;

Third, the archiving mode of the configuration database

1. Non-archive to archive mode

1 SHUTDOWNIMMEDIATE; Close the data first2 STARTUP MOUNT; Start the DB instance to mount state, but do not open3 ALTER DATABASEARCHIVELOG; Setting the database to archive log mode4 ALTER DATABASE OPEN; Open Database5ArchiveLoglist; Confirm that the database is now in archive log mode6ArchiveLog  All; Archive the online redo log at this point in time7 AlterTablespace usersbeginBacup;
Do a full backup because the backup log generated in non-archived log mode is not available for the archive mode. This step is not very important!

2. Enable automatic archiving

1 log_archive_start=TRUE
In the archive mode, the log file group is not allowed to be overwritten (rewritten), after the journal file is full, if not manually archived, then the system will hang until the archive is complete, it can only read and not write, it needs to open the automatic archive.

3. Manual archiving

1Log_archive_start=FALSE2 ALTERSYSTEM ARCHIVELOG  Current; Archive the current log file3 ALTERSYSTEM ARCHIVELOGSEQUENCE052; Log file with the archive ordinal 0524 ALTERSYSTEM ARCHIVELOG  All; Archive all log Files5 ALTERSYSTEM ARCHIVELOG  Current  to '&path'; Change the archive log target

4. Shutting down and starting the archive log process during operation

1 LOG STOP 2 LOG START

5. Configuring multiple Archive processes

Q: When do I need to use multiple archive processes?

A: If the archive process consumes a lot of time, you can start multiple archive processes, which are dynamic parameters that can be modified dynamically with alter system.

1 ALTER SET Log_archive_max_processes=ten;

Up to 10 archive processes can be specified in oracle9i, and dynamic performance views related to the archive process are v$bgprocess,v$archive_processes

6. Configure archive target, multi-archive target, remote archive target, archive log format

Archive target: Log_archive_dest_n

1Log_archive_dest_1="Location=D:oraclearchivedlog "; Local archive Destination2Log_archive_dest_2=The SERVICE=STANDBY_DB1 "; Remote Archive Destination3 ALTERSYSTEMSETLog_archive_dest_4="Location=E:oraclearchivedlog MANDATORY REOPEN= -"; Mandatory archive target, if error, retry after 600 seconds4 ALTERSYSTEMSETLog_archive_dest_3="Location=E:oraclearchivedlog OPTIONAL "; Optional archive target, if an error occurs, discard the archive

Archive target status: Close archive target and open archive target

1 ALTER SET = DEFER Closing archive target 1 2 ALTER SET = ENABLE    Open Archive target 2

Archive log Format: Log_archive_format

6. Get archived Log information

1 V$archvied_log 2 v$archvie_dest 3 v$log_history 4 v$DATABASE5v$archive_processes6LOG LIST;

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.