测试环境上使用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用户执行操作时则报错。
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目录,果然发现问题:
cd $ORACLE_BASE/diagls -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在写日志是没有权限:
:~#
chown grid:dba $ORACLE_BASE/diag/asmtool
chown: /diag/asmtool: No such file or directory:~# chown grid:dba
/u01/app/oracle/diag/asmtool
重新设置owner后,问题解决:
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]