Upon startup of Linux database get ORA-27102: out of memory Linux-X86_64 Error: 28: No space left on

 

Upon startup of Linux database get ORA-27102: out of memory Linux-X86_64 Error: 28: No space left on device [ID 301830.1]

 

Applies to:

Oracle Server - Enterprise Edition - Version: 9.2.0.4 to 11.2.0.2 - Release: 9.2 to 11.2
Red Hat Enterprise Linux Advanced Server x86-64 (AMD Opteron Architecture)
x86 64 bit (for Enterprise Linux only)
SUSE / UnitedLinux x86-64

Symptoms

When trying to increase the SGA to approach half available RAM with an Oracle 64bit version on a Linux 64bit operating system, even though shmmax is set to match half the amount of RAM, you get the following error when trying to start the instance:

SQL> startup nomount
ORA-27102: out of memory
Linux-x86_64 Error: 28: No space left on device

Changes

shmall is too small, most likely is set to the default setting of 2097152

$ cat /proc/sys/kernel/shmall
2097152

Cause

shmall is the total amount of shared memory, in pages, that the system can use at one time.

Solution

Set shmall equal to the sum of all the SGAs on the system, divided by the page size.

The page size can be determined using the following command:

$ getconf PAGE_SIZE
4096

For example, if the sum of all the SGAs on the system is 16Gb and the result of '$ getconf PAGE_SIZE' is 4096 (4Kb) then set shmall to 4194304 pages

As the root user set the shmall to 4194304 in the /etc/sysctl.conf file:

kernel.shmall = 4194304

then run the following command:

# sysctl -p
# cat /proc/sys/kernel/shmall
4194304

NOTE:

The above command loads the new value and a reboot is not necessary

Switch back to being the oracle user and retry the startup command.

 

 

 

 

From Oracle

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

QQ:492913789

Email:ahdba@qq.com

Blog: http://www.cndba.cn/dave


DBA1 群:62697716();   DBA2 群:62697977()   DBA3 群:62697850()  

DBA 超级群:63306533();  DBA4 群: 83829929  DBA5群: 142216823   

DBA6 群:158654907  聊天 群:40132017   聊天2群:69087192

--加群需要在备注说明Oracle表空间和数据文件的关系,否则拒绝申请

你遇到的错误: ``` ORA-27102: out of memory Linux-x86_64 Error: 28: No space left on device Additional information: 12582912 Additional information: 1 ``` 这个错误 **并不是磁盘空间不足**,尽管提示是 `No space left on device`,但实际上是 **共享内存(Shared Memory)分配失败**,通常是由于操作系统对 Oracle 实例使用的共享内存(如 System V shared memory 或 HugePages)配置不当导致。 --- ### 🔍 错误分析 - `ORA-27102: out of memory`:Oracle 无法分配所需的内存。 - `Linux-x86_64 Error: 28: No space left on device`:这是误导性信息。在 Linux 上,当系统无法分配共享内存段时,即使磁盘有空间,也会报这个错。 - `Additional information: 12582912`:表示 Oracle 尝试分配的内存页数(单位是页,通常是 4KB),即约: ``` 12582912 * 4KB = 50,331,648 KB ≈ 48 GB ``` 这说明你的 `pfile` 中设置的 SGA 太大,超出了操作系统允许的共享内存上限。 --- ## ✅ 解决方案 ### ✅ 方案一:减小 SGA 大小(临时解决) 编辑你的 pfile 文件: ```bash vi /data/oracle/product/11.2.0/db_1/dbs/initcatinfo.ora ``` 找到以下参数并调小: ```sql sga_max_size=4G sga_target=4G pga_aggregate_target=1G ``` > ⚠️ 根据你服务器实际内存调整,比如如果你只有 8GB 内存,不要设 SGA 超过 4~5GB。 然后尝试启动: ```sql SQL> startup pfile='/data/oracle/product/11.2.0/db_1/dbs/initcatinfo.ora'; ``` --- ### ✅ 方案二:配置内核参数(永久解决) 你需要修改 Linux 内核参数,允许更大的共享内存段。 #### 1. 修改 `/etc/sysctl.conf` ```bash sudo vi /etc/sysctl.conf ``` 添加或修改以下内容: ```conf # 共享内存最大值(字节),例如设为 8GB kernel.shmmax = 8589934592 # 总共可分配的共享内存页数(根据需要调整) kernel.shmall = 2097152 # 可选:启用大页支持 vm.nr_hugepages = 1024 ``` > 📌 `shmmax` 建议设为物理内存的一半到 80%,不能超过物理内存。 应用配置: ```bash sudo sysctl -p ``` #### 2. 确保用户有权限使用共享内存 检查 `/etc/security/limits.conf`: ```bash sudo vi /etc/security/limits.conf ``` 为 oracle 用户添加: ```conf oracle soft memlock unlimited oracle hard memlock unlimited oracle soft nofile 65536 oracle hard nofile 65536 oracle soft nproc 16384 oracle hard nproc 16384 ``` #### 3. 重启数据库实例 切换到 oracle 用户并启动: ```bash su - oracle sqlplus / as sysdba SQL> startup pfile='/data/oracle/product/11.2.0/db_1/dbs/initcatinfo.ora'; ``` --- ### ✅ 方案三:使用 Automatic Memory Management (AMM) → 改用 ASMM(推荐用于 11g) Oracle 11g 支持 AMM(`memory_target`),但它使用 `tmpfs` 的 `/dev/shm`,如果 `/dev/shm` 太小也会出错。 #### 检查 `/dev/shm` 大小: ```bash df -h /dev/shm ``` 输出示例: ``` tmpfs 2G 0 2G 0% /dev/shm ``` 如果太小,重新挂载: ```bash sudo mount -o remount,size=8G /dev/shm ``` 永久生效,修改 `/etc/fstab`: ```bash tmpfs /dev/shm tmpfs defaults,size=8G 0 0 ``` > 注意:使用 `memory_target` 时,Oracle 使用 `/dev/shm`;而使用 `sga_target` + `pga_aggregate_target`(ASMM)则不依赖 `/dev/shm`。 ✅ 建议:如果你不需要 AMM,建议关闭 `memory_target`,改用 `sga_target` 和 `pga_aggregate_target`。 --- ## 🛠 示例 PFILE 调整(安全版) ```sql cat > $ORACLE_HOME/dbs/initcatinfo.ora << EOF db_name='catinfo' instance_name='catinfo' sga_max_size=4G sga_target=4G pga_aggregate_target=1G shared_pool_size=1G large_pool_size=100M java_pool_size=100M log_buffer=20M memory_target=0 # 关闭 AMM memory_max_target=0 # 关闭 AMM processes=150 background_dump_dest='/data/oracle/admin/catinfo/bdump' user_dump_dest='/data/oracle/admin/catinfo/udump' core_dump_dest='/data/oracle/admin/catinfo/cdump' undo_tablespace='UNDOTBS1' remote_login_passwordfile='EXCLUSIVE' EOF ``` --- ## ✅ 验证是否解决 启动后执行: ```sql SQL> show sga; SQL> select name, value from v$parameter where name in ('sga_max_size','sga_target','memory_target'); ``` ---
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值