8 Tuning Windows to Optimize Oracle Database

This chapter describes how to tune the Windows Server operating system to ensure that Oracle Database is running in the best possible environment.

This chapter contains these topics:

Overview of Windows Tuning

Windows Server operating systems offer considerably fewer tuning adjustments than UNIX systems. This difference constrains system administrators when they try to optimize Windows Server performance, but it also makes Windows Server easier to use.

You can make Windows Server a better application server environment for Oracle Database. Most of the operating system specific procedures described in this chapter enable Oracle Database to reserve more system resources, such as CPU, memory, and disk I/O.

In addition, because Oracle Database is a high-performance database management system that effectively uses resources of your Windows computer, it should not also serve as any of the following:

  • Primary or backup domain controller

  • File or print server

  • Remote access server

  • Router

These configurations consume network, memory, and CPU resources. In addition, the Windows computer that is running Oracle Database should not be locally accessed with a high frequency or intensively used for local user processing, unless it has enough resources to accommodate all this activity.

Overview of Large Page Support

Large page support is a feature of Oracle Database. It provides a performance boost for memory-intensive database instances running on Windows Server. By taking advantage of newly introduced operating system support, Oracle Database can now make more efficient use of processor memory addressing resources. Specifically, when large page support is enabled, the CPUs in the system will be able to access the Oracle Database buffers in RAM more quickly. Instead of addressing the buffers in 4KB increments, the CPUs are told to use 2 MB page sizes in Physical Address Extension (PAE) mode and 4MB page sizes in non-PAE mode when addressing the database buffers.

This feature is particularly useful when the Oracle buffer cache is several gigabytes. Smaller-sized configurations will still see a gain when using large pages, but the gain will not be as great as when the database is accessing large amounts of memory.

If the service is running as a user instead of the default SYSTEM user, then the administrator must grant the "Lock pages in memory" privilege to the user. This privilege is not enabled by default when Windows is installed.

Granting Lock Pages in Memory Privilege

To grant SeLockMemoryPrivilege, perform the following steps:

  1. From the Start menu, select Control Panel.

    The Control Panel window opens.

  2. Double-click Administrative Tools.

    The Administrative Tools window opens.

  3. Double-click Local Security Policy.

    The Local Security Policy window opens.

  4. In the left pane of the Local Security Policy window, expand Local Policies and select User Rights Assignment.

  5. In the right pane of the Local Security Policy window, double-click Lock pages in memory.

    The Lock pages in memory Properties window opens.

  6. Click Add User or Group.

    The Select Users, Computers, Service Accounts, or Groups dialog box opens.

  7. Enter Oracle Home User name in Enter the object names to select field and click Check Names.

  8. Click OK to close the Select Users, Computers, Service Accounts, or Groups dialog box.

  9. Click OK to close the Lock pages in memory Properties window.

Enabling Large Page Support

To take advantage of large pages, the amount of physical memory must be greater than the amount of System Global Area (SGA) specified in the parameter file.

Large pages might not be allocated always during instance startup. Large pages are supported in 2 modes:

  • Regular mode: All of the SGA is attempted to be allocated in large pages. If the required amount of large pages are not available, then the instance does not come up.

  • Mixed mode: All of the SGA is attempted to be allocated in large pages. If no more large pages are available, then the subsequent allocations are done using regular pages. So the SGA allocation can be a mixed set of large pages and regular pages.

    The mixed mode also supports a time parameter (in msecs). If a large page allocation took more time than the msecs specified by this time parameter, then subsequent allocations are made using regular pages. This parameter is helpful when the database startup time might be too long due to the entire SGA being allocated using large pages.

Note:

Large page usage locks the entire SGA into physical memory. Physical memory is not released during a shrink operation.

See Also:

Your operating system documentation for restrictions on allocating large pages

