Enable automatic archiving in Oracle

Source: Internet
Author: User
The Oracle database has a connection redo log, which records changes to the database, such as insertion, deletion, and data update. All these operations are recorded on the online redo day.

The Oracle database has a connection redo log, which records changes to the database, such as insertion, deletion, and data update. All these operations are recorded on the online redo day.

Oracle archiving Mode

1. Check whether the oracle database is in archive mode:

1. select name, log_mode from v $ database;

NAME LOG_MODE
------------------------------------------
QUERY NOARCHIVELOG

2. Use 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

2. What is the Oracle archiving mode?

The Oracle database has a redo log of the connected machine. This log records changes made to the database, such as insertion, deletion, and data update. All these operations are recorded in the online redo log. Generally, a database must have at least two online redo log groups. When an online redo log group is full, log switching occurs. At this time, online redo log group 2 becomes the currently used log. When online redo log group 2 is full, log switching occurs again. Write online redo log group 1, and then repeat it. If the database is in non-archive mode, online logs are discarded during Switching. In archive mode, logs are archived When switching. For example, currently online redo log 1 is used. When 1 is full, log switching occurs and online redo log 2 is started, 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 file is called the archive redo log. You can perform catastrophic recovery only when the database is running in archive mode. 1. the difference between the archive log mode and the non-archive log mode is that only cold backup can be performed in non-archive mode, and only full backup can be performed during recovery. data during the last full backup to system error cannot be recovered. archive mode supports hot backup, Incremental backup, and partial recovery. you can use archive log list to check whether the ARCHIVE mode is not the ARCHIVE mode when the ARCHIVE mode is in the status.

3. Change the archive mode of the database to archive:

1) SQL> SHUTDOWN NORMAL/IMMEDIATE;
2) SQL> START MOUNT;
3) SQL> ALTER DATABASE ARCHIVELOG;
4) SQL> ALTER DATABASE OPEN;

5) SQL> make a full backup because the backup logs generated in non-archive log mode are no longer available in 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 cannot be overwritten. If the log file is fully written and not archived manually, the system suspends until the archiving is complete. at this time, you can only read but not write. close and restart the archiving LOG process SQL> archive log stop SQL> ARCHIVE LOG START

4. manual archiving:
LOG_ARCHIVE_START = FALSE



Archive Current Log File

SQL> ALTER SYSTEM ARCHIVE LOG CURRENT;



Archive log files numbered 052

SQL> ALTER SYSTEM ARCHIVE LOG SEQUENCE 052;



Archive all log files

SQL> ALTER SYSTEM ARCHIVE LOG ALL;



Change the log archiving target

SQL> ALTER SYSTEM ARCHIVE LOG CURRENT TO '& path ';

5. The Archive mode and non-archive mode are reversed in step 1.

6. Configure multiple archiving processes

Q: When do I 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 and can be modified dynamically using alter system.

SQL> ALTER SYSTEM SET LOG_ARCHIVE_MAX_PROCESSES = 10;

You can specify up to 10 dynamic performance views related to the archiving process in Oracle9i v $ bgprocess, v $ archive_processes

7. Configure archiving targets, multiple archiving targets, remote archiving targets, and LOG_ARCHIVE_DEST_n local archiving targets for archiving log formats:

SQL> LOG_ARCHIVE_DEST_1 = "LOCATION = D: ORACLEARCHIVEDLOG"; remote archiving target: SQL> LOG_ARCHIVE_DEST_2 = "SERVICE = STANDBY_DB1"; Mandatory archiving target. If an error occurs, retry in 600 seconds: SQL> ALTER SYSTEM SET LOG_ARCHIVE_DEST_4 = "LOCATION = E: ORACLEARCHIVEDLOG MANDATORY REOPEN = 600"; optional archiving target. If an error occurs, discard Archiving: SQL> ALTER SYSTEM SET LOG_ARCHIVE_DEST_3 = "LOCATION = E: ORACLEARCHIVEDLOG OPTIONAL"; archiving target status: close archiving target and open archiving Target 1 SQL> alter system set LOG_ARCHIVE_DEST_STATE_1 = DEFER open archiving Target 2 SQL> ALTER SYSTEM SET LOG_ARCHIVE_DEST_STATE_2 = ENABLE archive log format LOG_ARCHIVE_FORMAT 8. obtain archived LOG information V $ ARCHVIED_LOG V $ ARCHVIE_DEST V $ LOG_HISTORY V $ database v $ ARCHIVE_PROCESSES archive log list;

Related reading:

Oracle 11g rac modify archive Mode

Oracle manual full recovery case (archive Mode)

Oracle manual recovery case (non-archive Mode)

Instructions for setting Oracle archive Mode

Backup script in Oracle 10g archive Mode

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.