标签:strace sqlplus as sysdba eexist file exists stat
在上一篇文章中,说到bdump目录的x权限丢失,导致oracle数据库异常。
下面就来用linux 的strace命令来跟踪一下,当bdump目录的x权限丢失时,sqlplus / as sysdba会有什么样的输出:
strace命令如下,该命令来源于:Using Strace in Linux to Debug Hang Type Problems (Doc ID 1391746.1)
strace -fe verbose=all -e write=all -e read=all -o /u02/app/output7.txt /u02/app/oracle/product/11.2.0.4/db_1/bin/sqlplus / as sysdba
当上面的strace命令执行完毕后,output7.txt的大小为:
[root@rhel63single app]# pwd /u02/app [root@rhel63single app]# du -sh output7.txt 54M output7.txt
在该文件的中,有如下信息:
5774 stat("/u01/app/oracle/diag", {st_mode=S_IFDIR|0775, st_size=4096, ...}) = 0 5774 stat("/u01/app/oracle/diag/rdbms", {st_mode=S_IFDIR|0775, st_size=4096, ...}) = 0 5774 stat("/u01/app/oracle/diag/rdbms/test", {st_mode=S_IFDIR|0750, st_size=4096, ...}) = 0 5774 stat("/u01/app/oracle/diag/rdbms/test/test", {st_mode=S_IFDIR|0750, st_size=4096, ...}) = 0 5774 stat("/u01/app/oracle/diag/rdbms/test/test/trace", {st_mode=S_IFDIR|0650, st_size=49152, ...}) = 0 --->此处说明该bdump目录的权限为650 5774 mkdir("/u01/app/oracle/diag/rdbms/test/test/trace", 0775) = -1 EEXIST (File exists) ----->此处要以755权限新建该bdump目录,只是由于该目录已经存在而建立失败。
而当bdump目录有x权限时,sqlplus / as sysdba的strace跟踪如下:
6451 stat("/u01/app/oracle", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 6451 getrlimit(RLIMIT_NOFILE, {rlim_cur=64*1024, rlim_max=64*1024}) = 0 6451 open("/proc/self/fd/", O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC) = 5 6451 fcntl(5, F_GETFD) = 0x1 (flags FD_CLOEXEC) 6451 getrlimit(RLIMIT_FSIZE, {rlim_cur=RLIM_INFINITY, rlim_max=RLIM_INFINITY}) = 0 6451 stat("/u01/app/oracle/diag", {st_mode=S_IFDIR|0775, st_size=4096, ...}) = 0 6451 stat("/u01/app/oracle/diag/rdbms", {st_mode=S_IFDIR|0775, st_size=4096, ...}) = 0 6451 stat("/u01/app/oracle/diag/rdbms/test", {st_mode=S_IFDIR|0750, st_size=4096, ...}) = 0 6451 stat("/u01/app/oracle/diag/rdbms/test/test", {st_mode=S_IFDIR|0750, st_size=4096, ...}) = 0 6451 stat("/u01/app/oracle/diag/rdbms/test/test/trace", {st_mode=S_IFDIR|0750, st_size=49152, ...}) = 0 --->该bdump权限是750 6451 stat("/u01/app/oracle/diag/rdbms/test/test/alert", {st_mode=S_IFDIR|0750, st_size=4096, ...}) = 0 6451 stat("/u01/app/oracle/diag/rdbms/test/test/incident", {st_mode=S_IFDIR|0750, st_size=4096, ...}) = 0 6451 stat("/u01/app/oracle/diag/rdbms/test/test/metadata", {st_mode=S_IFDIR|0750, st_size=4096, ...}) = 0 6451 stat("/u01/app/oracle/diag/rdbms/test/test/metadata_pv", {st_mode=S_IFDIR|0750, st_size=4096, ...}) = 0 6451 stat("/u01/app/oracle/diag/rdbms/test/test/metadata_dgif", {st_mode=S_IFDIR|0750, st_size=4096, ...}) = 0 6451 stat("/u01/app/oracle/diag/rdbms/test/test/hm", {st_mode=S_IFDIR|0750, st_size=4096, ...}) = 0 6451 stat("/u01/app/oracle/diag/rdbms/test/test/ir", {st_mode=S_IFDIR|0750, st_size=4096, ...}) = 0 6451 stat("/u01/app/oracle/diag/rdbms/test/test/incpkg", {st_mode=S_IFDIR|0750, st_size=4096, ...}) = 0 6451 stat("/u01/app/oracle/diag/rdbms/test/test/sweep", {st_mode=S_IFDIR|0750, st_size=4096, ...}) = 0 6451 stat("/u01/app/oracle/diag/rdbms/test/test/lck", {st_mode=S_IFDIR|0750, st_size=4096, ...}) = 0 6451 stat("/u01/app/oracle/diag/rdbms/test/test/cdump", {st_mode=S_IFDIR|0750, st_size=4096, ...}) = 0 6451 stat("/u01/app/oracle/diag/rdbms/test/test/stage", {st_mode=S_IFDIR|0750, st_size=4096, ...}) = 0 6451 stat("/u01/app/oracle/diag/rdbms/test/test/metadata", {st_mode=S_IFDIR|0750, st_size=4096, ...}) = 0 6451 lstat("/u01/app/oracle/diag/rdbms/test/test/metadata/ADR_CONTROL.ams", {st_mode=S_IFREG|0640, st_size=65536, ...}) = 0 6451 stat("/u01/app/oracle/diag/rdbms/test/test/metadata/ADR_CONTROL.ams", {st_mode=S_IFREG|0640, st_size=65536, ...}) = 0 6451 lstat("/u01/app/oracle/diag/rdbms/test/test/metadata/ADR_INVALIDATION.ams", {st_mode=S_IFREG|0640, st_size=65536, ...}) = 0 6451 stat("/u01/app/oracle/diag/rdbms/test/test/metadata/ADR_INVALIDATION.ams", {st_mode=S_IFREG|0640, st_size=65536, ...}) = 0 6451 lstat("/u01/app/oracle/diag/rdbms/test/test/metadata/INC_METER_IMPT_DEF.ams", {st_mode=S_IFREG|0640, st_size=65536, ...}) = 0 6451 stat("/u01/app/oracle/diag/rdbms/test/test/metadata/INC_METER_IMPT_DEF.ams", {st_mode=S_IFREG|0640, st_size=65536, ...}) = 0 6451 lstat("/u01/app/oracle/diag/rdbms/test/test/metadata/INC_METER_PK_IMPTS.ams", {st_mode=S_IFREG|0640, st_size=65536, ...}) = 0 6451 stat("/u01/app/oracle/diag/rdbms/test/test/metadata/INC_METER_PK_IMPTS.ams", {st_mode=S_IFREG|0640, st_size=65536, ...}) = 0 6451 lstat("/u01/app/oracle/diag/rdbms/test/test/metadata/INCIDENT.ams", {st_mode=S_IFREG|0640, st_size=65536, ...}) = 0 6451 stat("/u01/app/oracle/diag/rdbms/test/test/metadata/INCIDENT.ams", {st_mode=S_IFREG|0640, st_size=65536, ...}) = 0 6451 brk(0xd867000) = 0xd867000 6451 socket(PF_INET6, SOCK_DGRAM, IPPROTO_IP) = 6 6451 bind(6, {sa_family=AF_INET6, sin6_port=htons(0), inet_pton(AF_INET6, "::1", &sin6_addr), sin6_flowinfo=0, sin6_scope_id=0}, 28) = 0 6451 close(6) = 0 6451 access("/u02/app/oracle/product/11.2.0.4/db_1/network/admin/sqlnet.ora", F_OK) = -1 ENOENT (No such file or directory) 6451 stat("/u02/app/oracle", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 6451 stat("/u02/app/oracle/diag", {st_mode=S_IFDIR|0775, st_size=4096, ...}) = 0 6451 stat("/u02/app/oracle/diag/clients", {st_mode=S_IFDIR|0775, st_size=4096, ...}) = 0 6451 uname({sys="Linux", node="rhel63single", ...}) = 0 6451 getuid() = 500 6451 socket(PF_FILE, SOCK_STREAM|SOCK_CLOEXEC|SOCK_NONBLOCK, 0) = 6 6451 connect(6, {sa_family=AF_FILE, path="/var/run/nscd/socket"}, 110) = -1 ENOENT (No such file or directory) 6451 close(6) = 0 6451 socket(PF_FILE, SOCK_STREAM|SOCK_CLOEXEC|SOCK_NONBLOCK, 0) = 6 6451 connect(6, {sa_family=AF_FILE, path="/var/run/nscd/socket"}, 110) = -1 ENOENT (No such file or directory) 6451 close(6) = 0 6451 open("/etc/nsswitch.conf", O_RDONLY) = 6 6451 fstat(6, {st_mode=S_IFREG|0644, st_size=1688, ...}) = 0 6451 mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fe94438c000 6451 read(6, "#\n# /etc/nsswitch.conf\n#\n# An ex"..., 4096) = 1688
使用Linux strace命令来跟踪 bdump目录的x权限丢失时sqlplus / as sysdba 的输出
标签:strace sqlplus as sysdba eexist file exists stat
原文地址:http://blog.csdn.net/msdnchina/article/details/42645579