oracledba.help
Windows

Oracle Best Practices on Windows

Overview

Since the earliest versions of Windows, Oracle databases have had to contend with Windows peculiarities that inhibit normal operations. In some cases they only affect performance. In more acute cases they can cause database crashes and corruption. The following is a listing of recommendations to help avoid these quandaries. Apply these where appropriate for your environment.

Recommendations

  • If possible migrate database to LINUX or UNIX.
  • If you must use Windows migrate to the 64-bit version if possible.
  • If it is a production system ensure that it is dedicated to being an Oracle database server exclusively. This means not installing other Oracle software (like OAS) or having the server perform any other roles (application server, file server, print server etc.).
  • Do not compress any volume that contains Oracle files. Oracle does not support this.
    Alert: The Windows Disk Cleanup program can selectively compress files!
  • In Windows 2008 and later, for scheduling jobs use System Scheduler by Splinterware.
  • Disable all real-time virus/spyware scanning options. Note: real-time updates are generally OK. Norton's Live Update for example.
  • Only perform full system virus/spyware scans during maintenance windows. Ensure the database is down while performing.
  • Only perform OS patches during maintenance windows. Ensure the database is down while performing.
  • Set the following services Startup Type option to manual then reboot.
    • Oracle Enterprise Manager (OEM/dbconsole)
    • Spyware Scanning
    • Windows Indexing Service
    • Windows OS Patch Updates
    • Virus Scanning
  • Only start OEM as needed after the database is up.
  • If you must perform virus/spyware scans with the database open exclude the following Oracle directories (per Oracle Doc ID 782354.1):
    • Data directories (x:\oradata).
    • Data Pump file directories (x:\exports).
      ** Directory Object and UTIL_FILE_DIR related directories.
    • Instance related files (.arc, .ctl, .dbf, .log, .ora, .rdo).
    • ORACLE_BASE (c:\app\oracle).
    • RMAN file directories (x:\rman).
    • Also C:\Program Files\Devstudio if installed (per Oracle).
  • Routinely run defrag on all disks.
  • You have to bounce the database for the quarterly CPUs (Critical Patch Update). During the same maintenance windows it is a good idea to also perform a proactive system OS reboot.

Windows Defrag

If your Oracle files reside on a Windows managed drive it may become highly fragmented and thus effect performance. To keep your drives fragmentation low use the Windows defrag utility routinely. This must be run from an Administrator account and when the database is down. Change the drive letter below from C: to the desired drive.

   Analyze: defrag C: -a

   Defrag:
      2008 = defrag C: -h -u -v
      2003 = defrag C: -f

Windows 2008 Defrag vs. Scripts

Because of the File System Redirector calling defrag from a script is nearly impossible! You are just going to have to punt and run it from the MS Task Scheduler (sorry). Other than having to use the MS Task Scheduler for running defrag, I recommend using System Scheduler by Splinterware for everything else.

 Launch:       C:\windows\system32\taskschd.msc /s
 Navigate to:  Microsoft -> Windows -> Defrag
 Arguments:    Properties -> Actions tab  -> Edit -> Add arguments: -c -h
 Schedule:     Properties -> Triggers tab -> Edit -> Weekly -> a. Start time.
                                                               b. Select day(s).
                                                               c. Select [x] Enable

Ultimately you may find the Windows defrag program is inaccurate and not very robust. If that is the case Defraggler by Piriform is a really good option.

In Defraggler Exclude these via the menu: Settings -> Options

  • listener*.log
  • log*.xml
  • pagefile.*

Windows Junctions

Windows 2000 and higher supports directory symbolic links, where a directory serves as a symbolic link to another directory on the computer. Windows refers to these as junctions. To download go here. One common usage of this is where you need to use a fixed directory path but do not have the disk space on that drive. Using junctions is seen as a band-aide when you are unable to reconfigure a system. Do not use in production unless tested thoroughly for your environment.

Usage

-- Create
To create a junction C:\rman (link) to R:\rman (physical directory).

1. Make sure C:\rman does not exist on C:.
2. C:\> md R:\rman (if not already exists).
3. C:\> junction C:\rman R:\rman

-- Delete
junction -d C:\rman

-- Display
To be able to view the junctions on a volume (C, D etc.), just go to DOS and issue a dir command. Junctions will be listed as <JUNCTION> instead of <DIR>. If not use the below.

To determine if a file is a junction, specify the file name:
   junction c:\test

To list junctions beneath a directory, include the –s switch:
   junction -s c:\

Purging Oracle Off a Windows System

  1. Shutdown the Oracle database, listener and OEM.
  2. Run the Oracle Universal Installer and select the Remove option.
  3. Purge all Oracle registry entries.
  4. Remove any ORACLE_* environment variables.
  5. Reboot the system.
  6. Delete the installed directories:
    Example:
    C:\app\oracle\product\11.2.0.3\dbhome_1
    If you cannot delete a directory try renaming it, rebooting then attempting to delete it again.
  7. Remove any Oracle services still showing up: Usage: sc delete Example: sc delete OracleDBConsoleDB1
  8. Remove the ora_dba group.

Windows Resource Monitor

On newer Windows OS's you can use the Resource Monitor which can show you real-time vital information on all your Oracle datafiles. To create shortcut to this use:

 WINDIR\system32\perfmon.exe /res

Windows 11g Services

In Oracle 11g the following core (essential) services will be active for all databases. Start them in this order and shut them down in reverse order:

  1. OracleService{SID}
  2. OracleJobScheduler{SID} (if used)
  3. OracleMTSRecoveryService
  4. OracleOraDb11g_homeTNS{Listener}
  5. OracleDBConsole{SID} (if used)

Other services that may be initially active include:

  • OracleOraDb11g_home1ClrAgent
  • OracleRemExecService
  • Oracle {SID} VSS Windows Service

Misc Tools

  • System Information: C:\> systeminfo|more
  • Graphical version of systeminfo: C:\> msinfo32

<- Windows