使用kfed出现无法初始化diag的错误

测试环境上使用kfed工具出现错误。
错误信息如下:

grid@solaris:~$ kfed
ERROR!!! could NOT initialize the diag context 
grid@solaris:~$ id
uid=502(grid) gid=501(dba)
grid@solaris:/u02/app/oracle/product/11.2.0/grid/bin$ ./kfed
Unable TO run program ed

根据错误信息搜索MOS,确认问题为KFED – ERROR!!! could not initialize the diag context [ID 1335596.1]。导致问题的原因是kfed会尝试建立自己的目录并记录日志,而当前的目录结构使得grid用户没有权限执行这个初始化的动作。在MOS的这篇文档中,是由于使用root执行国kfed,导致目录的owner变为root,而grid用户执行操作时则报错。

grid@solaris:~$ ls -l $ORACLE_HOME/log/diag
total 14
-rw-r----- 1 grid dba 16 Apr 23 16:49 adrci_dir.mif
drwxr-xr-x 3 grid dba 3 Apr 23 11:26 asm
drwxr-xr-x 3 grid dba 3 Apr 21 16:03 asmcmd
drwxrwx--- 2 grid dba 2 Jan 29 14:56 clients
drwxr-xr-x 3 grid dba 3 Jan 29 15:18 tnslsnr

当前的问题和MOS文档描述的并不完全相同,当前路径下没有root权限的目录,也没有找到目标目录asmtool。不过无论是现象还是错误信息都说明问题确实和kfed写日志有关系。查看ORACLE_BASE/diag目录,果然发现问题:

grid@solaris:~/grid$ cd $ORACLE_BASE/diag
grid@solaris:/u01/app/oracle/diag$ ls -l
total 30
drwxrwxr-x 3 oracle dba 3 Apr 21 16:20 asm
drwxr-xr-x 3 kamus staff 3 Mar 23 14:31 asmtool
drwxrwxr-x 3 oracle dba 3 Jan 30 15:20 clients
drwxrwxr-x 2 oracle dba 2 Jan 4 18:18 crs
drwxrwxr-x 2 oracle dba 2 Jan 4 18:18 diagtool
drwxrwxr-x 2 oracle dba 2 Jan 4 18:18 lsnrctl
drwxrwxr-x 2 oracle dba 2 Jan 4 18:18 netcman
drwxrwxr-x 2 oracle dba 2 Jan 4 18:18 ofm
drwxrwxr-x 4 oracle dba 4 Feb 15 15:44 rdbms
drwxrwxr-x 3 oracle dba 3 Jan 6 23:55 tnslsnr

目录asmtool目录的owner果然不是grid用户,导致grid在写日志是没有权限:

root@solaris:~# chown grid:dba $ORACLE_BASE/diag/asmtool
chown: /diag/asmtool: No such file OR directory
root@solaris:~# chown grid:dba /u01/app/oracle/diag/asmtool

重新设置owner后,问题解决:

grid@solaris:/u01/app/oracle/diag$ kfed
AS/mlib ASM Library [asmlib='lib']
aun/um AU NUMBER TO examine OR UPDATE [AUNUM=NUMBER]
aus/z Allocation Unit SIZE IN bytes [AUSZ=NUMBER]
blkn/um Block NUMBER TO examine OR UPDATE [BLKNUM=NUMBER]
blks/z Metadata block SIZE IN bytes [BLKSZ=NUMBER]
ch/ksum UPDATE checksum BEFORE each WRITE [CHKSUM=YES/NO]
cn/t COUNT OF AUs TO process [CNT=NUMBER]
de/v ASM device TO examine OR UPDATE [DEV=string]
dm/pall Don't suppress repeated lines when dumping corrupt blocks [DMPALL=YES/NO]
o/p KFED operation type [OP=READ/WRITE/MERGE/REPAIR/NEW/FORM/FIND/STRUCT]
p/rovnm Name for provisioning purposes [PROVNM=string]
s/eek AU number to seek to [SEEK=number]
te/xt File name for translated block text [TEXT=string]
ty/pe ASM metadata block type number [TYPE=number]
This entry was posted in ORACLE and tagged , , , . Bookmark the permalink.

One Response to 使用kfed出现无法初始化diag的错误

Leave a Reply

Your email address will not be published. Required fields are marked *