Home > Articles > Data > Oracle

  • Print
  • + Share This
Like this article? We recommend

ORACLE Cache Recovery Tuning

Tuning ORACLE for recovery is about configuring and managing checkpointing. The goal in recovery tuning is finding the right balance between checkpointing at a sufficient rate such that the number of redo log records that need to be applied during a recovery is bounded, and sustainable performance meets business goals. Clearly, a system could be tuned to checkpoint aggressively, but the additional I/O load (writes) imposed by such tuning could impede performance significantly (for example, in a write-intensive workload environment). Note that the number of redo records used has an application dependency, depending on the number of data blocks affected. In some cases, where there are multiple updates to the same block, keeping things in memory could have a write-cancellation effect. The primary concern for maintaining acceptable production performance is avoiding situations where a surge of log flushing induces transaction latency due to pressure on the I/O subsystem.

ORACLE Checkpoint Parameters

ORACLE 8.0.X releases provide some level of checkpoint management by allowing the administrator to force the instance to checkpoint when a predefined threshold is reached, by specifying it in log_check_interval and log_checkpoint_timeout. The log_checkpoint_interval is set in blocks and causes a checkpoint to occur when the log writer (LGWR) ORACLE process writes the number of blocks set in this parameter. The log_checkpoint_timeout is set in seconds and determines the maximum time between checkpoints. (Both of these settings are ORACLE 8.0.x specific behavior.)

Note that if both parameters are set, ORACLE maintains checkpointing to meet the more aggressive of the two parameters, which of also course satisfies the least aggressive.

In addition to checkpoint tuning, recovery time can be managed through the parameter recovery_parallelism. Beginning with release 8.0.4, the parameter parallel_execution_message_size is available. (In releases prior to 8.0.4, the message size was fixed.)

The recovery_parallelism parameter defines the number of recovery slave processes that are started during cache recovery. On multiprocessor systems, it is beneficial to set this value to at least the number of processors installed. This setting allows for concurrency in redo log processing.

The parameter parallel_execution_message_size defines the size of messages passed between recovery slaves. (This parameter affects other parallel features such as parallel query.) The default value of 2048 (2K) is typically too small. Increasing this value can significantly improve recovery time.

As mentioned previously, ORACLE 8.1 added fast start checkpointing and the fast_start_io_target parameter. Fast start, or incremental checkpoint, does not write every modified buffer to disk. Instead, some subset of the total number of modified buffers is written, based on current configuration parameters and tuning.

The fast_start_io_target parameter is defined as the maximum number of blocks that would need recovery. Because random disk I/O dominates roll forward, it is assumed that there is a physical disk I/O associated with each disk block. Thus, this parameter should correlate to the random I/O capabilities of the system being tuned. For example, if the storage subsystem is capable of 10,000 random IOPS, and the recovery goal is about 300 seconds (5 minutes), set fast_start_io_target to 300*10,000 (3,000,000). This is not precise, because recovery time has other components that must also be considered; other considerations are covered in "Best Practices" on page 19.

Beginning with ORACLE 8.1, the meaning of log_checkpoint_interval and log_checkpoint_timeout changed. The log_checkpoint_interval parameter defines the maximum number of redo log blocks that need to be read during recovery, by defining the maximum number of blocks that can exist between the current redo log position and the end of the log (log tail).

The log_checkpoint_timeout sets a boundary on the time required to read redo blocks during instance recovery, by setting the checkpoint target location in the log (the location that, when hit, initiates a checkpoint) relative to the end of the log, so that the end of the log is log_checkpoint_timeout seconds ago.

ORACLE 9 deprecates fast_start_io_target by adding fast_start_mttr_target. The idea is that you set your recovery requirement in seconds rather than disk blocks or disk IOPS. ORACLE maintains recovery timings and startup heuristics for maintaining the redo log size, so that the fast_start_mttr_target can be met (ORACLE reports an error if fast_start_mttr_target is set to a value that ORACLE determines it can not meet).

NOTE

The fast_start_mttr_target parameter specifies total instance startup time, not just the roll-forward phase. If you have a requirement of 5 minutes instance recovery, set fast_start_mttr_target to 300.

The following summarizes the ORACLE parameters related to cache recovery:

  • 8.0 provides the log checkpoint parameters and recovery_parallelism. Hard checkpointing only (all modified buffers written).

  • 8.0.4 adds parallel_execution_message_size.

  • 8.1 adds fast_start_io_target and incremental checkpointing.

  • 9.x adds fast_start_mttr_target with further enhancements to the recovery code path.

