编写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