The difference between Oracle Archive mode and non-archive mode

Source: Internet
Author: User

One. To see if the Oracle database is in archive mode:

SQL code
1.select Name,log_mode from V$database;
NAME Log_mode
------------------ ------------------------
QUERY Noarchivelog
2. Using the archive LOG LIST command
Database log mode No Archive mode
Automatic Archival Disabled
Archive Destination/data/oracle/product/10.2.0/db_1//dbs/arch
Oldest online log sequence 739
Current log sequence 741
[SQL] View plaincopyprint?
1.select Name,log_mode from V$database;
NAME Log_mode
------------------ ------------------------
QUERY Noarchivelog
2. Using the archive LOG LIST command
Database log mode No Archive mode
Automatic Archival Disabled
Archive Destination/data/oracle/product/10.2.0/db_1//dbs/arch
Oldest online log sequence 739
Current log sequence 741
1.select Name,log_mode from V$database;
NAME Log_mode
------------------ ------------------------
QUERY Noarchivelog
2. Using the archive LOG LIST command
Database log mode No Archive mode
Automatic Archival Disabled
Archive Destination/data/oracle/product/10.2.0/db_1//dbs/arch
Oldest online log sequence 739
Current log sequence 741

Two. 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.
1. Differences between archived and non-archived log modes
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.
Use the archive LOG LIST to view the archive mode or non-archive mode for the period mode state
===============================================================
Three. Archiving mode for the configuration database

Change non-archive mode to archive mode:

SQL code
1) Sql>shutdown normal/immediate; Down data first
2) Sql>start MOUNT; Start the DB instance to mount state, but do not open
3) Sql>alter DATABASE ARCHIVELOG; Setting the database to archive log mode
4) Sql>alter DATABASE OPEN; Open Database
5) sql>archive log list; Confirm that the database is now in archive log mode
6) sql>archive log all; Archive the redo logs at this point in time
[SQL] View plaincopyprint?
1) Sql>shutdown normal/immediate; Down data first
2) Sql>start MOUNT; Start the DB instance to mount state, but do not open
3) Sql>alter DATABASE ARCHIVELOG; Setting the database to archive log mode
4) Sql>alter DATABASE OPEN; Open Database
5) sql>archive log list; Confirm that the database is now in archive log mode
6) sql>archive log all; Archive the redo logs at this point in time
1) Sql>shutdown normal/immediate; Down data first
2) Sql>start MOUNT; Start the DB instance to mount state, but do not open
3) Sql>alter DATABASE ARCHIVELOG; Setting the database to archive log mode
4) Sql>alter DATABASE OPEN; Open Database
5) sql>archive log list; Confirm that the database is now in archive log mode
6) sql>archive log all; Archive the redo logs at this point in time

5) sql> 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!

SQL code
Sql>alter tablespace users begin Bacup;
[SQL] View plaincopyprint?
Sql>alter tablespace users begin Bacup;
Sql>alter tablespace users begin Bacup;

====================
If you stop archiving mode, use
ALTER DATABASE Noarchivelog
========================

To change the archive mode to non-archive mode:

SQL code
1) Sql>shutdown normal/immediate;
2) Sql>start MOUNT;
3) Sql>alter DATABASE Noarchivelog;
4) Sql>alter DATABASE OPEN;
[SQL] View plaincopyprint?
1) Sql>shutdown normal/immediate;
2) Sql>start MOUNT;
3) Sql>alter DATABASE Noarchivelog;
4) Sql>alter DATABASE OPEN;
1) Sql>shutdown normal/immediate;
2) Sql>start 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), and when the journal file is full, the system will hang if it is not manually archived until the archive is complete.
You can only read and not write at this time.
Shutting down and restarting the archive log process during operation
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;
Log file with the archive ordinal 052
Sql>alter SYSTEM ARCHIVE LOG SEQUENCE 052;
Archive all log files
Sql>alter SYSTEM ARCHIVE LOG all;
Change the archive log target
Sql>alter SYSTEM ARCHIVE LOG current to ' &path ';

5. Archiving mode and non-archive mode conversion

The reverse process of the 4th step.

6. 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.
Sql>alter SYSTEM SET log_archive_max_processes=10;
A maximum of 10 archive processes can be specified in oracle9i
Dynamic performance views related to the archive process
V$bgprocess,v$archive_processes

7. Configure archive target, multi-archive target, remote archive target, archive log format
Archive Target 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";
Mandatory archive Target, if an error occurs, retry after 600 seconds:
Sql>alter SYSTEM SET log_archive_dest_4 = "Location=e:oraclearchivedlog MANDATORY reopen=600";
Optional archive target, if an error occurs, discard the archive:
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 archived Log information
V$archvied_log
V$archvie_dest
V$log_history
V$database
V$archive_processes

ARCHIVE LOG LIST;

The difference between Oracle Archive mode and non-archive mode

Related Article

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.