To enable large page support:

  1. Go to the directory ORACLE_HOME\bin\oracle.key.

  2. Open the oracle.key in a text editor and record the value found. It is set by Oracle Universal Installer. The default is:

    SOFTWARE\ORACLE\KEY_HOMENAME
    
  3. Start Registry Editor at the command prompt:

    C:\> regedit
    

    Note:

    Although Registry Editor lets you view and modify registry keys and parameter values, you usually are not required to do so. In fact, you can render your system useless if you make incorrect changes. Therefore, only advanced users should edit the registry. Back up your system before making any changes in the registry.

    oracle.key file must not be modified in any way or removed. Oracle binaries open it to determine the location in the registry where their variables are stored.

  4. Go to the HKEY_LOCAL_MACHINE file.

    Find the key corresponding to the value found in the oracle.key file. In the default case, for example, you would look for:

    HKEY_LOCAL_MACHINE\SOFTWARE\ORACLE\KEY_HOMENAME
    
  5. Create one of the following, depending on where you want to enable large page support:

    • ORA_LPENABLE to enable large page support on all instances. Its value decides the mode of large pages for all Oracle database instances on the computer.

    • ORA_SID_LPENABLE to enable large page support on a specific instance. Its value decides the mode of large pages for the specific database instance.

      Set the value of the above registry entry to 1 for regular mode and 2 for mixed mode.

      The time parameter for mixed mode is optional. To specify this time parameter which is instance specific, create ORA_SID_LPMAXTIME and set the value to the desired number of millisecs.

      When this time parameter is specified for an instance and the large pages allocation takes more than the specified millisecs, then the rest of the SGA is allocated using regular pages.

  6. Exit Registry Editor.

By default, Oracle allocates the minimum available large page size when using large pages. The minimum available large page size, 16 MB, is obtained by using the GetLargePageMinumum function.

Caution:

Do not set the initialization parameter lock_sga when large pages are enabled. Large page usage locks the entire SGA into physical memory. When used with the parameter lock_sga, database startup fails with an error because the operating system automatically locks. That is, it prevents memory from being paged to disk when large pages are requested. Physical memory is not released during a shrink operation.

About Reducing Priority of Foreground Applications on Server Console

One of the settings provided by default during installation of Windows Server gives interactive foreground applications priority over every background process. To prevent foreground applications on the server console from taking excessive processor time away from Oracle Database, you can reduce the priority for foreground applications.

See Also:

Your operating system documentation for instructions on reducing priority of foreground applications

About Configuring Windows Server to Be an Application Server

Windows memory manager divides up system memory into three different pools, described in Table 8-1.

Table 8-1 Windows Server Memory Shares

Pool Percent of Total Memory

Kernel and other system services

9%

File cache

41%

Paged memory

50%


Windows Server memory manager tries to balance each application's usage of memory by dynamically paging memory between physical RAM and a virtual memory paging file. If an application is particularly memory-intensive (like Oracle Database) or if a large number of applications run concurrently, then combined memory requirements of the applications might exceed physical memory capacity.

The large proportion of memory reserved for file caching (41%) can be quite beneficial to file and print servers. But it might not be advantageous to application servers that often run memory-intensive network applications. A Windows Server file cache is particularly unnecessary for Oracle Database, which performs its own caching through the System Global Area.

You can reset the Windows Server memory model from the default file and print server, with its large file cache, to a network applications model, with a reduced file cache and more physical memory available for Oracle Database.

See Also:

Your operating system documentation for instructions

About Disabling Unnecessary Services

After you have significantly reduced the file cache as described in "About Configuring Windows Server to Be an Application Server", you can retrieve additional physical memory for Oracle Database by disabling services not needed for core operating system functionality. Unnecessary services include:

  • License Logging Service

  • Plug and Play

  • Remote Access Autodial Manager

  • Remote Access Connection Manager

  • Remote Access Server

  • Telephony Service

Consult with your systems administrator to identify other unnecessary services.

Do not disable any of the following services:

  • Alerter

  • Computer Browser

  • EventLog

  • Messenger

  • OracleServiceSID

  • OracleHOMENAMETNSListener

  • Remote Procedure Call (RPC) Service

  • Server

  • Spooler

  • TCP/IP NetBS Helper

  • Workstation

See Also:

Your operating system documentation for instructions on disabling unnecessary services

About the Necessity to Remove Unused Network Protocols

Remove all unnecessary network protocols on Windows so that processing time can be concentrated on servicing only critical protocols.

