ITPub博客

首页 > 数据库 > Oracle > [20210723]adrci show 'No ADR base is set' 解决办法.txt

[20210723]adrci show 'No ADR base is set' 解决办法.txt

原创 Oracle 作者:lfree 时间:2021-07-23 10:32:29 0 删除 编辑

[20210723]adrci show 'No ADR base is set' 解决办法.txt

--//在自己的测试环境下模拟测试.参考链接

$ xxd -c 16 $ORACLE_HOME/log/diag/adrci_dir.mif
0000000: 2f75 3031 2f61 7070 2f6f 7261 636c 6500  /u01/app/oracle.

--//注意这个文件相当奇特,实际上最后的字符是00.没有回车换行之类的字符.

$ cat -vs $ORACLE_HOME/log/diag/adrci_dir.mif ; echo
/u01/app/oracle^@

1.环境:
SCOTT@book> @ ver1
PORT_STRING                    VERSION        BANNER
------------------------------ -------------- --------------------------------------------------------------------------------
x86_64/Linux 2.4.xx            11.2.0.4.0     Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production

$ mv $ORACLE_HOME/log/diag/adrci_dir.mif $ORACLE_HOME/log/diag/adrci_dir.mif.ORG
`/u01/app/oracle/product/11.2.0.4/dbhome_1/log/diag/adrci_dir.mif' -> `/u01/app/oracle/product/11.2.0.4/dbhome_1/log/diag/adrci_dir.mif.ORG'

2.测试:
$ rladrci
ADRCI: Release 11.2.0.4.0 - Production on Fri Jul 23 10:02:01 2021
Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.
No ADR base is set
adrci>

3.分析:
$ strace -f -o aa.txt adrci

--//检查aa.txt,可以发现如下:
23825 times({tms_utime=0, tms_stime=1, tms_cutime=0, tms_cstime=0}) = 1834869394
23825 lstat("/u01/app/oracle/product/11.2.0.4/dbhome_1/log/diag/adrci_dir.mif", 0x7fff6930c440) = -1 ENOENT (No such file or directory)
23825 stat("/u01/app/oracle/product/11.2.0.4/dbhome_1/log/diag/adrci_dir.mif", 0x7fff6930c4f0) = -1 ENOENT (No such file or directory)
23825 close(3)                          = 0

--// 尝试建立新的adrci_dir.mif在目录/u01/app/oracle/product/11.2.0.4/dbhome_1/log/diag/,注意我使用vim结尾0a.

$ xxd -c 16  adrci_dir.mif
0000000: 2f75 3031 2f61 7070 2f6f 7261 636c 650a  /u01/app/oracle.

$ strace -f -o bb.txt adrci
ADRCI: Release 11.2.0.4.0 - Production on Fri Jul 23 10:13:08 2021
Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.
No ADR base is set
adrci>

--//检查bb.txt,可以发现如下:
24088 lstat("/u01/app/oracle/product/11.2.0.4/dbhome_1/log/diag/adrci_dir.mif", {st_mode=S_IFREG|0644, st_size=16, ...}) = 0
24088 stat("/u01/app/oracle/product/11.2.0.4/dbhome_1/log/diag/adrci_dir.mif", {st_mode=S_IFREG|0644, st_size=16, ...}) = 0
24088 open("/u01/app/oracle/product/11.2.0.4/dbhome_1/log/diag/adrci_dir.mif", O_RDONLY) = 7
24088 fcntl(7, F_SETFD, FD_CLOEXEC)     = 0
24088 read(7, "/u01/app/oracle\n", 512) = 16

--//实际上vim也可以编辑比较麻烦,使用vim -b打开,:%!xxd; :%xxd -r.再保持就ok了.

$ xxd -c 16  adrci_dir.mif
0000000: 2f75 3031 2f61 7070 2f6f 7261 636c 65    /u01/app/oracle
--//实际上还是实际文件差别最后没有\0.

$ strace -f -o cc.txt adrci
ADRCI: Release 11.2.0.4.0 - Production on Fri Jul 23 10:20:06 2021
Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.
ADR base = "/u01/app/oracle"

--//OK,问题解决.
--//检查cc.txt,可以发现如下:
24193 lstat("/u01/app/oracle/product/11.2.0.4/dbhome_1/log/diag/adrci_dir.mif", {st_mode=S_IFREG|0644, st_size=15, ...}) = 0
24193 stat("/u01/app/oracle/product/11.2.0.4/dbhome_1/log/diag/adrci_dir.mif", {st_mode=S_IFREG|0644, st_size=15, ...}) = 0
24193 open("/u01/app/oracle/product/11.2.0.4/dbhome_1/log/diag/adrci_dir.mif", O_RDONLY) = 7
24193 fcntl(7, F_SETFD, FD_CLOEXEC)     = 0
24193 read(7, "/u01/app/oracle", 512)   = 15

--//还原使用原来文件呢?
$ mv $ORACLE_HOME/log/diag/adrci_dir.mif.ORG $ORACLE_HOME/log/diag/adrci_dir.mif
/bin/mv: overwrite `/u01/app/oracle/product/11.2.0.4/dbhome_1/log/diag/adrci_dir.mif'? y
`/u01/app/oracle/product/11.2.0.4/dbhome_1/log/diag/adrci_dir.mif.ORG' -> `/u01/app/oracle/product/11.2.0.4/dbhome_1/log/diag/adrci_dir.mif'

strace -f -o dd.txt adrci
ADRCI: Release 11.2.0.4.0 - Production on Fri Jul 23 10:23:19 2021
Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.
ADR base = "/u01/app/oracle"
adrci> quit

--//检查dd.txt,可以发现如下:
24222 lstat("/u01/app/oracle/product/11.2.0.4/dbhome_1/log/diag/adrci_dir.mif", {st_mode=S_IFREG|0640, st_size=16, ...}) = 0
24222 stat("/u01/app/oracle/product/11.2.0.4/dbhome_1/log/diag/adrci_dir.mif", {st_mode=S_IFREG|0640, st_size=16, ...}) = 0
24222 open("/u01/app/oracle/product/11.2.0.4/dbhome_1/log/diag/adrci_dir.mif", O_RDONLY) = 7
24222 fcntl(7, F_SETFD, FD_CLOEXEC)     = 0
24222 read(7, "/u01/app/oracle\0", 512) = 16

4.补充:
--//实际上即使不使用vim来编辑也可以使用echo,tr之类命令完成.

$ xxd -c 16 adrci_dir.mif
0000000: 2f75 3031 2f61 7070 2f6f 7261 636c 650a  /u01/app/oracle.

$ cat adrci_dir.mif | tr -d '\n' | xxd -c 16
0000000: 2f75 3031 2f61 7070 2f6f 7261 636c 65    /u01/app/oracle

$ cat adrci_dir.mif | tr  '\n' '\000' | xxd -c 16
0000000: 2f75 3031 2f61 7070 2f6f 7261 636c 6500  /u01/app/oracle.

$ echo -n "/u01/app/oracle" | xxd -c 16
0000000: 2f75 3031 2f61 7070 2f6f 7261 636c 65    /u01/app/oracle

$ echo -en "/u01/app/oracle\0" | xxd -c 16
0000000: 2f75 3031 2f61 7070 2f6f 7261 636c 6500  /u01/app/oracle.

--//我就是没想到printf,^_^.总之方法还有很多.

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/267265/viewspace-2782862/,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论
熟悉oracle相关技术,擅长sql优化,rman备份与恢复,熟悉linux shell编程。

注册时间:2008-01-03

  • 博文量
    3005
  • 访问量
    6760192