Manage archived log files

Source: Internet
Author: User

8.1 what is an archive log file
Oracle databases allow you to store full redo log files to offline directories, which are called archive log files.
Archive the process of saving the redo log file to the archive log file. This process can only run in an archived database. You can select manual or automatic archiving.
It only reads one of the redo log file groups. When the database is running in archive mode, if the redo log file is not archived, The LGWR process cannot re-use this redo log. When automatic archiving is enabled, ARCn will automatically archive the background process. A database can start multiple ARCn processes to prevent slow archiving and affect database performance.
You can use archive logs:
1. Restore the database.
2. Update the backup database.
3. You can use the log analysis mechanism to analyze historical database information.
8.2 select archive or non-archive logs
Selecting archive or non-archive in a database depends on the availability and reliability of the application system in the database.
 
Non-archive Mode
 
In non-archive mode, the Database Control file indicates that the redo log file group is full and does not need to be archived. Therefore, when a group is full, the group will be reused by LGWR during log switching.
In non-archive mode, you can only protect process failures, but not disk media failures. Only the changes recently made in the online redo log group are saved in the database for instance recovery. In non-archive mode, if the instance fails, you can only restore to the status of your previous backup, but not the data after recovery.
In non-archive mode, you cannot use online tablespace backup or use online tablespace backup to back up data in archive mode. In non-archive mode, data can only be recovered when the database is closed. If you decide that the database runs in non-archive mode, you should regularly back up the database.
 
Archive Mode
 
When you are running in archive mode, if the redo log file is not archived, LGWR cannot use this redo log file again.
Benefits of the archive Mode
1. During database backup, online redo logs and archive log files are backed up at the same time, ensuring that any submitted events and disk errors in the operating system are restored.
2. If you are running in archive mode, you can back up the database during database startup and normal use.
3. You can maintain a backup database that is consistent with the current database, and obtain the archive redo logs in the master database through the backup database.
It is best to use automatic storage.
Change the database archiving Mode
1. shutdown immediate
2. Back up all databases (to prevent database problems)
3. Edit the initialization parameter file, including the path of the archive file.
4. Startup mount
5. Modify the database archive Mode
Automatic Mode
Alter database archivelog;
Or manual mode
Alter database archivelog manual;
(Manual archiving should be timely, otherwise the database will temporarily stop working)
Alter database open;
6. Shutdown immediate
7. Back up the database
If you are running in archive mode, you can manually manage non-active redo log groups to other paths.
Determines the number of archived log files:
Log_archive_max_processes determines the number of ARCn processes. Two processes are created by default. No one has specified or modified this parameter because the database has been set as needed. The maximum value of Log_archive_max_processes is 10. You can use alter system set to adjust its quantity:
Alter system set log_archive_max_processes = 10;
8.3 specify the directory for archiving logs
Specify the path of the archive directory
You can select a single path or multiple reusable paths. To use a single path, you only need to modify the path in the log_archive_dest initialization parameter. (Note: Only parameters in spfile can be modified ). If you want to set more storage paths, you can choose whether to set the archive path to 10 (using the log_archive_dest_n parameter ), you can also use the primary and archive paths (use log_archive_dest and log_archive_duplex_dest ). Their setting methods are shown below:
Method
Initialization parameters
Host
Example
1
Log_archive_dest_n
N is the number from 1 to 10.
Local or remote
LOG_ARCHIVE_DEST_1 = 'location =/disk1/arc'
LOG_ARCHIVE_DEST_2 = 'service = standby1'
The Service is followed by the name in tnsnames. ora.
2
Log_archive_dest and log_archive_duplex_dest
Local only
LOG_ARCHIVE_DEST = '/disk1/arc'
LOG_ARCHIVE_DUPLEX_DEST = '/disk2/arc'
Modify the path of log_archive_dest_n
1. Shut down the database
Shutdown immediate
2. Modify the initialization parameter (when setting log_archive_dest_n, first determine whether log_archive_dest exists. If yes, delete this value first)
LOG_ARCHIVE_DEST_1 = 'location =/disk1/archive'
LOG_ARCHIVE_DEST_2 = 'location =/disk2/archive'
LOG_ARCHIVE_DEST_3 = 'location =/disk3/archive'
If a remote machine exists, use:
Log_archive_dest_4 = 'service = standby1 ';
3. (optional) set the format of archived logs
Set the log_archive_format initialization parameter:
Parameters
Description
% T
The file name contains the process number.
% S
The file name contains the sequence number.
% R
The file name contains the resetlog id.
Use % T, % S, or % R
Fill the file with 0 on the left
 
