误修改/u01权限/所有者的故障恢复

联系:手机/微信(+86 17813235971) QQ(107644445)

标题:误修改/u01权限/所有者的故障恢复

作者:惜分飞©版权所有[未经本人同意,不得以任何形式转载,否则有进一步追究法律责任的权利.]

有朋友找到我,说他对生产库做了误操作,导致数据库异常,请我帮忙处理,对/u01目录修改了用户和权限,导致数据库无法登录,但是业务还在继续
误操作命令

mkdir -p /u01/app/grid
mkdir -p /u01/app/11.2.0/grid
chown -R grid:oinstall /u01
mkdir -p /u01/app/oracle
chown oracle:oinstall /u01/app/oracle
chmod -R 775 /u01

尝试sqlplus登录数据库报ORA-12547

[oracle@www.xifenfei.com admin]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.3.0 Production on Wed Jul 1 17:40:42 2015
Copyright (c) 1982, 2011, Oracle.  All rights reserved.
ERROR:
ORA-12547: TNS:lost contact
Enter user-name:
ERROR:
ORA-12547: TNS:lost contact
Enter user-name:
ERROR:
ORA-12547: TNS:lost contact
SP2-0157: unable to CONNECT to ORACLE after 3 attempts, exiting SQL*Plus

数据库alert日志报错

Wed Jul 01 18:03:22 2015
Errors in file /u01/app/oracle/diag/rdbms/xifenfei/xifenfei/trace/xifenfei_ora_28977.trc  (incident=129553):
ORA-00600: internal error code, arguments: [spstp: ORACLE_HOME uid does not match euid], [1100], [1101], [], [], [], [], [], [], [], [], []
Incident details in: /u01/app/oracle/diag/rdbms/xifenfei/xifenfei/incident/incdir_129553/xifenfei_ora_28977_i129553.trc
Errors in file /u01/app/oracle/diag/rdbms/xifenfei/xifenfei/incident/incdir_129553/xifenfei_ora_28977_i129553.trc:
ORA-00600: internal error code, arguments: [spstp: ORACLE_HOME uid does not match euid], [1100], [1101], [], [], [], [], [], [], [], [], []
Wed Jul 01 18:03:22 2015
Errors in file /u01/app/oracle/diag/rdbms/xifenfei/xifenfei/trace/xifenfei_ora_28979.trc  (incident=129561):
ORA-00600: internal error code, arguments: [spstp: ORACLE_HOME uid does not match euid], [1100], [1101], [], [], [], [], [], [], [], [], []
Incident details in: /u01/app/oracle/diag/rdbms/xifenfei/xifenfei/incident/incdir_129561/xifenfei_ora_28979_i129561.trc
Errors in file /u01/app/oracle/diag/rdbms/xifenfei/xifenfei/incident/incdir_129561/xifenfei_ora_28979_i129561.trc:
ORA-00600: internal error code, arguments: [spstp: ORACLE_HOME uid does not match euid], [1100], [1101], [], [], [], [], [], [], [], [], []
Wed Jul 01 18:03:22 2015
Errors in file /u01/app/oracle/diag/rdbms/xifenfei/xifenfei/trace/xifenfei_ora_28985.trc  (incident=129569):
ORA-00600: internal error code, arguments: [spstp: ORACLE_HOME uid does not match euid], [1100], [1101], [], [], [], [], [], [], [], [], []
Incident details in: /u01/app/oracle/diag/rdbms/xifenfei/xifenfei/incident/incdir_129569/xifenfei_ora_28985_i129569.trc
Errors in file /u01/app/oracle/diag/rdbms/xifenfei/xifenfei/incident/incdir_129569/xifenfei_ora_28985_i129569.trc:
ORA-00600: internal error code, arguments: [spstp: ORACLE_HOME uid does not match euid], [1100], [1101], [], [], [], [], [], [], [], [], []
Wed Jul 01 18:03:22 2015
Errors in file /u01/app/oracle/diag/rdbms/xifenfei/xifenfei/trace/xifenfei_ora_28983.trc  (incident=129577):
ORA-00600: internal error code, arguments: [spstp: ORACLE_HOME uid does not match euid], [1100], [1101], [], [], [], [], [], [], [], [], []
Incident details in: /u01/app/oracle/diag/rdbms/xifenfei/xifenfei/incident/incdir_129577/xifenfei_ora_28983_i129577.trc
Errors in file /u01/app/oracle/diag/rdbms/xifenfei/xifenfei/incident/incdir_129577/xifenfei_ora_28983_i129577.trc:
ORA-00600: internal error code, arguments: [spstp: ORACLE_HOME uid does not match euid], [1100], [1101], [], [], [], [], [], [], [], [], []

trace文件信息