See Also:

Your operating system documentation for instructions on removing unnecessary network protocols

About the Necessity to Reset Network Protocol Bind Order

If multiple protocols must be installed on the server, you can give the protocol most frequently used by Oracle Database the highest priority by resetting the network protocol bind order.

See Also:

Your operating system documentation for instructions on resetting the network protocol bind order

Setting the Order of Multiple Network Interface Cards

If you have public and private network interface cards (NICs) on a single Windows computer and they are not in the correct order, then you might experience problems with any configuration (Oracle Enterprise Manager, for example) that uses gethostname.

If the private NIC is seen first by Windows, then a gethostname call will return the host name of the private interconnect. Whichever tool is calling gethostname will have configuration or connectivity problems stemming from this nonpublic network information.

You can determine the current order of your NICs, and change it if necessary, as follows:

  1. From the Start menu, select Control Panel.

  2. Select Network and Internet, and then select Network and Sharing Center.

  3. Change the network adapter settings, depending on your operating system:

    • For Windows Server 2008, select Manage adapter settings.

    • For Windows Server 2008 R2, select Change adapter settings.

  4. Click Organize, then Layout, and then select Menu bar.

  5. From the Advanced menu, click Advanced Settings. The Advanced Settings window opens.

  6. From the Connections window in the Adapters and Binding tab, select the network adapter that you want.

  7. Move this network adapter to the top or the bottom of the list by using the up and down arrow buttons.

  8. Click OK.

Overview of Latest Reliable Windows Server Service Pack

Microsoft releases operating system patches, called Service Packs, on a quarterly basis. Service Packs are collections of bug fixes and product enhancements to the basic Windows Server release. In general, apply Service Packs as soon as it is safe to do so, because they fix bugs and can improve Windows Server performance or functionality.

While Service Packs are supposed to fix bugs, they sometimes introduce new problems as well. In general, it is safest to wait a few weeks after a Service Pack is released before implementing it. This allows time for other field sites to report any problems with the Service Pack release.

The latest Windows Server Service Packs can be downloaded as self-extracting archives from http://support.microsoft.com

Unless you can be certain that the Service Pack works without flaws on Windows Server, create an Uninstall directory. This enables the Service Pack to be removed and the original configuration to be restored.

Service Pack files overwrite similarly-named files in the previous Windows Server configuration. However, Service Pack files can be overwritten in turn by setup programs that copy files from the original installation media.

For example, installing a new network protocol or printer driver usually requires copying files from the original Windows Server installation media. When Service Pack files are comprehensively or selectively overwritten, the Service Pack must be reapplied.

Overview of Hardware or Operating System Striping

Compared to CPU and memory speeds, hard disk drives are extremely slow. Now that hard disk drives are relatively inexpensive, Oracle recommends that Windows Server use logical volumes composed of striped physical disks. Data striping is an effective means of reducing the impact of relatively slow hard drives by distributing file I/O across a number of hard drives simultaneously.

Note:

Data striping through the operating system is not permitted with Oracle Automatic Storage Management (Oracle ASM), which does its own striping. Hardware striping is allowed with Oracle ASM, but it is not necessary.

See Also:

"Using Automatic Memory Management" in Oracle Database Administrator's Guide

Striping data across a number of disks is one example of a redundant array of inexpensive disks (RAID). There are several different types of RAID, also referred to as RAID levels, ranging from high performance to high reliability. The three most common RAID levels in Oracle Database installations are RAID-0, RAID-1, and RAID-5. Descriptions of each RAID level are in Table 8-2, which shows each level's read and write penalties.

Table 8-2 RAID Levels in Oracle Database Installations

RAID Level Read PenaltyNote 1 Write PenaltyNote 2

0 (Disk Striping)

1:1

1:1

1 (Disk Mirroring)

1:1

2:1

0 + 1

1:1

2:1

5 (Distributed Data Gathering)

1:1

4:1


Note 1

Read penalty is the ratio of I/O operations to read requests.

Note 2

Write penalty is the ratio of I/O operations to write requests.

About Disk Striping

