Windows 32bit OS上物理内存限制以及ORACLE 10G 在32bit OS的SGA内存分配限制解决方法

时间:2022-10-20 03:59:11

今天有个朋友问起32位数据库的SGA 限制的问题,

现在整理如下,仅供参考学习之用。。

重要提示,操作有风险,建议先测试再实施,


原来由于32位操作系统本身的问题,内存只能认到不到4GB,好在微软加了一个什么参数PAE,解决了这个内存限制

在微软网站上看到的各个版本内存的最大扩展情况如下:
Physical Memory Limits: Windows Vista

The following table specifies the limits on physical memory for Windows Vista.

Version Limit in 32-bit Windows/Limit in 64-bit Windows
Windows Vista Ultimate 4 GB/ 128 GB


Windows Vista Enterprise 4 GB/128 GB


Windows Vista Business 4 GB/128 GB


Windows Vista Home Premium 4 GB/16 GB


Windows Vista Home Basic 4 GB/ 8 GB


Windows Vista Starter 1 GB / Not applicable

--------------------------------------------------------------------------------


Physical Memory Limits: Windows Home Server
Windows Home Server is available only in a 32-bit edition. The physical memory limit is 4 GB.


--------------------------------------------------------------------------------
Physical Memory Limits: Windows Server 2003
The following table specifies the limits on physical memory for Windows Server 2003. Limits over 4 GB for 32-bit Windows assume that PAE is enabled.

Version Limit in 32-bit Windows /Limit in 64-bit Windows
Windows Server 2003 with Service Pack 2 (SP2), Datacenter Edition 128 GB/2TB
Windows Server 2003 with Service Pack 2 (SP2), Enterprise Edition 64 GB/2 TB
Windows Storage Server 2003, Enterprise Edition 8 GB/ Not applicable
Windows Storage Server 2003 4 GB/ Not applicable
Windows Server 2003 R2 Datacenter Edition
Windows Server 2003 with Service Pack 1 (SP1), Datacenter Edition 128 GB /16 GB with 4GT/ 1 TB
Windows Server 2003 with Service Pack 1 (SP1), Enterprise Edition 64 GB/16 GB with 4GT/1TB
Windows Server 2003 R2 Standard Edition
Windows Server 2003, Standard Edition SP1
Windows Server 2003, Standard Edition SP2 4GB/32GB
Windows Server 2003, Datacenter Edition 128 GB/16 GB with 4GT/512GB

Windows Server 2003, Enterprise Edition 32 GB/16 GB with 4GT/64GB


Windows Small Business Server 2003 4 GB
Not applicable

Windows Compute Cluster Server 2003 Not applicable
32 GB

--------------------------------------------------------------------------------

Physical Memory Limits: Windows XP
The following table specifies the limits on physical memory for Windows XP.
Version Limit in 32-bit Windows Limit in 64-bit Windows
Windows XP 4 GB
128 GB
Windows XP Starter Edition 512 MB
Not applicable

--------------------------------------------------------------------------------


Physical Memory Limits: Windows 2000
The following table specifies the limits on physical memory for Windows 2000.

Version Limit in 32-bit Windows
Windows 2000 Professional 4 GB

Windows 2000 Server 4 GB

Windows 2000 Advanced Server 8 GB

Windows 2000 Datacenter Server 32 GB


--------------------------------------------------------------------------------

OS 是32bit 的,Oracle 数据库 也只能安装32bit 的,这样了就SGA也受到限制,最大不能超过1.7G

看着那大把的内存,但数据库用不上,怪可惜的。。通过下面的方法可以解开内存的限制/


- 在操作系统配置AWE,修改boot.ini文件

右击"我的电脑",选择"属性"-->高级选项卡,找到“启动与故障恢复”,单击“设置”,然后单击“编辑”,

加/PAE选项,修改后的文件如下:
[boot loader]
timeout=30
default=multi(0)disk(0)rdisk(0)partition(2)WINDOWS
[operating systems]
multi(0)disk(0)rdisk(0)partition(2)WINDOWS="Windows Server 2003, Enterprise" /noexecute=optout /fastdetect /pae

- 通过修改注册表,变成oracle可以使用的内存,
“开始”- “运行” -“regedit"
HKEY_LOCAL_MACHINESOFTWAREORACLEKEY_oracle_home1,
添加新的strings:AWE_WINDOW_MEMORY ,这个值是准备分配给数据库用的最大内存数(以BYTE为单位),例如你想分配3G,那这个值就是
3*1024*1024*1024
- 通过下面方法,修改参数让ORACLE DB能使用上刚分配出来的MEM

Sqlplus "/ as sysdba" R
SQLPLUS>create pfile from spfile;
SQLPLUS>Shutdown immediate
SQLPLUS>exit

- 修改ORACLE pfile
注释掉如下的参数:
sga_max_size
sga_target
DB_CACHE_SIZE
增加如下参数
修改或者添加以下参数
*.db_block_buffers=20000  #2G 为例
*.SHARED_POOL_SIZE=400000000 # 400M 为例
*.log_buffer=73000000 # 70M
*.use_indirect_data_buffers=true

sqlplus "/as sysdba"
sql>create spfile from pfile
sql>startup

- 通过以上的方法就可以让内存大大超过1.7GB了

但通过以上的方法修改后,可能在某些平台上会出现BUG,建议到METALINK查看相关NOTE

参考Notes:
Oracle Database and the Windows NT memory architecture, Technical Bulletin
Doc ID: 46001.1
Oracle Database Server and the Operating System Memory Limitations
Doc ID: 269495.1