Oracle Archive logs

Source: Internet
Author: User

Archive Log (Archive log) a non-active redo log backup. By using the archive log, you can keep all the redo history, when the database is in Archivelog mode and log-switched, and the background process arch will save the contents of the redo log to the archive log. When the database fails with media , the database can be fully recovered using data file backups, archive logs, and redo logs.

1. See if the current database is in archive mode:
Select Name,log_mode from V$database;
Archive log list;


2. Change non-archive mode to archive mode:

Conn/as SYSDBA--(Connect to database as DBA)

Shutdown immediate; --(Close database now)

startup Mount; --(launches the instance and loads the database but does not open) start the database to Mount state

ALTER DATABASE Archivelog; --(Change database to archive mode)

ALTER DATABASE open; --(Open database)

Alter system archive log start; --(Enable automatic archiving)
Exit-(Exit)

3. Change the 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;

4. 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 hangs until the archive is complete without manual archiving.
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

5. 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 ';

6. Archive Log Operations

Select group#,sequence#,bytes/1024/1024 byte_mb,members,status from v$log;--View group number, number of files per group (number of members), file size and status
SELECT Group#,member from v$logfile;--View group numbers and file locations
ALTER DATABASE ADD LOGFILE GROUP 2 (' E:\APP\DELL\ORADATA\SRITSUB\REDO02. Log ') size 100m;--add a log group and specify the file location and size
ALTER DATABASE add logfile member ' D:\ORACLE\PRODUCT\10.2.0\ORADATA\TEST\redo0401.log ' to group 4;--adding log members
ALTER SYSTEM Switch logfile;--switch log group
Alter SYSTEM checkpoint;--Change checkpoints
ALTER DATABASE Drop LOGFILE Group 2;--Delete log Group
ALTER DATABASE drop logfile member ' D:\ORACLE\PRODUCT\10.2.0\ORADATA\TEST\redo0401.log ';--delete log Members

7.oracle Redo Log Group of three states: Current,active,inactive

Current: Indicates that the log group is currently a log group, and Oracle is using that log group;

Active: When a log switch occurs in the current Redo group, the state changes to active, in this state, if the database
For archive mode, the archive process archives the active log Group;
If database crash occurs, the log group is also the required log group for instance recovery;

Inactive: When the active log group is archived and Oracle determines that no instance recovery is required, its state is modified
For inactive, waiting for the next round of use;

So when the log group is inactive, if the database is in archive mode. Then the log must have been archived.

Oracle Archive logs

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.