ipcs、ipcrm和sysresv在Oracle中的使用

0    306    3

Tags:

👉 本文共约8212个字,系统预计阅读时间或需31分钟。

前言部分

导读和注意事项

各位技术爱好者,看完本文后,你可以掌握如下的技能,也可以学到一些其它你所不知道的知识,~O(∩_∩)O~:

① ipcs的使用

② ipcrm释放oracle内存段

③ sysresv的使用

本文简介

同事搭建DG的时候报错了,然后强制退出会话,结果sqlplus不能进入,且看正文部分。

相关知识点扫盲

unix/linux下的共享内存、信号量、队列信息管理
在unix/linux下,经常有因为共享内存、信号量,队列等共享信息没有干净地清楚而引起一些问题。
查看共享信息的内存的命令是ipcs [-m|-s|-q]。

默认会列出共享内存、信号量,队列信息,-m列出共享内存,-s列出共享信号量,-q列出共享队列
清除命令是ipcrm [-m|-s|-q] id。
-m 删除共享内存,-s删除共享信号量,-q删除共享队列。

故障分析及解决过程

故障环境介绍

项目source db
db 类型rac
db version11.2.0.4
db 存储ASM
ORACLE_SIDoraDESDB2
db_nameoraDESDB
OS版本及kernel版本AIX 64位 7.1.0.0
OS hostnameZFLHRDB2

故障发生现象及解决过程

oracle的进程已经关闭,但是执行sqlplus的时候hang住,之后报错ORA-09925: Unable to create audit trail file,加-prelim也不行,主要是oracle的进程已经关掉了,但是sqlplus却进不去。

ZFLHRDB4:oracle:/oracle>ps -ef|grep ora_

ZFLHRDB4:oracle:/oracle>sqlplus / as sysdba

SQL*Plus: Release 11.2.0.4.0 Production on Tue May 31 14:39:47 2016

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

ERROR:

ORA-09925: Unable to create audit trail file

IBM AIX RISC System/6000 Error: 2: No such file or directory

Additional information: 9925

ORA-09925: Unable to create audit trail file

IBM AIX RISC System/6000 Error: 2: No such file or directory

Additional information: 9925

ZFLHRDB4:oracle:/oracle>sqlplus -prelim / as sysdba

SQL*Plus: Release 11.2.0.4.0 Production on Tue May 31 14:40:26 2016

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

ERROR:

ORA-09925: Unable to create audit trail file

IBM AIX RISC System/6000 Error: 2: No such file or directory

Additional information: 9925

ORA-09925: Unable to create audit trail file

IBM AIX RISC System/6000 Error: 2: No such file or directory

Additional information: 9925

IPC status from /dev/mem as of Tue May 31 14:42:01 BEIST 2016

T ID KEY MODE OWNER GROUP

Message Queues:

q 0 0x9283a0d2 -Rrw------- root system

q 1 0xffffffff ----------- root system

Shared Memory:

m 3 0x210000ac --rw-rw---- root system

m 395313156 0x0ecaefdc --rw-r----- oracle asmadmin

m 9437189 00000000 --rw-r----- oracle asmadmin

m 276824070 00000000 --rw-r----- oracle asmadmin

m 912261127 0x210000d4 --rw-rw---- grid dba

Semaphores:

s 3145728 0x0100324a --ra-ra-r-- root system

s 1 0x620025b4 --ra-r--r-- root system

s 2 0x02001958 --ra-ra-ra- root system

s 3 0x01001958 --ra-ra-ra- root system

s 9 0x010024be --ra------- root system

s 3145738 0x410000ab --ra-ra---- root system

s 21 0x410000cb --ra-ra---- grid dba

ZFLHRDB4:oracle:/oracle>ipcrm -m 395313156

IPC status from /dev/mem as of Tue May 31 14:42:23 BEIST 2016

T ID KEY MODE OWNER GROUP

Message Queues:

q 0 0x9283a0d2 -Rrw------- root system

q 1 0xffffffff ----------- root system

Shared Memory:

m 3 0x210000ac --rw-rw---- root system

m 9437189 00000000 --rw-r----- oracle asmadmin

m 276824070 00000000 --rw-r----- oracle asmadmin

m 912261127 0x210000d4 --rw-rw---- grid dba

Semaphores:

s 3145728 0x0100324a --ra-ra-r-- root system

s 1 0x620025b4 --ra-r--r-- root system

s 2 0x02001958 --ra-ra-ra- root system

s 3 0x01001958 --ra-ra-ra- root system

s 9 0x010024be --ra------- root system

s 3145738 0x410000ab --ra-ra---- root system

s 21 0x410000cb --ra-ra---- grid dba

ZFLHRDB4:oracle:/oracle>ipcrm -m 9437189

ZFLHRDB4:oracle:/oracle>ipcrm -m 276824070

IPC status from /dev/mem as of Tue May 31 14:42:39 BEIST 2016

T ID KEY MODE OWNER GROUP

Message Queues:

q 0 0x9283a0d2 -Rrw------- root system

q 1 0xffffffff ----------- root system

Shared Memory:

m 3 0x210000ac --rw-rw---- root system

m 912261127 0x210000d4 --rw-rw---- grid dba

Semaphores:

s 3145728 0x0100324a --ra-ra-r-- root system

s 1 0x620025b4 --ra-r--r-- root system

s 2 0x02001958 --ra-ra-ra- root system

s 3 0x01001958 --ra-ra-ra- root system

s 9 0x010024be --ra------- root system

s 3145738 0x410000ab --ra-ra---- root system

s 21 0x410000cb --ra-ra---- grid dba

ZFLHRDB4:oracle:/oracle>sqlplus / as sysdba

SQL*Plus: Release 11.2.0.4.0 Production on Tue May 31 14:42:46 2016

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