Dump file /u01/app/oracle/diag/rdbms/hybris01/hybris01/incident/incdir_129577/hybris01_ora_28983_i129577.trc
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
ORACLE_HOME = /u01/app/oracle/product/11.2.0/db_1
System name:	Linux
Node name:	dpppdridbo00
Release:	2.6.32-431.17.1.el6.x86_64
Version:	#1 SMP Wed May 7 23:32:49 UTC 2014
Machine:	x86_64
Instance name: hybris01
Redo thread mounted by this instance: 0 <none>
Oracle process number: 0
Unix process pid: 28983, image: oracle@dpppdridbo00
*** 2015-07-01 18:03:22.296
Dump continued from file: /u01/app/oracle/diag/rdbms/hybris01/hybris01/trace/hybris01_ora_28983.trc
ORA-00600: internal error code, arguments: [spstp: ORACLE_HOME uid does not match euid], [1100], [1101], [], [], [], [], [], [], [], [], []
========= Dump for incident 129577 (ORA 600 [spstp: ORACLE_HOME uid does not match euid]) ========
*** 2015-07-01 18:03:22.297
dbkedDefDump(): Starting incident default dumps (flags=0x0, level=3, mask=0x0)
----- Error Stack Dump -----
ORA-00600: internal error code, arguments: [spstp: ORACLE_HOME uid does not match euid], [1100], [1101], [], [], [], [], [], [], [], [], []
----- SQL Statement (None) -----
Current SQL information unavailable - no SGA.

相关用户名相关信息

[oracle@dpppdridbo00 incdir_129577]$ id grid
uid=1100(grid) gid=1000(oinstall) groups=1000(oinstall),1100(asmadmin),1300(asmdba),1301(asmoper)
[oracle@dpppdridbo00 incdir_129577]$ id oracle
uid=1101(oracle) gid=1000(oinstall) groups=1000(oinstall),1200(dba),1300(asmdba)

这里比较明显,数据库的oracle_home,的所有者id为1101,但是被修改为了1100

查看相关目录文件权限

