11g R2 建库TNS-12547错误处理

新安装的11g R2,建库时报TNS-12547错误!sqlplus / as sysdba 直接报如下错误:

TNS-00517: 丢失连接

Strace sqlplus / as sysdba发现,有错误日志写到/home/oracle/oradiag_oracle/diag/clients/user_oracle/host_723576406_76/trace/sqlnet.log:

Fatal NI connect error 12547, connecting to:
 (DESCRIPTION=(ADDRESS=(PROTOCOL=beq)(PROGRAM=/database/bin/oracle)(ARGV0=oracler11g1)(ARGS=’(DESCRIPTION=(LOCAL=YES)(ADDRESS=(PROTOCOL=beq)))’)(DETACH=NO))(CONNECT_DATA=(CID=(PROGRAM=sqlplus@as51)(HOST=as51)(USER=oracle))))

  VERSION INFORMATION:
        TNS for Linux: Version 11.2.0.1.0 – Production
        Oracle Bequeath NT Protocol Adapter for Linux: Version 11.2.0.1.0 – Production
  Time: 14-10月-2009 22:02:27
  Tracing not turned on.
  Tns error struct:
    ns main err code: 12547

TNS-12547: TNS: 丢失连接
    ns secondary err code: 12560
    nt main err code: 517

TNS-00517: 丢失连接
    nt secondary err code: 32
    nt OS err code: 0
Wed Oct 14 22:02:44 2009

这些信息于问题解决没有多大帮助。于时strace -d -s sqlplus / as sysdba,发现如下信息:

pid 32677 stopped, [SIGTRAP]
[pid 32677] lstat(”/database/rdbms/log/r11g1_ora_32677.trc”,  [wait(0x57f) = 32677]
pid 32677 stopped, [SIGTRAP]
0×7fff93df34e0) = -1 ENOENT (No such file or directory)
 [wait(0x57f) = 32677]
pid 32677 stopped, [SIGTRAP]
[pid 32677] stat(”/database/rdbms/log/r11g1_ora_32677.trc”,  [wait(0x57f) = 32677]
pid 32677 stopped, [SIGTRAP]
0×7fff93df34e0) = -1 ENOENT (No such file or directory)
 [wait(0x57f) = 32677]
pid 32677 stopped, [SIGTRAP]
[pid 32677] open(”/database/rdbms/log/r11g1_ora_32677.trc”, O_WRONLY|O_CREAT|O_TRUNC, 0660 [wait(0x57f) = 32677]
pid 32677 stopped, [SIGTRAP]
) = 3

此处提到一个错误日志/database/rdbms/log/r11g1_ora_32677.trc。打开一看,真相大白:

Dump file /database/rdbms/log/r11g1_ora_32677.trc
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 – 64bit Production
With the Partitioning, Real Application Clusters, Data Mining and Real Application Testing options
ORACLE_HOME = /database
System name:    Linux
Node name:      as51
Release:        2.6.18-164.el5
Version:        #1 SMP Tue Aug 18 15:51:48 EDT 2009
Machine:        x86_64
Instance name: r11g1
Redo thread mounted by this instance: 0 <none>
Oracle process number: 0
Unix process pid: 32677, image: oracle@as51
*** 2009-10-14 22:20:22.558
dbkedDefDump(): Starting a non-incident diagnostic dump (flags=0×0, level=3, mask=0×0)
—– Error Stack Dump —–
ORA-00600: internal error code, arguments: [spstp: ORACLE_HOME uid does not match euid], [500], [501], [], [], [], [], [], [], [], [], []
—– SQL Statement (None) —–
Current SQL information unavailable – no SGA.

从这里可以看出,ORACLE_HOME的目录的属主不对,本应是501,而现在是500。果真如此吗?

[root@as51 /]# ls -lst /
total 7575082
      0 drwxr-xr-x  11 root   root          0 Oct 15  2009 sys
      0 dr-xr-xr-x 256 root   root          0 Oct 15  2009 proc
      8 drwxrwxrwt  17 root   root       4096 Oct 14 22:36 tmp
      8 drwxr-x—  16 root   root       4096 Oct 14 22:03 root
     16 drwxr-xr-x  97 root   root      12288 Oct 14 21:44 etc
      4 drwxrwx—  73 grid   dba        4096 Oct 14 21:43 database

[root@as51 /]# id oracle
uid=501(oracle) gid=500(dba) groups=500(dba)
[root@as51 /]# id grid
uid=500(grid) gid=500(dba) groups=500(dba)

看来,确实如此。修改属主后,一切正常!

[root@as51 /]# chown oracle:dba /database
[root@as51 /]# ls -lst /
total 7575082
      0 drwxr-xr-x  11 root   root          0 Oct 15  2009 sys
      0 dr-xr-xr-x 256 root   root          0 Oct 15  2009 proc
      8 drwxrwxrwt  17 root   root       4096 Oct 14 22:39 tmp
      8 drwxr-x—  16 root   root       4096 Oct 14 22:03 root
     16 drwxr-xr-x  97 root   root      12288 Oct 14 21:44 etc
      4 drwxrwx—  73 oracle dba        4096 Oct 14 21:43 database
      4 drwxrwxr-x   9 oracle dba        4096 Oct 14 21:35 oracle
      8 drwxr-xr-x   7 root   root       4096 Oct 14 21:35 lib64
4466564 -rw-r–r–   1 root   root 4569282560 Oct 14 21:02 database.tar
      0 drwxr-xr-x  14 root   root       3960 Oct 14 20:29 dev
      0 drwxr-xr-x   2 root   root          0 Oct 14 20:28 net
      0 drwxr-xr-x   2 root   root          0 Oct 14 20:28 misc
      4 drwxr-xr-x   4 root   root       4096 Oct  8 09:24 install
     16 drwx——   2 root   root      16384 Oct  8 03:33 lost+found
     16 drwxr-xr-x   2 root   root      12288 Oct  7 21:21 sbin
      8 drwxr-xr-x   2 root   root       4096 Oct  7 21:21 bin
      8 drwxr-xr-x  11 root   root       4096 Oct  7 21:21 lib
      8 drwxr-xr-x   4 root   root       4096 Oct  7 20:46 home
      8 drwxr-xr-x   3 root   root       4096 Oct  7 20:35 boot
      4 drwxr-xr-x  64 root   dba        4096 Oct  7 20:34 grid
      8 drwxr-xr-x   4 root   root       4096 Oct  7 20:34 opt
3108320 -rw-r–r–   1 root   root 3179806720 Oct  7 20:33 grid.tar
      4 drwxr-xr-x   2 root   root       4096 Oct  7 20:03 resource
      8 drwxr-xr-x  22 root   root       4096 Oct  7 19:39 var
      8 drwxr-xr-x   3 root   root       4096 Oct  7 19:37 tftpboot
      8 drwxr-xr-x  15 root   root       4096 Oct  7 19:34 usr
      8 drwxr-xr-x   2 root   root       4096 Oct  7 19:33 selinux
     10 dr-xr-xr-x   8 root   root      10240 Aug 19 15:48 media
      8 drwxr-xr-x   2 root   root       4096 Aug  8  2008 srv
     16 drwxr-xr-x   8 root   root      16384 Jan  1  1970 mnt
[root@as51 /]# su – oracle
[oracle@as51 ~]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.1.0 Production on 星期三 10月 14 22:40:22 2009

Copyright (c) 1982, 2009, Oracle.  All rights reserved.

已连接到空闲例程。

Random Posts

留下评论