由Swap故障引起的ORA-01034: ORACLE not available ORA-27102: out of memory 問題


Oracle數據突然連不上,提示如下,最初以為是sga_memory_target出問題,連上去查看一樣出錯

[oracle@oracle:/home/oracle]$sqlplus 'roobbin/"ran0.123456"@121.37.158.xx:1521/orcl'

SQL*Plus: Release 11.2.0.4.0 Production on Wed Oct 28 10:51:15 2020

Copyright (c) 1982, 2013, Oracle.  All rights reserved.

ERROR:
ORA-01034: ORACLE not available
ORA-27102: out of memory
Linux-x86_64 Error: 12: Cannot allocate memory
Additional information: 26
Additional information: 458753
Additional information: 1627389952
Process ID: 0
Session ID: 0 Serial number: 0

如下

[oracle@oracle:/home/oracle]$sqlplus / as sysdba

SQL*Plus: Release 11.2.0.4.0 Production on Wed Oct 28 10:51:48 2020

Copyright (c) 1982, 2013, Oracle.  All rights reserved.

Connected to an idle instance.

SQL> show parameter sga;
ORA-01034: ORACLE not available
Process ID: 0
Session ID: 0 Serial number: 0


SQL> exit

嘗試進入mount一樣無果

[oracle@oracle:/home/oracle]$sqlplus /nolog          

SQL*Plus: Release 11.2.0.4.0 Production on Wed Oct 28 10:55:53 2020

Copyright (c) 1982, 2013, Oracle.  All rights reserved.

SQL> conn / as sysdba
Connected to an idle instance.
SQL> show paramater sga;
SP2-0158: unknown SHOW option "paramater"
ORA-01034: ORACLE not available
Process ID: 0
Session ID: 0 Serial number: 0


SQL> shutdown immediate;
ORA-01034: ORACLE not available
ORA-27102: out of memory
Linux-x86_64 Error: 12: Cannot allocate memory
Additional information: 26
Additional information: 458753
Additional information: 1627389952
SQL> startup mount;
ORA-00845: MEMORY_TARGET not supported on this system
SQL> exit
Disconnected

隨后出現了這個提示

SQL> startup mount;
ORA-00845: MEMORY_TARGET not supported on this system

剛開始不知道這個提示是由於swap沒了導致。折騰了很久去看內存發現swap沒了

root@oracle datax-web-2.1.2]# free -m
              total        used        free      shared  buff/cache   available
Mem:           3788        1708         122         892        1958         949
Swap:             0           0           0

隨后把swap加上數據庫立馬就恢復正常了,添加命令如下

[root@oracle datax-web-2.1.2]# dd if=/dev/zero of=/swapfile bs=1024 count=4194304
4194304+0 records in
4194304+0 records out
4294967296 bytes (4.3 GB) copied, 25.8686 s, 166 MB/s
[root@oracle datax-web-2.1.2]# mkswap /swapfile 
Setting up swapspace version 1, size = 4194300 KiB
no label, UUID=f0d30855-a3a0-4b09-85ff-f5a393059382
[root@oracle datax-web-2.1.2]# swap
swaplabel  swapoff    swapon     
[root@oracle datax-web-2.1.2]# swapon /swapfile 
swapon: /swapfile: insecure permissions 0644, 0600 suggested.
[root@oracle datax-web-2.1.2]# free -h
              total        used        free      shared  buff/cache   available
Mem:           3.7G        1.7G        154M        892M        1.9G        934M
Swap:          4.0G          0B        4.0G

加完后在連上數據庫就正常了

[oracle@oracle:/home/oracle]$sqlplus / as sysdba

SQL*Plus: Release 11.2.0.4.0 Production on Wed Oct 28 11:42:00 2020

Copyright (c) 1982, 2013, Oracle.  All rights reserved.


Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL> show parameter sga;

NAME                     TYPE     VALUE
------------------------------------ ----------- ------------------------------
lock_sga                 boolean     FALSE
pre_page_sga                 boolean     FALSE
sga_max_size                 big integer 1520M
sga_target                 big integer 0
SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

做完吧swap加入fstab里面去。也不知道為啥swap突然就沒了

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM