ORA- 00845: MEMORY_TARGET not supported on this system
我建立虛拟機的時候 選擇的是8G的記憶體,但是檢查的時候報錯,我隻有4G提示 Swap分區不夠, 其實是可以使用DD指令解決的。 GG 同步不起。
解決Linux上11g的ORA-00845錯誤
下午想把一個11.2.0.2執行個體的memory_target AMM記憶體初始化參數修改到2000M,改好後重新開機發現執行個體起不來了,出現了ORA-00845錯誤:
[[email protected] ~]$
[[email protected] ~]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.2.0 Production on Tue May 3 19:43:50 2011
Copyright (c) 1982, 2010, Oracle. All rights reserved.
Connected to an idle instance.
SQL> startup nomount;
ORA-00845: MEMORY_TARGET not supported on this system
======================= ALERT.LOG======================
Starting ORACLE instance (normal)
WARNING: You are trying to use the MEMORY_TARGET feature.
This feature requires the /dev/shm file system to be mounted for at least 2097152000 bytes.
/dev/shm is either not mounted or is mounted with available space less than this size.
Please fix this so that MEMORY_TARGET can work as expected.
Current available is 1871466496 and used is 200790016 bytes.
Ensure that the mount point is /dev/shm for this directory.
memory_target needs larger /dev/shm
看起來是因為采用了Automatic Memory Management的特性,是以Oracle采用了一種基于POSIX的共享記憶體使用風格,在AMM中Oracle不像之前版本那樣利用”一整塊”記憶體作為SGA,而是使用一塊塊小的”chunk”,以滿足SGA與PGA之前交換記憶體的目的
針對上述ORA-00845錯誤,我們需要修改映射記憶體檔案夾/dev/shm的裝載參數,針對正在運作的Linux作業系統,可以remount這個tmpfs裝載點,如:
[[email protected] ~]# umount /dev/shm
umount: /dev/shm: device is busy
umount: /dev/shm: device is busy
[[email protected] ~]# ls /dev/shm
JOXSHM_EXT_0_PROD1_8323079 JOXSHM_EXT_25_PROD1_8323079 ora_+ASM1_7569414_11
JOXSHM_EXT_10_PROD1_8323079 JOXSHM_EXT_26_PROD1_8323079 ora_+ASM1_7569414_12
............
/* 可以看到如果ASM執行個體也使用AMM的話同樣會在/dev/shm目錄下産生記憶體映像
為了umount該裝載點,我們不得不首先shutdown ASM instance ! */
[[email protected] ~]# su - grid
[[email protected] ~]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.2.0 Production on Tue May 3 20:05:24 2011
Copyright (c) 1982, 2010, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production
With the Real Application Clusters and Automatic Storage Management options
SQL> shutdown immediate;
ORA-01031: insufficient privileges
SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production
With the Real Application Clusters and Automatic Storage Management options
[[email protected] ~]$ sqlplus / as sysasm
SQL*Plus: Release 11.2.0.2.0 Production on Tue May 3 20:05:32 2011
Copyright (c) 1982, 2010, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production
With the Real Application Clusters and Automatic Storage Management options
SQL> shutdown immediate;
ORA-15097: cannot SHUTDOWN ASM instance with connected client (process 1576)
SQL> shutdown abort;
ASM instance shutdown
SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production
With the Real Application Clusters and Automatic Storage Management options
[[email protected] ~]# umount /dev/shm
[[email protected] ~]# mount -t tmpfs shmfs -o size=4000m /dev/shm
/* 這裡的size指定了shm目錄的裝載大小,4000m可能對你的系統仍然不夠,
那麼你有理由設一個更大的值 */
[[email protected] ~]# mount|grep shmfs
shmfs on /dev/shm type tmpfs (rw,size=4000m)
Startup ASM...........
[[email protected] ~]# su - oracle
[[email protected] ~]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.2.0 Production on Tue May 3 20:09:40 2011
Copyright (c) 1982, 2010, Oracle. All rights reserved.
Connected to an idle instance.
SQL> startup nomount;
ORACLE instance started.
Total System Global Area 2087780352 bytes
Fixed Size 2228072 bytes
Variable Size 1476395160 bytes
Database Buffers 603979776 bytes
Redo Buffers 5177344 bytes
/* 執行個體啟動成功! */
上述umount/mount的方式隻在作業系統的此次生命周期中生效,如果重新開機的話shmfs目錄仍會以預設方式裝載;如果需要永久生效的話,我們需要修改系統參數檔案/etc/fstab中的shm條目:
/* 修改前的shm裝載參數 */
[[email protected] ~]# grep shm /etc/fstab
tmpfs /dev/shm tmpfs defaults 0 0
/* 修改後的shm裝載參數 */
[[email protected] ~]# grep shm /etc/fstab
tmpfs /dev/shm tmpfs rw,size=4000m 0 0
參考:
oracle啟動報錯:ORA- 00845: MEMORY_TARGET not supported on this system
今天啟動oracle的時候,報錯
[[email protected] ~]#su - oracle
[[email protected] ~]$lsnrctl start
lsnrctl: error while loading shared libraries: /u01/app/oracle/product/11.2.0/db_1/lib/libclntsh.so.11.1: cannot restore segment prot after reloc: Permission denied
解決辦法:在root使用者下執行以下指令
[[email protected] ~]# setenforce 0
[[email protected] ~]#su - oracle
[[email protected] ~]$lsnrctl start
LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 20-SEP-2012 19:03:03
Copyright (c) 1991, 2009, Oracle. All rights reserved.
Starting /u01/app/oracle/product/11.2.0/db_1/bin/tnslsnr: please wait...
TNSLSNR for Linux: Version 11.2.0.1.0 - Production
Log messages written to /u01/app/oracle/diag/tnslsnr/localhost/listener/alert/log.xml
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=localhost.localdomain)(PORT=1521)))
Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 11.2.0.1.0 - Production
Start Date 20-SEP-2012 19:03:04
Uptime 0 days 0 hr. 0 min. 1 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Log File /u01/app/oracle/diag/tnslsnr/localhost/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=localhost.localdomain)(PORT=1521)))
The listener supports no services
The command completed successfully
問題解決。
[[email protected] ~]$ sqlplus / as sysdba
SQL> startup
報錯:ORA-00845: MEMORY_TARGET not supported on this system
問題定位:安裝資料庫時或者修改了參數MEMORY_TARGET或者SGA_TARGET的大小。
SGA參數的大小超過了作業系統/dev/shm的大小。
linux安裝完後預設/dev/shm為實體記憶體的一半。
技術背景:linux大記憶體支援(Very Large Memory)中,使用了shmfs/tmpfs選項,ramfs也可以。
/dev/shm目錄挂載類型為tmpfs,此共享記憶體用于交換,尤其對于大檔案優勢明顯。
相對于ramfs,tmpfs的優勢在于動态調整實體記憶體的占用,而ramfs不能調整。
/dev/shm與swap的差別:shm基于記憶體的檔案系統,swap基于硬碟的檔案系統。
解決方法:
1、調整MEMORY_TARGET(11G)或者SGA_TARGET(9i,10G)大小(不建議)。
2、調整/dev/shm的大小。
修改/etc/fstab,重新mount /dev/shm,然後就可以啟動資料庫了。
(1)檢視/dev/shm 大小
df -k /dev/shm
Filesystem 1K-blocks Used Available Use% Mounted on
tmpfs 4089416 0 4089416 0% /dev/shm
(2)調整/dev/shm大小
vi /etc/fstab
#tmpfs /dev/shm tmpfs defaults 0 0
tmpfs /dev/shm tmpfs defaults,size=10240M 0 0
(3)重新加載
umount /dev/shm
mount /dev/shm
df -k /dev/shm
(4)登陸測試
sqlplus / as sysdba
至此問題得到解決。