Connected to an idle instance.

SYS@oraDESDB2>

问题解决了,但是为啥会出现这样的错误,我在MOS上搜了以下的文章。

MOS上的文件

---Connect /as sysdba or Startup Fails With ORA-09925 When Instance Is Down (文档 ID 392643.1)

In this Document

Symptoms

Cause

Solution

References

APPLIES TO:

Oracle Database - Enterprise Edition - Version 8.1.7.0 to 12.1.0.1 [Release 8.1.7 to 12.1]

Information in this document applies to any platform.

Checked for relevance on 05-Oct-2010

SYMPTOMS

When the database instance is down, trying to connect or startup the database fails with:

ERROR:

ORA-09925: Unable to create audit trail file

SVR4 Error: 13: Permission denied

Additional information: 9925

CAUSE

On Unix systems, the investigation should be done using the OS tracing utility, ie: truss (AIX, Solaris), strace (Linux) or tusc (HP-UX).

truss -aefo sqlplus.trc sqlplus "/ as sysdba"

shows that the problem is caused by a missing directory, insufficient permissions or not enough space on that particular directory:

open("/opt/oracle/admin/test102/adump/ora_31704.aud", O_RDWR|O_CREAT|O_APPEND|O_LARGEFILE, 0660) = -1 EACCES (Permission denied)

From 10gR2, the $ORACLE_BASE/admin/\<SID>/adump directory is the new default directory for audit files (instead of previous releases location, $ORACLE_HOME/rdbms/audit).

SOLUTION

1. Starting with 10gR2, check if the

$ORACLE_BASE/admin/$ORACLE_SID/adump

directory exists and create it if not.

If ORACLE_BASE is not set, the default audit directory is still $ORACLE_HOME/rdbms/audit, as in pre 10gR2 releases.

2. If the directory exists (if in previous releases or if ORACLE_BASE not set, check: $ORACLE_HOME/rdbms/audit), make sure that permissions on it are set to 775.

3. If the directory exists and permissions are correctly set, make sure that there is enough space on the file system to accommodate the newly created audit files.

Starting with 10gR2: Note that when the database instance is down and the first connect and the startup command is run, the audit_file_dest parameter is not yet initialized, hence unknown to the shadow process, as such the audit files for these commands can only be written to the default destination. Writing these files is a mandatory requirement for NCSC C2 security evaluation criteria and therefore this behavior cannot be turned off.

4. Generically, ORACLE_BASE is set, as recommended by the documentation. If ORACLE_BASE is not set, then the default audit location becomes: $ORACLE_HOME/rdbms/audit. This is important to mention especially on RAC, where the environment variables are set in the OCR and should be updated, as documented, using srvctl, eg:

srvctl setenv database -d \<db name> -t ORACLE_BASE=\<Oracle Base directory>

5. A rare scenario was found when ORACLE_PATH is set and the Oracle software transparently appended it to the default value: $ORACLE_BASE/admin/$ORACLE_SID/adump. ORACLE_PATH needs to be unset to workaround the problem. This issue was found to be a regression in the fix to bug 9438890 , and can be fixed by installing patch 14488943.

---ORA-09925 : Error During Database Creation Using Other OS Users. (文档 ID 405885.1)

In this Document

Symptoms

Cause

Solution

This document is being delivered to you via Oracle Support's Rapid Visibility (RaV) process and therefore has not been subject to an independent technical review.

APPLIES TO:

Oracle Server - Enterprise Edition - Version 9.2.0.1 and later

Linux x86

HP-UX PA-RISC (64-bit)

IBM AIX on POWER Systems (64-bit)

Oracle Solaris on SPARC (64-bit)

Linux x86-64

***Checked for relevance on 19-Jun-2012***

SYMPTOMS

Creating database using DBCA logged in as another user belonging to the installation group results in following error

ORA-09925 : Unable to create audit trail file.

If you ignore this error it will error out with following message

ORA-01034 : Oracle not available.

CAUSE

By default Oracle will create directories with permission 755. So the other users belonging to the group will not have write permission which results in this issue.

SOLUTION

Any user other than the software owner belonging to the same group will not be able to create database.

To resolve the issue give write permission to the group on following directories.

1. chmod 775 $ORACLE_HOME/audit

2. chmod 775 $ORACLE_HOME/cfgtoollogs/dbca

3. Give write permission on directories where data files and control files are getting created.

4. Give write permission on $ORACLE_BASE

5. chgrp \<oracle group> /etc/oratab

Note: This holds good for other Unix platforms as well.

---OS AUDIT ERROR IN ASM AND ORA-09925 in RDBMS (文档 ID 1921650.1)

In this Document

Symptoms

Cause

Solution

References

APPLIES TO:

Oracle Database - Enterprise Edition - Version 11.2.0.3 to 11.2.0.4 [Release 11.2]

Information in this document applies to any platform.

SYMPTOMS

1] The following error message is reported in ASM alert.log

OS Audit file could not be created; failing after x retries

2] The following similar message is visible in RDBMS alert.log

本人提供Oracle(OCP、OCM)、MySQL(OCP)、PostgreSQL(PGCA、PGCE、PGCM)等数据库的培训和考证业务,私聊QQ646634621或微信dbaup66,谢谢!
AiDBA后续精彩内容已被站长无情隐藏,请输入验证码解锁本文!
验证码:
获取验证码: 请先关注本站微信公众号,然后回复“验证码”,获取验证码。在微信里搜索“AiDBA”或者“dbaup6”或者微信扫描右侧二维码都可以关注本站微信公众号。

标签:

Avatar photo

小麦苗

学习或考证,均可联系麦老师,请加微信db_bao或QQ646634621

您可能还喜欢...

发表回复