Oracle Archive mode Oracle Database archive log common commands _oracle

Source: Internet
Author: User
Tags oracle database
--Connection Recovery Manager

C:\Documents and Settings\mengzhaoliang>rman target/

--Archive Log list
rman> list Archivelog all;

--Delete archive logs that do not exist for physical files
rman> Delete expired Archivelog all;

--Delete the archive log 7 days ago
Rman> DELETE Archivelog all COMPLETED before ' SYSDATE-7 ';

Oracle's Archiving model

One. To see if the Oracle database is in archive mode:
1.select Name,log_mode from V$database;
NAME Log_mode
------------------ ------------------------
QUERY Noarchivelog
2. Use 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 that records changes made to the database, such as inserts, deletes, updates, and so on, which are 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, there will be log switching, when the online redo log Group 2 become the current use of the log, when the online redo log Group 2 full time, log switching will occur, to write online redo log Group 1, so repeated.
If the database is in a non-archived mode, the online logs are discarded when you switch. In archive mode, when a log switch occurs, the log that is switched is archived. For example, when using online redo log 1, when 1 is full, log switching occurs, start writing online redo log 2, and the contents of online redo log 1 are copied to another specified directory. This directory is called the Archive directory, and the copied file is called the archive redo log.
A database is run with an archive to make a catastrophic recovery.
1. Differences between the archive log mode and the non-archived log mode
Non-archive mode can only do cold backups, and only a full backup can be done upon recovery. Data cannot be recovered during the most recent full backup to system error.
Archive mode can do hot backup, and can do incremental backup, can do partial recovery.
The archive LOG LIST allows you to see whether the archive mode or the archive mode is not in the period mode state.

Three. Configuring the archive mode for the database

Changing non-archive mode to archive mode:
1) Sql>shutdown normal/immediate;
2) Sql>start MOUNT;
3) Sql>alter DATABASE Archivelog;
4) Sql>alter DATABASE OPEN;
5) sql> do a full backup, because the backup log generated in the non-archived log mode is not available for archive mode. This step is not very important!

Change archive mode to non-archive mode:
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 (overridden), and if no manual archiving is done, the system will suspend until the archive is complete.
You can only read and not write at this time.
Shutdown and restart the archive log process during the run
Sql>archive LOG STOP
Sql>archive LOG START

4. Manual Archiving: Log_archive_start=false

Archive the current log file
Sql>alter SYSTEM ARCHIVE LOG current;
Archive log file with serial number 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 to ' &path
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.