[Oracle Study Notes] managing archived logs

Source: Internet
Author: User

In archive mode, Oracle copies a full log file to a specified place. This process is called archiving, and the copied log file is called archiving logs.

1. Set the database to archive

Query database log mode through archive log list

SQL> archive log list;
Database Log mode non-archive Mode
Disable automatic archiving
Archiving end point use_db_recovery_file_dest
Oldest online log sequence 17
Current Log sequence 19

Currently, it is not in archive mode. Change it to archive mode: Alter database archivelog;

Example:

1. Shut down the database

SQL> shutdown immediate;
The database has been closed.
The database has been detached.
The Oracle routine has been disabled.

2. Start the database. Do not open it.

SQL> startup Mount;
The Oracle routine has been started.

Total system global area 612368384 bytes
Fixed size 1250428 bytes
Variable Size 255855492 bytes
Database buffers 348127232 bytes
Redo buffers 7135232 bytes
The database has been loaded.

3. Modify the database mode

SQL> alter database archivelog;

The database has been changed.

4. Open the database

SQL> alter database archivelog;

The database has been changed.

The database archive mode is changed to archive mode.

SQL> archive log list;
Database Log mode archiving Mode
Enable automatic archiving
Archiving end point use_db_recovery_file_dest
Oldest online log sequence 17
Next archive log sequence 19
Current Log sequence 19

 

Ii. Set archiving targets

Path for storing archived logs: db_recovery_file_dest

SQL> show parameter db_recovery_file

Name type value
-----------------------------------------------------------------------------
Db_recovery_file_dest string D: \ oracle \ product \ 10.2.0/flash
_ Recovery_area
Db_recovery_file_dest_size big integer 2G

You can set other archiving targets by setting the log_archive_dest_n parameter. N is 1 ~ 10. Oracle archives log files in the same way to each archiving target.

SQL> show parameter log_archive_dest

Name type value
----------------------------------------------------------------------------
Log_archive_dest string
Log_archive_dest_1 string
Log_archive_dest_10 string
Log_archive_dest_2 string
Log_archive_dest_3 string
Log_archive_dest_4 string
Log_archive_dest_5 string
Log_archive_dest_6 string
Log_archive_dest_7 string
Log_archive_dest_8 string
Log_archive_dest_9 string

Set other archiving targets:

SQL> alter system set log_archive_dest_1 = 'location = D: \ oracle \ myarchive ';

The system has been changed.

Iii. Archiving tracking level

Set the parameter log_archive_trace. The default value is 0, indicating that no archived information is recorded in the trace file. The trace levels are 0, 16, 32, and 64. The archive content corresponding to each level is not described here. You can overlay the values of multiple levels as the trace parameter values.

SQL> show parameter log_archive_trace

Name type value
-------------------------------------------------------------------
Log_archive_trace integer 0
SQL> alter system set log_archive_trace = 17;
The system has been changed.

Iv. query archived logs

1. V $ Database

Query whether the database belongs to the archive mode. In addition to the archive log list, you can query the V $ Database

SQL> select log_mode from V $ database;

Log_mode
------------
Archivelog

2. V $ archived_log

3. V $ archived_dest

4. V $ archive_processes

5. V $ backup_redolog

6. V $ log

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.