Modify log_archive_dest and log_archive_duplex_dest
1. Shut down the database
Shutdown immediate
2. Modify the parameter value
LOG_ARCHIVE_DEST = '/disk1/archive'
LOG_ARCHIVE_DUPLEX_DEST = '/disk2/archive'
 
3. Set the format of archived logs
Above 3.
 
8.4 specify the log transmission mode.
There are two modes for saving archived log files to the corresponding path: normal archiving log transmission and redundant archiving log transmission.
Normal log files are stored locally, while redundant logs can be stored locally or on a remote server.
Normal Transmission Mode
The archive directory is stored on another disk drive of the database server. In this configuration, archiving does not compete for resources with other files required by the thread, and the process is faster. Specify the path of the file with the parameter log_archive_dest_n or log_archive_dest.
Redundant Transmission Mode
Archived logs can be stored locally or on a remote backup server.
If you keep your slave database in the management recovery mode, you 'd better enable your master database and slave database to automatically synchronize and archive log files.
To ensure that the backup database is successfully transmitted, ARCn and the operating system do the following work:
1. Confirm the remote path
2. The remote file server (RFS) Process on the remote server is combined with the local archive log file transfer.
Each ARCn process has an RFS connected to the backup server. For example, if a server has three ARCn processes, three RFS are connected to the backup server.
You can transmit archive files to a remote machine through the oracle network service. Specify the network service name of oracle as a remote attribute for a remote archive. Oracle translates a service name into a connection descriptor through the tnsnames. ora file. This descriptor contains necessary information for connecting to a remote machine. This service name must be associated with the sid of a database. Therefore, the database updates the history of the control file in the standby database.
The RFS process runs on a remote node and serves as the network service of the ARCn client. Essentially, the ARCn process pushes information to the RFS process on the backup server.
Rfs task
1. occupy part of the network bandwidth through the ARCn Process
2. Use the standby_archive_dest parameter to create the file name on the backup server
3. Obtain log files on the remote server
4. Update the control file on the backup server
 
8.5 solve archiving errors
Specifies the minimum value of a successful archive.
The initialization parameter log_archive_min_succeed_dest = n determines that at least n redo log files are archived and online redo logs can be reused. The default value is 1. If you are using duplexing, its value is 1 or 2. If you are using multiplexing, the value ranges from 1 to 10.
8.6 manage trace output generated by archiving logs
Background processes write trace files when appropriate. In the archiving process, you can manage the output trace files. You can set the trace Level by setting the log_archive_trace parameter in the initialization parameter file.
Trace Level
Meaning
0
Disable archive file tracking. This is the default setting.
1
Redo log file tracking
2
Archiving status tracking for each archiving Log Path
4
Track archival operational phase
8
Track archivelog destination activity
16
Track detailed archivelog destination activity
32
Track archivelog destination parameter modifications
64
Track ARCn process state activity
128
Track FAL (fetch archived log) server related activities
256
Track RFS Logical Client
512
Track LGWR redo shipping network activity
1024
Track RFS Physical Client
2048
Track RFS/ARCn Ping Heartbeat
4096
Track Real Time Apply
8192
Track Redo Apply (Media Recovery or Physical Standby)
 
8.7 view archived log information
V $ database
V $ archived_log
V $ archive_dest
V $ archive_processes
V $ backup_redolog
V $ log
V $ log_history
 
SQL> archive log list
Database log mode Archive Mode
Automatic archival Enabled
Archive destination USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence 36
Next log sequence to archive 37
Current log sequence 37
 
 
This article is from the "wgk_002163.com" blog

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.