ORACLE Recovery

In addition to starting ORACLE by rolling forward, we divide startup into four distinct phases:

  • Start up process

  • Create Shared Global Area (SGA)

  • Mount database

  • Open database

The time required for each of these phases to complete varies with database configurations. You can figure the time for your system by examining the ORACLE alert_<instance_name>.log file in $ORACLE_HOME/rdbms/log. ORACLE provides date and time stamps with event messages and milestones in startup, so it's relative easy to figure out how long ORACLE takes to start up. It is recommended that you do the calculation and note these times, so you have a sense for the startup time required for the instances you are managing. The following are key lines from a typical alert log file.

CODE EXAMPLE 1 Alert Log File Sample

Tue Nov     5 18:02:30 2002
Starting ORACLE instance (normal)
...
Tue Nov     5 18:07:21 2002
ALTER DATABASE       MOUNT
...
Tue Nov     5 18:07:26 2002
ALTER DATABASE OPEN
...
Tue Nov     5 18:08:12 2002
Database Characterset is US7ASCII
Completed: ALTER DATABASE OPEN

We can easily determine that a clean start of this ORACLE instance took 5 minutes and 42 seconds (from 18:02:30 to 18:08:12). Also, we can see that the majority of the time was the process and SGA initialization phase, which took 4 minutes and 51 seconds (from 18:02:30 to 18:07:21), 85% of the total start up time. We note that in this case, a relatively large SGA is configured (169 Gigabyte SGA), which is where most of the time was spent.

To understand recovery times, add the following entry to the instance init.ora file:

event="10333 trace name context forever, level 2"

With this entry, you get recovery statistics in your alert log. Internally, ORACLE tracks startup phases with microsecond granularity. This gives ORACLE the ability to come relatively close to meeting mean time to recovery (MTTR) goals based on parameter settings (fast_start_mttr_target). An actual crash recovery improves the accuracy, because ORACLE measures the time involved in reading redo log blocks and applying that data to the data blocks, then saves that information for subsequent calculations for meeting MTTR targets.

The following is sample data from an alert log after a crash.

CODE EXAMPLE 2

Wed Nov 6 07:43:08 2002
ALTER DATABASE OPEN
Wed Nov 6 07:43:12 2002
Beginning crash recovery of 1 threads
 attempting to start a parallel recovery with 24 processes
 parallel recovery started with 24 processes
Wed Nov 6 07:43:18 2002
Started first pass scan
Wed Nov 6 07:50:35 2002
Completed first pass scan
 46213731 redo blocks read, 7072518 data blocks need recovery

We set recovery_parallelism to 24, and we see the roll forward begins when ORACLE attempts to open the database. We get statistics on how much work is required to do the roll forward. In this case, we have about 46 million redo blocks and 7.1 million data blocks to process. We can time the roll forward phases. The time between "Started first pass scan" and "Completed first pass scan" is the time to read the redo log blocks, which takes about 7 minutes (07:43:18 to 07:50:35).

CODE EXAMPLE 3

Wed Nov 6 07:54:08 2002
Started recovery at
 Thread 1: logseq 92, block 36433268, scn 0.0

The time from "Completed first pass scan" to "Started Recovery" is the time to read and claim all data blocks that need recovery. In this case, it took just over three-and-a-half minutes (07:50:35 to 07:54:08).

The final phase of the roll forward work is applying redo log block data to data blocks. This time is between the "Started recovery" and "Completed redo application" messages. In the example, about 9 minutes is required for this last phase (7:54:08 to 8:05:17).

CODE EXAMPLE 4

Recovery of Online Redo Log: Thread 1 Group 2 Seq 92 Reading mem 0
 Mem# 0 errs 0: /links/log2
Wed Nov 6 07:56:42 2002
Recovery of Online Redo Log: Thread 1 Group 1 Seq 93 Reading mem 0
 Mem# 0 errs 0: /links/log1
Wed Nov 6 08:05:17 2002
Completed redo application
Wed Nov 6 08:05:32 2002
Ended recovery at

The total roll forward time in this case is about 20 minutes. More precisely, using the time stamps from "Beginning crash recovery" to "Ended recovery," we have 07:43:12 to 08:05:32, which is 22 minutes and 20 seconds.

The next alert log entries provide information on the amount of work done on the roll forward and ORACLE's latest set of MTTR statistics.

