启动portal进程发现启动报错:
Caused by: java.sql.SQLRecoverableException: ORA-01034: ORACLE not available
ORA-27102: out of memory
Linux-x86_64 Error: 12: Cannot allocate memory
Additional information: 1
Additional information: 5177350
Additional information: 8
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:445)
然后查看数据库
SQL> shutdown immediate;
ORA-01034: ORACLE not available
ORA-27102: out of memory
Linux-x86_64 Error: 12: Cannot allocate memory
Additional information: 1
Additional information: 5177350
Additional information: 8
------发现数据库也不能停止了,指定的账号也不能登录了。查看一下系统内存
[oracle@localhost ~]$ free -m
total used free shared buffers cached
Mem: 8309 8253 56 0 2 1561
-/+ buffers/cache: 6689 1620
Swap: 2015 2015 0
---------------------------------------------发现 系统内存不足
top命令查看时哪些进程占用了系统内存,然后杀掉那些进程
-------top命令查看发现是很多java进程占用了系统内存,杀掉那些进程,内存释放,问题解决
top - 09:35:52 up 31 days, 17:37, 4 users, load average: 0.00, 0.24, 0.51
Tasks: 134 total, 2 running, 132 sleeping, 0 stopped, 0 zombie
Cpu(s): 0.0%us, 0.0%sy, 0.0%ni,100.0%id, 0.0%wa, 0.0%hi, 0.0%si, 0.0%st
Mem: 8509244k total, 3470528k used, 5038716k free, 7656k buffers
Swap: 2064376k total, 16048k used, 2048328k free, 3209660k cached
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
1 root 15 0 10372 664 556 S 0.0 0.0 0:07.11 init
2 root RT -5 0 0 0 S 0.0 0.0 0:00.00 migration/0
3 root 34 19 0 0 0 S 0.0 0.0 0:00.11 ksoftirqd/0
4 root 10 -5 0 0 0 S 0.0 0.0 0:05.47 events/0
5 root 10 -5 0 0 0 S 0.0 0.0 0:00.93 khelper
81 root 10 -5 0 0 0 S 0.0 0.0 0:00.00 kthread
85 root 10 -5 0 0 0 S 0.0 0.0 0:00.75 kblockd/0
86 root 20 -5 0 0 0 S 0.0 0.0 0:00.00 kacpid
244 root 19 -5 0 0 0 S 0.0 0.0 0:00.00 cqueue/0
247 root 19 -5 0 0 0 S 0.0 0.0 0:00.00 khubd
[oracle@localhost ~]$ free -m
total used free shared buffers cached
Mem: 8309 3382 4927 0 7 3131
-/+ buffers/cache: 243 8066
Swap: 2015 15 2000
[oracle@localhost ~]$
-----以下是网上的解答,不适合我的情况
今天做压力测试的时候,修改数据参数出现ORA-27102: out of memory错误,最后发现是系统参数设置的问题,限制了oracle的sga大小
修改系统参数前,一定要备份参数文件,
create spfile from pfile=‘/opt/oracle/product/11.1/db_1/dbs/initorcl.ora’;
------- 查看sga的大小
SQL> show parameter sga
NAME TYPE VALUE
lock_sga boolean FALSE
pre_page_sga boolean FALSE
sga_max_size big integer 1552M
sga_target big integer 1536M
修改sga_max_size
alter system set sga_max_size=10240M scope=spfile;
重新启动数据库
SQL> startup force
ORA-27102: out of memory
Error: 28: No space left on device
出现ORA-27102错误,这是我们可以使用备分的参数文件启动数据库;
startup pfile=‘/opt/oracle/product/11.1/db_1/dbs/initorcl.ora’;
问题到这里,虽然库可以启动,但参数还是没有改。
这是我们可以修改一下系统参数/etc/sysctl.conf文件中的kernel.shmall参数
原参数
fs.file-max = 6553600
kernel.shmall=2097152
kernel.shmmax=2147483648
kernel.shmmni=4096
修改后为
fs.file-max = 6553600
kernel.shmall = 4194304
kernel.shmmax = 2147483648
kernel.shmmni = 4096
修改完这些参数后,我们就可以正常启动了
先创建spfile,然后我们以spfile启动
SQL> create spfile from pfile;
File created.
SQL> startup force
ORACLE instance started.
Total System Global Area 1620189184 bytes
Fixed Size 2144824 bytes
Variable Size 922748360 bytes
Database Buffers 671088640 bytes
Redo Buffers 24207360 bytes
Database mounted.
Database opened.
我们再次修改
alter system set sga_max_size=10240M scope=spfile;
orcl@SYS>startupforce
ORACLE instance started.
Total System Global Area 1.0689E+10 bytes
Fixed Size 2147392 bytes
Variable Size 9596570560 bytes
Database Buffers 1073741824 bytes
Redo Buffers 17014784 bytes
Database mounted.
Database opened.
问题成功解决