[oracle@www.xifenfei.com ~]$ env|grep ORA
ORACLE_SID=xifenfei
ORACLE_BASE=/u01/app/oracle
ORACLE_TERM=xterm
ORACLE_HOME=/u01/app/oracle/product/11.2.0/db_1
[oracle@www.xifenfei.com ~]$ cd /u01/app/oracle/product/11.2.0/db_1
[oracle@www.xifenfei.com db_1]$ ls -ltr
total 308
-rwxrwxr-x.  1 grid oinstall    63 Mar  1 16:39 oraInst.loc
drwxrwxr-x.  8 grid oinstall  4096 Mar  1 16:40 assistants
drwxrwxr-x.  6 grid oinstall  4096 Mar  1 16:40 crs
drwxrwxr-x.  3 grid oinstall  4096 Mar  1 16:40 csmig
drwxrwxr-x.  7 grid oinstall  4096 Mar  1 16:40 cv
drwxrwxr-x.  3 grid oinstall  4096 Mar  1 16:40 demo
drwxrwxr-x.  3 grid oinstall  4096 Mar  1 16:40 diagnostics
drwxrwxr-x.  3 grid oinstall  4096 Mar  1 16:40 has
drwxrwxr-x.  3 grid oinstall  4096 Mar  1 16:40 emcli
drwxrwxr-x.  4 grid oinstall  4096 Mar  1 16:40 dv
drwxrwxr-x.  8 grid oinstall  4096 Mar  1 16:40 ide
drwxrwxr-x.  8 grid oinstall  4096 Mar  1 16:40 javavm
drwxrwxr-x.  4 grid oinstall  4096 Mar  1 16:40 jdev
drwxrwxr-x.  6 grid oinstall  4096 Mar  1 16:40 md
drwxrwxr-x.  6 grid oinstall  4096 Mar  1 16:40 nls
drwxrwxr-x.  6 grid oinstall  4096 Mar  1 16:40 odbc
drwxrwxr-x.  5 grid oinstall  4096 Mar  1 16:40 olap
drwxrwxr-x.  4 grid oinstall  4096 Mar  1 16:40 oracore
drwxrwxr-x.  8 grid oinstall  4096 Mar  1 16:40 ord
drwxrwxr-x.  4 grid oinstall  4096 Mar  1 16:40 owm
drwxrwxr-x.  7 grid oinstall  4096 Mar  1 16:40 precomp
drwxrwxr-x.  4 grid oinstall  4096 Mar  1 16:40 scheduler
drwxrwxr-x.  4 grid oinstall  4096 Mar  1 16:40 relnotes
drwxrwxr-x.  3 grid oinstall  4096 Mar  1 16:40 slax
drwxrwxr-x.  3 grid oinstall  4096 Mar  1 16:40 sqlj
drwxrwxr-x.  3 grid oinstall  4096 Mar  1 16:40 wwg
drwxrwxr-x.  3 grid oinstall  4096 Mar  1 16:40 usm
drwxrwxr-x.  4 grid oinstall  4096 Mar  1 16:40 uix
drwxrwxr-x.  6 grid oinstall  4096 Mar  1 16:40 plsql
drwxrwxr-x.  2 grid oinstall  4096 Mar  1 16:40 utl
drwxrwxr-x.  7 grid oinstall  4096 Mar  1 16:40 xdk
drwxrwxr-x.  2 grid oinstall  4096 Mar  1 16:40 instantclient
drwxrwxr-x. 20 grid oinstall  4096 Mar  1 16:40 oc4j
drwxrwxr-x.  2 grid oinstall  4096 Mar  1 16:40 timingframework
drwxrwxr-x.  4 grid oinstall  4096 Mar  1 16:41 clone
drwxrwxr-x.  4 grid oinstall  4096 Mar  1 16:41 j2ee
drwxrwxr-x.  8 grid oinstall  4096 Mar  1 16:41 apex
drwxrwxr-x. 13 grid oinstall  4096 Mar  1 16:41 sqldeveloper
drwxrwxr-x.  2 grid oinstall  4096 Mar  1 16:41 jlib
drwxrwxr-x.  2 grid oinstall  4096 Mar  1 16:41 dc_ocm
drwxrwxr-x.  6 grid oinstall  4096 Mar  1 16:41 jdk
drwxrwxr-x.  3 grid oinstall  4096 Mar  1 16:41 jdbc
drwxrwxr-x.  3 grid oinstall  4096 Mar  1 16:41 ucp
drwxrwxr-x.  7 grid oinstall  4096 Mar  1 16:41 OPatch
drwxrwxr-x.  7 grid oinstall  4096 Mar  1 16:41 ccr
drwxrwxr-x. 26 grid oinstall  4096 Mar  1 16:41 owb
drwxrwxr-x.  6 grid oinstall  4096 Mar  1 16:41 mgw
drwxrwxr-x.  7 grid oinstall  4096 Mar  1 16:41 opmn
drwxrwxr-x.  3 grid oinstall  4096 Mar  1 16:41 cdata
drwxrwxr-x.  6 grid oinstall  4096 Mar  1 16:41 css
drwxrwxr-x.  2 grid oinstall  4096 Mar  1 16:41 mesg
drwxrwxr-x.  2 grid oinstall  4096 Mar  1 16:41 config
drwxrwxr-x.  3 grid oinstall  4096 Mar  1 16:41 EMStage
drwxrwxr-x. 12 grid oinstall  4096 Mar  1 16:41 ldap
drwxrwxr-x. 15 grid oinstall  4096 Mar  1 16:41 sysman
drwxrwxr-x.  9 grid oinstall  4096 Mar  1 16:41 srvm
drwxrwxr-x.  7 grid oinstall  4096 Mar  1 16:41 racg
drwxrwxr-x. 10 grid oinstall  4096 Mar  1 16:41 ctx
drwxrwxr-x.  7 grid oinstall  4096 Mar  1 16:42 sqlplus
drwxrwxr-x.  8 grid oinstall  4096 Mar  1 16:42 oui
drwxrwxr-x.  4 grid oinstall 12288 Mar  1 16:42 lib
drwxrwxr-x.  5 grid oinstall  4096 Mar  1 16:42 perl
drwxrwxr-x. 11 grid oinstall  4096 Mar  1 16:42 network
drwxrwxr-x.  4 grid oinstall  4096 Mar  1 16:42 deinstall
drwxrwxr-x.  5 grid oinstall  4096 Mar  1 16:42 hs
-rwxrwxr-x.  1 grid oinstall   494 Mar  1 16:42 root.sh
drwxrwxr-x. 13 grid oinstall  4096 Mar  1 16:42 rdbms
drwxrwxr-x. 13 grid oinstall  4096 Mar  1 16:42 inventory
drwxrwxr-x.  4 grid oinstall  4096 Mar  1 16:42 cfgtoollogs
drwxrwxr-x.  7 grid oinstall  4096 Mar  1 16:44 install
drwxrwxr-x.  2 grid oinstall 12288 Mar  1 16:44 bin
drwxrwxr-x.  4 grid oinstall  4096 Mar  4 18:49 log
drwxrwxr-x.  2 grid oinstall  4096 Jun 30 22:31 dbs

处理方法

root用户
chown -R oracle:oinstall /u01
chown oracle:oinstall /u01/app/oracle
oracle用户
chmod 6751 $ORACLE_HOME/bin/oracle

这里的修改权限,为了保证业务运行正常,是尽量往大的方向修改的,如果条件允许,在后期有条件的情况下,建议重新安装oracle软件