CODE EXAMPLE 5

Ended recovery at
 Thread 1: logseq 93, block 32014541, scn 0.444646430
 7072518 data blocks read, 7072518 data blocks written, 46213731 redo blocks read   
MTTR statistics updated from recovery
MTTR statistics status: 3
Init time: Avg: 194842222, Times measured: 3
File open time: Avg: 5395, Times measured: 484
Log block read time: Avg: 9, Times measured: 46213732
Data block handling time: Avg: 126, Times measured: 7072519

We see that 7.1 megabyte data blocks were read (scanned) and written (with the redo data), and that 46.2 megabyte redo log blocks were read. This data is useful for sizing your I/O subsystem when recovery or checkpoints are taking too long. By understanding the amount of data that needs to be processed and the basic capabilities of the I/O subsystem, layout, and configuration, you can establish thresholds to improve recovery and checkpoint times.

ORACLE MTTR Statistics

The MTTR statistics are ORACLE's most recent view of the recovery. The "statistics status 3" means that statistics were updated from a recovery (as the preceding text message indicates). When a new instance is created, the MTTR statistics are initialized to a hard-coded value to provide a starting point. Also, they are updated from runtime data.

The time values reported are in microseconds and are maintained as running averages. For example, the "File open time" average is 5.4 milliseconds. If there are 500 data files in your database instance, it takes 2700 milliseconds (or just under 3 seconds) to open all files. Data block handling time averages 126 microseconds. At 7.1 megabyte data blocks, that's 894.6 million microseconds (or 895 seconds, which is about 15 minutes). The point is that there is useful data in the alert log that can help you identify issues in a system's ability to perform recovery and determine what improvements can be made.

  • + Share This
  • 🔖 Save To Your Account

InformIT Promotional Mailings & Special Offers

I would like to receive exclusive offers and hear about products from InformIT and its family of brands. I can unsubscribe at any time.

Overview


Pearson Education, Inc., 221 River Street, Hoboken, New Jersey 07030, (Pearson) presents this site to provide information about products and services that can be purchased through this site.

This privacy notice provides an overview of our commitment to privacy and describes how we collect, protect, use and share personal information collected through this site. Please note that other Pearson websites and online products and services have their own separate privacy policies.

Collection and Use of Information


To conduct business and deliver products and services, Pearson collects and uses personal information in several ways in connection with this site, including:

Questions and Inquiries

For inquiries and questions, we collect the inquiry or question, together with name, contact details (email address, phone number and mailing address) and any other additional information voluntarily submitted to us through a Contact Us form or an email. We use this information to address the inquiry and respond to the question.

Online Store

For orders and purchases placed through our online store on this site, we collect order details, name, institution name and address (if applicable), email address, phone number, shipping and billing addresses, credit/debit card information, shipping options and any instructions. We use this information to complete transactions, fulfill orders, communicate with individuals placing orders or visiting the online store, and for related purposes.

Surveys

Pearson may offer opportunities to provide feedback or participate in surveys, including surveys evaluating Pearson products, services or sites. Participation is voluntary. Pearson collects information requested in the survey questions and uses the information to evaluate, support, maintain and improve products, services or sites, develop new products and services, conduct educational research and for other purposes specified in the survey.

Contests and Drawings

Occasionally, we may sponsor a contest or drawing. Participation is optional. Pearson collects name, contact information and other information specified on the entry form for the contest or drawing to conduct the contest or drawing. Pearson may collect additional personal information from the winners of a contest or drawing in order to award the prize and for tax reporting purposes, as required by law.

Newsletters

If you have elected to receive email newsletters or promotional mailings and special offers but want to unsubscribe, simply email information@informit.com.

Service Announcements

On rare occasions it is necessary to send out a strictly service related announcement. For instance, if our service is temporarily suspended for maintenance we might send users an email. Generally, users may not opt-out of these communications, though they can deactivate their account information. However, these communications are not promotional in nature.

Customer Service

We communicate with users on a regular basis to provide requested services and in regard to issues relating to their account we reply via email or phone in accordance with the users' wishes when a user submits their information through our Contact Us form.

Other Collection and Use of Information


Application and System Logs

Pearson automatically collects log data to help ensure the delivery, availability and security of this site. Log data may include technical information about how a user or visitor connected to this site, such as browser type, type of computer/device, operating system, internet service provider and IP address. We use this information for support purposes and to monitor the health of the site, identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents and appropriately scale computing resources.

