編寫shell腳本在Linux服務器中通過cron服務定時執行自動備份,每次備份完成後在結尾操作中數據庫報錯,服務被關閉。shell腳本單獨執行備份沒有問題。查看alert日誌發現以下錯誤信息:
Errors in file /d12/app/oracle/diag/rdbms/rac12c/rac12c2/trace/rac12c2_j000_21047.trc:
ORA-27157: OS post/wait facility removed
ORA-27300: OS system dependent operation:semop failed with status: 43
ORA-27301: OS failure message: Identifier removed
ORA-27302: failure occurred at: sskgpwwait1
原因定位:
在rhel7在rhel7.2中,systemd-logind服務引入了一個新特性:在一個user完全退出OS後會remove掉所有的IPC對象。
該特性由/etc/systemd/logind.conf參數文件中RemoveIPC選項來控制。詳細請看man logind.conf(5)。
在rhel7.2中,RemoveIPC的默認值是yes
因此,當最後一個oracle或者grid用戶退出時,操作系統會remove掉這個user的shared memory segments和semaphores
而Oracle ASM和database的SGA需要使用 shared memory segments,因此remove shared memory segments將會crash掉Oracle ASM和database instances。
請參考Redhat bug 1264533 - https://bugzilla.redhat.com/show_bug.cgi?id=1264533
這個問題會影響使用shared memory segments和semaphores的所有應用,因此,Oracle ASM 實例和Oracle Database 實例均受到影響。
oel7.2爲了避免這個問題,在/etc/systemd/logind.conf配置文件中明確設置RemoveIPC爲no。
1).設置/etc/systemd/logind.conf中RemoveIPC=no
2).重啓服務器或者重啓systemd-logind
重啓systemd-logind:
# systemctl daemon-reload
# systemctl restart systemd-logind