RAID level 0 enables high-performance, fault-intolerant disk striping. Multiple physical hard disks are aggregated into a logical whole, either by a disk controller or through the operating system. Data operations against the logical volume are broken down into as many chunks as there are physical drives in the array, making simultaneous use of all disks. Given identical hard disks, if one hard disk has a throughput rate of DISKRATE operations/second, then a RAID 0 logical volume has a rate of:

(DISKRATE * [number of physical  drives in array]) operations/second

The downside of RAID 0 is its lack of fault tolerance. If one disk in the logical volume fails, the whole volume fails and must be restored from a backup.

About Disk Mirroring

RAID level 1 enables fault-tolerant disk mirroring with some chance of a performance penalty. Essentially, every write to a mirrored disk is duplicated on another drive dedicated to this purpose (the mirror drive). If the mirrored disk fails, the mirror drive is brought online in real time. After the faulted drive is replaced, the mirror configuration can be reestablished.

The read penalty for RAID level 1 is nominally 1:1, but it might benefit from split reads on some controllers. When the controller knows which mirror can be accessed fastest, for example, it can lower search times by directing I/O operations to that disk.

About Disk Striping Plus Mirroring

RAID level 0+1 enables mirroring of an array of striped hard disks. This is a blend of RAID 0 and RAID 1, offering high-performing fault tolerance.

About Distributed Data Guarding

RAID level 5, also known as disk striping with parity, eliminates the costly requirement to mirror. In RAID 5, multiple hard disks are aggregated into a striped logical volume, similar to RAID 0, but each drive contains parity information such that any single drive failure is tolerated. With one failed drive, a RAID-5 system can allow continued access to data, although access times are greatly reduced due to on-the-fly rebuilding of bytes from parity information. RAID-5 solutions usually allow hot-swapping of faulty drives with replacements, triggering a rebuild of the failed drive's data onto the replacement from parity information.

The write penalty of 4:1 results from 2 reads and 2 writes during parity calculation.

About Multiple Striped Volumes for Sequential and Random Access

If there are enough physical disks in Windows Server, create at least two striped volumes (in addition to a standalone hard disk or striped volume for the operating system). One striped volume can be used for sequential data access, and the other can be used for random data access.

Oracle Database redo logs and archived redo logs, for example, are written in sequential order. Because of reduced head movement, hard disks perform best when reading or writing sequential data.

Oracle Database data files, however, are usually accessed in random order. Random access in a hard disk results in significant head movement, translating to slower data access.

Unless redo logs are separated from data files (at physical device level), undo file I/O contention may result, increasing access times for both types of files.

About Multiplex Windows Server Virtual Memory Paging File

Some virtual memory paging is likely even if Oracle Database is the only network application running on Windows Server, because Windows Server memory manager will attempt to move seldom-used pages to disk to free up more physical memory for hot pages.

Multiplexing the Windows Server virtual memory paging file is a good strategy to boost overall system performance. Splitting the paging file onto at least two different physical volumes (or logical volumes as long as underlying physical volumes do not overlap) provides a significant performance boost to virtual memory swapping operations.

Even though this is a good technique to increase speed of virtual memory paging, too much paging activity is still a performance hit and should be corrected by adding more RAM to the server.

About General Page File Sizing Tip

Oracle recommends setting virtual memory to one times the size of RAM, if physical memory is between 2GB and 16GB. If physical memory is more than 16 GB, then set virtual memory to 16 GB.

Configurations where combined size is two to four times the size of physical RAM are not uncommon. Minimize paging as much as possible. But situations in which the operating system runs out of or low on paging space are to be avoided at all costs. Adequately-sized paging files spaced across physical disks spread out I/O most efficiently, because the operating system spreads paging evenly across page files.

Note:

Internal read/write batch size for Windows is 4K.

Closing All Unnecessary Foreground Applications

Once procedures in previous sections have been applied, remember to close any unnecessary foreground applications. First, remove all applications from Startup folders of Windows Server console operators. Second, minimize the window when executing long-running scripts from a command prompt, so that Windows Server can focus on the operation and not on a flood of window repaint messages. Third, disable screen savers, which can quickly saturate the CPU. If a screen saver must be run, choose Blank Screen, which uses the least amount of processing time.