- 最后登录
- 2023-8-16
- 在线时间
- 1686 小时
- 威望
- 2135
- 金钱
- 50532
- 注册时间
- 2011-10-12
- 阅读权限
- 200
- 帖子
- 5207
- 精华
- 39
- 积分
- 2135
- UID
- 2
|
1#
发表于 2012-3-5 20:46:59
|
查看: 8467 |
回复: 0
今天想用KFED 的使用出现了以下错误:
[grid@vrh2 trace]$ kfed read /dev/asm-disk1
ERROR!!! could not initialize the diag context
查了一下metalink 说是$ORACLE_HOME/log/disg/asmtool 文件权限的问题:
-
- KFED - ERROR!!! could not initialize the diag context [ID 1335596.1]
- Applies to:
- Oracle Server - Enterprise Edition - Version: 11.2.0.1.0 and later [Release: 11.2 and later ]
- Information in this document applies to any platform.
- Symptoms
- kfed command shows the following error even though the running user has a proper permission on the target device.
- $ kfed read /u02/oradata/asm_disk0
- ERROR!!! could not initialize the diag context
- $ id
- uid=503(grid) gid=501(oinstall) groups=501(oinstall),504(asmadmin),505(asmoper),506(asmdba)
- $ ls -l /u02/oradata/asm_disk0
- -rwxrwxrwx 1 grid oinstall 2097152000 Jul 5 22:14 /u02/oradata/asm_disk0
- Cause
- kfed executable will need create a directory for its own trace files
- under <GridHome>/log/diag/asmtool. If kfed firstly was used as
- root user, this directory - <GridHome>/log/diag/asmtool is created
- as root.
- The following kfed run by other than root user will not be able to create a directory under <GridHome>/log/diag/asmtool.
-
- $ ls -l $ORACLE_HOME/log/diag
- drwxrwxrwx 2 grid oinstall 4096 Jul 5 15:29 asm
- drwxr-xr-x
- 3 root root 4096 Jul 6 11:17 asmtool << This directory is owned
- by root and there is no write permissin for other users.
- drwxr-xr-x 5 oracle asmadmin 4096 Jun 20 09:16 rdbms
- drwxrwxrwx 3 grid oinstall 4096 Jun 15 18:04 tnslsnr
- Solution
- Change the owner for <GridHome>/log/diag/asmtool directory as grid user.
- # chown grid:oinstall $ORACLE_HOME/log/disg/asmtool
- And as grid user, the following command will show the correct kfed output.
-
- $kfed read /u02/oradata/asm_disk0 | more
- kfbh.endian: 1 ; 0x000: 0x01
- kfbh.hard: 130 ; 0x001: 0x82
- kfbh.type: 1 ; 0x002: KFBTYP_DISKHEAD
- kfbh.datfmt: 1 ; 0x003: 0x01
- kfbh.block.blk: 0 ; 0x004: T=0 NUMB=0x0
- kfbh.block.obj: 2147483648 ; 0x008: TYPE=0x8 NUMB=0x0
- kfbh.check: 1175212953 ; 0x00c: 0x460c5399
- kfbh.fcn.base: 0 ; 0x010: 0x00000000
- kfbh.fcn.wrap: 0 ; 0x014: 0x00000000
- kfbh.spare1: 0 ; 0x018: 0x00000000
- kfbh.spare2: 0 ; 0x01c: 0x00000000
- kfdhdb.driver.provstr: ORCLDISK ; 0x000: length=8
- ..
复制代码
查了以下 没有$ORACLE_HOME/log/disg/asmtool 这个目录
grid@vrh2 diag]$ ls -l $ORACLE_HOME/log/disg/asmtool
ls: /g01/11.2.0/grid/log/disg/asmtool: No such file or directory
之后对 kfed 做了 strace 才发现 文档写错了:
[grid@vrh2 diag]$ strace kfed
strace log:
stat("/g01/orabase/diag/asmtool", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
stat("/g01/orabase/diag/asmtool/user_grid", 0x7fffe3fe1250) = -1 ENOENT (No such file or directory)
mkdir("/g01/orabase/diag/asmtool/user_grid", 0775) = -1 EACCES (Permission denied)
fstat(1, {st_mode=S_IFCHR|0620, st_rdev=makedev(136, 0), ...}) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fb6d1335000
write(1, "ERROR!!! could not initialize th"..., 48ERROR!!! could not initialize the diag context
) = 48
close(3) = 0
munmap(0x7fb6d10fd000, 143360) = 0
exit_group(0) = ?
应当是 $ORACLE_BASE/diag/asmtool 这个目录才对
[grid@vrh2 ~]$ ls -l $ORACLE_BASE/diag/asmtool
total 4
drwxr-xr-x 3 root root 4096 Jan 4 18:33 user_root
要给予grid 用户合适的权限
[root@vrh2 ~]# chown grid:oinstall $ORACLE_BASE/diag/asmtool
[root@vrh2 ~]# chown grid:oinstall /g01/orabase/diag/asmtool/user_root
[grid@vrh2 ~]$ 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] |
|