Web Analytics

Pearson may use third party web trend analytical services, including Google Analytics, to collect visitor information, such as IP addresses, browser types, referring pages, pages visited and time spent on a particular site. While these analytical services collect and report information on an anonymous basis, they may use cookies to gather web trend information. The information gathered may enable Pearson (but not the third party web trend services) to link information with application and system log data. Pearson uses this information for system administration and to identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents, appropriately scale computing resources and otherwise support and deliver this site and its services.

Cookies and Related Technologies

This site uses cookies and similar technologies to personalize content, measure traffic patterns, control security, track use and access of information on this site, and provide interest-based messages and advertising. Users can manage and block the use of cookies through their browser. Disabling or blocking certain cookies may limit the functionality of this site.

Do Not Track

This site currently does not respond to Do Not Track signals.

Security


Pearson uses appropriate physical, administrative and technical security measures to protect personal information from unauthorized access, use and disclosure.

Children


This site is not directed to children under the age of 13.

Marketing


Pearson may send or direct marketing communications to users, provided that

  • Pearson will not use personal information collected or processed as a K-12 school service provider for the purpose of directed or targeted advertising.
  • Such marketing is consistent with applicable law and Pearson's legal obligations.
  • Pearson will not knowingly direct or send marketing communications to an individual who has expressed a preference not to receive marketing.
  • Where required by applicable law, express or implied consent to marketing exists and has not been withdrawn.

Pearson may provide personal information to a third party service provider on a restricted basis to provide marketing solely on behalf of Pearson or an affiliate or customer for whom Pearson is a service provider. Marketing preferences may be changed at any time.

Correcting/Updating Personal Information


If a user's personally identifiable information changes (such as your postal address or email address), we provide a way to correct or update that user's personal data provided to us. This can be done on the Account page. If a user no longer desires our service and desires to delete his or her account, please contact us at customer-service@informit.com and we will process the deletion of a user's account.

Choice/Opt-out


Users can always make an informed choice as to whether they should proceed with certain services offered by InformIT. If you choose to remove yourself from our mailing list(s) simply visit the following page and uncheck any communication you no longer want to receive: www.informit.com/u.aspx.

Sale of Personal Information


Pearson does not rent or sell personal information in exchange for any payment of money.

While Pearson does not sell personal information, as defined in Nevada law, Nevada residents may email a request for no sale of their personal information to NevadaDesignatedRequest@pearson.com.

Supplemental Privacy Statement for California Residents


California residents should read our Supplemental privacy statement for California residents in conjunction with this Privacy Notice. The Supplemental privacy statement for California residents explains Pearson's commitment to comply with California law and applies to personal information of California residents collected in connection with this site and the Services.

Sharing and Disclosure


Pearson may disclose personal information, as follows:

  • As required by law.
  • With the consent of the individual (or their parent, if the individual is a minor)
  • In response to a subpoena, court order or legal process, to the extent permitted or required by law
  • To protect the security and safety of individuals, data, assets and systems, consistent with applicable law
  • In connection the sale, joint venture or other transfer of some or all of its company or assets, subject to the provisions of this Privacy Notice
  • To investigate or address actual or suspected fraud or other illegal activities
  • To exercise its legal rights, including enforcement of the Terms of Use for this site or another contract
  • To affiliated Pearson companies and other companies and organizations who perform work for Pearson and are obligated to protect the privacy of personal information consistent with this Privacy Notice
  • To a school, organization, company or government agency, where Pearson collects or processes the personal information in a school setting or on behalf of such organization, company or government agency.

Links


This web site contains links to other sites. Please be aware that we are not responsible for the privacy practices of such other sites. We encourage our users to be aware when they leave our site and to read the privacy statements of each and every web site that collects Personal Information. This privacy statement applies solely to information collected by this web site.

Requests and Contact


Please contact us about this Privacy Notice or if you have any requests or questions relating to the privacy of your personal information.

Changes to this Privacy Notice


We may revise this Privacy Notice through an updated posting. We will identify the effective date of the revision in the posting. Often, updates are made to provide greater clarity or to comply with changes in regulatory requirements. If the updates involve material changes to the collection, protection, use or disclosure of Personal Information, Pearson will provide notice of the change through a conspicuous notice on this site or other appropriate way. Continued use of the site after the effective date of a posted revision evidences acceptance. Please contact us if you have questions or concerns about the Privacy Notice or any objection to any revisions.

Last Update: November 17, 2020