{
  "date": "2016-06-16T17:48:18",
  "slug": "large-pages-on-windows",
  "link": "https://www.dbi-services.com/blog/large-pages-on-windows/",
  "title": {
    "rendered": "Large Pages on Windows"
  },
  "content": {
    "rendered": "<h2>By Franck Pachot</h2>\n<p>.<br />\n<!--more--></p>\n<h3>ORA_LPENABLE</h3>\n<p>To let Oracle use Large Pages on Windows, you need to define a registry string ORA_LPENABLE=1. This will enable large pages for all instance so it&#8217;s probably better to do it at instance level with ORA_<em>SID</em>_LPENABLE, especially if you have an ASM instance on your server. Note that large pages is a recommandation for an database server but if you have other applications that use lot of memory you may lack of memory because of fragmentation.</p>\n<p>Stopping the service:</p>\n<pre><code>\nC:\\cygwin64\\bin&gt;net stop OracleServiceCDB\nThe OracleServiceCDB service is stopping.\nThe OracleServiceCDB service was stopped successfully.\n</code></pre>\n<p>Showing the registry:</p>\n<pre><code>\nC:\\cygwin64\\bin&gt;reg query HKLM\\Software\\Oracle\\Key_OraDB12Home1\n&nbsp;\nHKEY_LOCAL_MACHINE\\Software\\Oracle\\Key_OraDB12Home1\n    ORACLE_HOME    REG_SZ    C:\\app\\oracle\\product\\12.1.0\\EE12101\n    ORACLE_HOME_NAME    REG_SZ    OraDB12Home1\n    ORACLE_GROUP_NAME    REG_SZ    Oracle - OraDB12Home1\n    NLS_LANG    REG_SZ    AMERICAN_AMERICA.WE8MSWIN1252\n    ORACLE_BUNDLE_NAME    REG_SZ    Enterprise\n    OLEDB    REG_SZ    C:\\app\\oracle\\product\\12.1.0\\EE12101\\oledb\\mesg\n    ORACLE_HOME_TYPE    REG_SZ    1\n    ORACLE_SVCUSER    REG_SZ    oracle\n    ORACLE_SVCUSER_PWDREQ    REG_SZ    1\n    ORACLE_BASE    REG_SZ    C:\\app\\oracle\n    MSHELP_TOOLS    REG_SZ    C:\\app\\oracle\\product\\12.1.0\\EE12101\\MSHELP\n    ORACLE_HOME_KEY    REG_SZ    SOFTWARE\\ORACLE\\KEY_OraDB12Home1\n    SQLPATH    REG_SZ    C:\\app\\oracle\\product\\12.1.0\\EE12101\\dbs\n    RDBMS_CONTROL    REG_SZ    C:\\app\\oracle\\product\\12.1.0\\EE12101\\DATABASE\n    RDBMS_ARCHIVE    REG_SZ    C:\\app\\oracle\\product\\12.1.0\\EE12101\\DATABASE\\ARCHIVE\n    ORA_CDB_AUTOSTART    REG_EXPAND_SZ    TRUE\n    ORA_CDB_SHUTDOWN    REG_EXPAND_SZ    TRUE\n    ORA_CDB_SHUTDOWNTYPE    REG_EXPAND_SZ    immediate\n    ORA_CDB_SHUTDOWN_TIMEOUT    REG_EXPAND_SZ    90\n    ORACLE_SID    REG_SZ    CDB\n    ORA_LPENABLE    REG_SZ    1\n&nbsp;\nHKEY_LOCAL_MACHINE\\Software\\Oracle\\Key_OraDB12Home1\\ODE\nHKEY_LOCAL_MACHINE\\Software\\Oracle\\Key_OraDB12Home1\\OLEDB\n</code></pre>\n<p>Starting the service:</p>\n<pre><code>C:\\cygwin64\\bin&gt;net start OracleServiceCDB\nThe OracleServiceCDB service is starting...\nThe OracleServiceCDB service was started successfully.</code></pre>\n<p>and tailing the alert.log:</p>\n<pre><code>C:\\cygwin64\\bin&gt;adrci exec=\"set home cdb ; show alert -tail 5\"\n2016-06-13 12:51:22.709000 -07:00\nArchiving is disabled\n2016-06-13 12:51:32.153000 -07:00\nInstance shutdown complete\n2016-06-13 12:51:38.179000 -07:00\nStarting ORACLE instance (normal) (OS id: 1620)\nCLI notifier numLatches:3 maxDescs:519\nLarge page enabled. Mode is : 1\nLarge page size            : 2097152\nLarge page request size    : 16777216\n2016-06-13 13:00:38.599000 -07:00\nStarting ORACLE instance (normal) (OS id: 1760)\nCLI notifier numLatches:3 maxDescs:519\nLarge page enabled. Mode is : 1\nLarge page size            : 2097152\nLarge page request size    : 16777216\n2016-06-13 13:01:37.707000 -07:00\nStarting ORACLE instance (normal) (OS id: 1888)\nCLI notifier numLatches:3 maxDescs:519\nLarge page enabled. Mode is : 1\nLarge page size            : 2097152\nLarge page request size    : 16777216</code></pre>\n<p>You can see my registry entries on the right and the alert.log on the left.</p>\n<p><a href=\"https://www.dbi-services.com/blog/wp-content/uploads/sites/2/2022/04/CaptureWCLP001.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https://www.dbi-services.com/blog/wp-content/uploads/sites/2/2022/04/CaptureWCLP001.png\" alt=\"CaptureWCLP001\" width=\"955\" height=\"783\" class=\"alignnone size-full wp-image-9242\" /></a></p>\n<p>But this is not sufficient to start the instance:</p>\n<p><a href=\"https://www.dbi-services.com/blog/wp-content/uploads/sites/2/2022/04/CaptureWCLP003.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https://www.dbi-services.com/blog/wp-content/uploads/sites/2/2022/04/CaptureWCLP003.png\" alt=\"CaptureWCLP003\" width=\"736\" height=\"168\" class=\"alignnone size-full wp-image-9243\" /></a></p>\n<h3>Lock pages in memory</h3>\n<p>In 12c you can, and you should, run the Oracle Database instance as another user than the system administrator.<br />\nLarge pages must be locked in physical memory (and that&#8217;s one good reason to use them) but by default non administrators do not have this privilege.</p>\n<p>You have to allow it with the Local Goup Policy Editor. Unfortunately, doing that in a Windows Server Core seems to be very difficult because gpedit-msc is not there.</p>\n<p>At that point, my enthousiasm for Windows Core ended and I installed Windows Server GUI.</p>\n<p><a href=\"https://www.dbi-services.com/blog/wp-content/uploads/sites/2/2022/04/VirtualBox_Windows-2012-Server_14_06_2016_22_45_05.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https://www.dbi-services.com/blog/wp-content/uploads/sites/2/2022/04/VirtualBox_Windows-2012-Server_14_06_2016_22_45_05.png\" alt=\"VirtualBox_Windows 2012 Server_14_06_2016_22_45_05\" width=\"961\" height=\"743\" class=\"alignnone size-full wp-image-9245\" /></a></p>\n<p>Now I can startup. Here is the alert.log:</p>\n<pre><code>\nStarting ORACLE instance (normal) (OS id: 2620)\nWed Jun 15 09:53:12 2016\nCLI notifier numLatches:7 maxDescs:519\nWed Jun 15 09:53:12 2016\nLarge page enabled. Mode is : 1\nWed Jun 15 09:53:12 2016\nLarge page size            : 2097152\nLarge page request size    : 16777216\nWed Jun 15 09:53:12 2016\nAllocated Large Pages memory of size :         14680064 \nWed Jun 15 09:53:12 2016\nAllocated Large Pages memory of size :       1660944384 \nLICENSE_MAX_SESSION = 0\nLICENSE_SESSIONS_WARNING = 0\nInitial number of CPU is 4\nNumber of processor cores in the system is 4\nNumber of processor sockets in the system is 1\nPicked latch-free SCN scheme 3\nUsing LOG_ARCHIVE_DEST_1 parameter default value as USE_DB_RECOVERY_FILE_DEST\nAutotune of undo retention is turned on. \nIMODE=BR\nILAT =51\nLICENSE_MAX_USERS = 0\nSYS auditing is enabled\nNOTE: remote asm mode is local (mode 0x1; from cluster type)\nNOTE: Using default ASM root directory ASM\nOracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production\nWith the Partitioning, OLAP, Advanced Analytics and Real Application Testing options.\nWindows NT Version V6.2  \nCPU                 : 4 - type 8664, 4 Physical Cores\nProcess Affinity    : 0x0x0000000000000000\nMemory (Avail/Total): Ph:5718M/8191M, Ph+PgF:7735M/10111M \n</code></pre>\n<p>And yes, I am in Automatic Memory Management (AMM) where size of PGA and SGA is dynamically resized by Oracle within MEMORY_TARGET:</p>\n<pre><code>\nUsing parameter settings in server-side spfile C:\\APP\\ORACLE\\PRODUCT\\12.1.0\\DBHOME_1\\DATABASE\\SPFILECDB.ORA\nSystem parameters with non-default values:\n  processes                = 300\n  use_large_pages          = \"ONLY\"\n  memory_target            = 1600M\n  control_files            = \"C:\\APP\\ORACLE\\ORADATA\\CDB\\CONTROL01.CTL\"\n  control_files            = \"C:\\APP\\ORACLE\\FAST_RECOVERY_AREA\\CDB\\CONTROL02.CTL\"\n  db_block_size            = 8192\n  compatible               = \"12.1.0.2.0\"\n  db_recovery_file_dest    = \"C:\\app\\oracle\\fast_recovery_area\"\n  db_recovery_file_dest_size= 500M\n  _catalog_foreign_restore = FALSE\n  undo_tablespace          = \"UNDOTBS1\"\n  remote_login_passwordfile= \"EXCLUSIVE\"\n  db_domain                = \"\"\n  dispatchers              = \"(PROTOCOL=TCP) (SERVICE=CDBXDB)\"\n  audit_file_dest          = \"C:\\APP\\ORACLE\\ADMIN\\CDB\\ADUMP\"\n  audit_trail              = \"DB\"\n  db_name                  = \"CDB\"\n  open_cursors             = 300\n  diagnostic_dest          = \"C:\\APP\\ORACLE\"\n  enable_pluggable_database= TRUE\n</code></pre>\n<p><del datetime=\"2016-12-18T00:07:08+00:00\">On Windows, all Oracle &#8220;processes&#8221; run as threads of the same Windows process, I don&#8217;t see any reason to advise against AMM there.<br />\nNote that I don&#8217;t see any reason to recommend it either&#8230;</del></p>\n<h3><del datetime=\"2016-12-18T00:07:08+00:00\">Update 20-JUN-2016</del></h3>\n<p><del datetime=\"2016-12-18T00:07:08+00:00\">My Oracle Support engineer has confirmed that there is no problem to use AMM with large pages on windows systems. <a href=\"https://support.oracle.com/epmos/faces/DocumentDisplay?parent=SrDetailText&amp;sourceId=3-12946215861&amp;id=422844.1\">Doc ID 422844.1 -&#8220;Using Large Memory Pages on 64-Bit Windows Systems&#8221;</a> confirms that large pages are used only for SGA, not PGA, so only SGA is locked in memory and 2MB pages. However, I think it&#8217;s a good idea to set SGA_TARGET to get a minimum that keeps allocated because frequent resizing may lead to fragmentation. And if you want to allocate small pages when large pages are not available, you can set ORA_LPENABLE=2 since 12c.</del></p>\n<h3>Added 18th December 2016</h3>\n<p>My tests (see <a href=\"http://dbi-services.com/blog/large-pages-and-memory_target-on-windows/\" target=\"_blank\" rel=\"noopener noreferrer\">http://dbi-services.com/blog/large-pages-and-memory_target-on-windows/</a>) show that it&#8217;s not a good idea to mix AMM and Large Pages even on Windows, and this is why I deleted the previous update. Oracle developers have confirmed that we should avoid AMM with Large Pages.</p>\n",
    "protected": false
  }
}
