前几日,在值班时突然接到客户电话说,主机的ORACLE用户被删除了,我心想是不是搞错了,他又不能登录主机怎么会将主机的oracle账号给删除呢?
带着这个疑问,开始登录相应主机,检查oralce 账号是否存在。
--登录主机检查
[root@ora11 home]# su - oracle
su: user oracle does not exist
oracle账号真的不在了,数据库还能登录吗?(一身小冷汗),怎么没有人反应数据库有问题呢?
--测试数据库能否正常登录
数据库还可以正常登录,查询也可以返回结果,心顿时感觉有点轻松了。那该怎么办呢,先检查一下oracle数据库软件软件目录是否正常
吧.
检查了一下,发现:ORACLE_HOME,ORACLE_BAS目录正常,数据文件,控制文件,在线日志文件也存在。这种情况该怎么处理呢?
是否重建一个Oracle用户就可以了,应该是,创建一个试试吧。
[root@ora11 ~]# /usr/sbin/useradd -u 1002 -g oinstall -G dba oracle
Creating mailbox file: File exists
useradd: warning: the home directory already exists.
Not copying any file from skel directory into it. ---创建成功
[root@ora11 ~]# su - oracle ---可以正常切换用户
[oracle@ora11] /home/oracle> cat .bash_profile ---oracle环境变量检查
# .bash_profile
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
# User specific environment and startup programs
export PS1=[$USER@`hostname`]' $PWD> '
export EDITOR=vi
export HISTFILE=~/.sh_history
export AIXTHREAD_SCOPE=S
export DISPLAY=`hostname`:1
export TMOUT=0
umask 022
set -o vi
PATH=$PATH:$HOME/bin
export PATH
umask 022
export TMP=/tmp
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/11.2
export ORACLE_SID=xulq
export NLS_LANG=AMERICAN_AMERICA.ZHT16BIG5
export ORA_NLS11=$ORACLE_HOME/nls/data
export ORACLE_HOSTNAME=ora11
export TMP=/tmp
export NLS_DATE_FORMAT='YYYY-MM-DD HH24:MI:SS'
export ORACLE_TERM=xterm
export PATH=$PATH:$ORACLE_HOME/bin:/sbin:/usr/sbin
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib:/usr/local/lib
export CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib
export PATH=$PATH:$HOME/bin:$ORACLE_HOME/bin:$ORA_CRS_HOME/bin:/u01/software
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/u01/software:$LD_LIBRARY_PATH
alias ss="sqlplus / as sysdba"
[oracle@ora11] /home/oracle> ss ----登录数据库,也正常
SQL*Plus: Release 11.2.0.4.0 Production on Wed Dec 23 22:02:52 2015
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL>
---重启一下数据库看看,正常不正常吧?
Starting up:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options.
ORACLE_HOME = /u01/app/oracle/11.2
System name: Linux
Node name: ora11
Release: 2.6.18-308.el5
Version: #1 SMP Fri Jan 27 17:17:51 EST 2012
Machine: x86_64
Using parameter settings in server-side spfile /u01/app/oracle/11.2/dbs/spfilexulq.ora
System parameters with non-default values:
processes = 500
sessions = 772
nls_territory = "AMERICA"
nls_date_format = "YYYY-MM-DD HH24:MI:SS"
memory_target = 804M
control_files = "/u01/app/datafile/XULQ/controlfile/o1_mf_bmqj051y_.ctl"
db_block_size = 8192
compatible = "11.2.0.4.0"
log_archive_dest_1 = "location=/u01/arch"
log_archive_dest_2 = "service=standby lgwr async noaffirm"
log_archive_dest_state_2 = "DEFER"
db_create_file_dest = "/u01/app/datafile"
undo_tablespace = "UNDOTBS1"
remote_login_passwordfile= "EXCLUSIVE"
db_domain = ""
dispatchers = "(PROTOCOL=TCP) (SERVICE=xulqXDB)"
cursor_sharing = "force"
audit_file_dest = "/u01/app/oracle/admin/xulq/adump"
audit_trail = "DB"
db_name = "xulq"
open_cursors = 300
diagnostic_dest = "/u01/app/oracle"
Wed Dec 23 22:05:43 2015
PMON started with pid=2, OS id=3827
Wed Dec 23 22:05:43 2015
PSP0 started with pid=3, OS id=3831
Wed Dec 23 22:05:44 2015
VKTM started with pid=4, OS id=3835 at elevated priority
VKTM running at (1)millisec precision with DBRM quantum (100)ms
Wed Dec 23 22:05:44 2015
GEN0 started with pid=5, OS id=3841
Wed Dec 23 22:05:44 2015
DIAG started with pid=6, OS id=3845
Wed Dec 23 22:05:44 2015
DBRM started with pid=7, OS id=3849
Wed Dec 23 22:05:44 2015
DIA0 started with pid=8, OS id=3853
Wed Dec 23 22:05:44 2015
MMAN started with pid=9, OS id=3857
Wed Dec 23 22:05:44 2015
DBW0 started with pid=10, OS id=3861
Wed Dec 23 22:05:44 2015
LGWR started with pid=11, OS id=3865
Wed Dec 23 22:05:44 2015
CKPT started with pid=12, OS id=3869
Wed Dec 23 22:05:44 2015
SMON started with pid=13, OS id=3873
Wed Dec 23 22:05:44 2015
RECO started with pid=14, OS id=3877
Wed Dec 23 22:05:44 2015
MMON started with pid=15, OS id=3881
starting up 1 dispatcher(s) for network address '(ADDRESS=(PARTIAL=YES)(PROTOCOL=TCP))'...
Wed Dec 23 22:05:44 2015
MMNL started with pid=16, OS id=3885
starting up 1 shared server(s) ...
ORACLE_BASE from environment = /u01/app/oracle
Wed Dec 23 22:05:44 2015
ALTER DATABASE MOUNT
Successful mount of redo thread 1, with mount id 139820280
Database mounted in Exclusive Mode
Lost write protection disabled
Completed: ALTER DATABASE MOUNT
Wed Dec 23 22:05:48 2015
ALTER DATABASE OPEN
Thread 1 opened at log sequence 455
Current log# 2 seq# 455 mem# 0: /u01/app/datafile/XULQ/onlinelog/o1_mf_2_bmqj05k7_.log
Successful open of redo thread 1
MTTR advisory is disabled because FAST_START_MTTR_TARGET is not set
SMON: enabling cache recovery
[3907] Successfully onlined Undo Tablespace 2.
Undo initialization finished serial:0 start:933014 end:933044 diff:30 (0 seconds)
Verifying file header compatibility for 11g tablespace encryption..
Verifying 11g file header compatibility for tablespace encryption completed
SMON: enabling tx recovery
Database Characterset is AL32UTF8
No Resource Manager plan active
replication_dependency_tracking turned off (no async multimaster replication found)
Starting background process QMNC
Wed Dec 23 22:05:48 2015
QMNC started with pid=20, OS id=3911
Completed: ALTER DATABASE OPEN ------数据库正常启动。
Starting background process CJQ0
Wed Dec 23 22:05:51 2015
CJQ0 started with pid=22, OS id=3935
Setting Resource Manager plan SCHEDULER[0x32DB]:DEFAULT_MAINTENANCE_PLAN via scheduler window
Setting Resource Manager plan DEFAULT_MAINTENANCE_PLAN via parameter
Wed Dec 23 22:05:54 2015
Starting background process VKRM
Wed Dec 23 22:05:54 2015
VKRM started with pid=21, OS id=3939
‘
由此验证,当数据库创建完成后,主机oracle账号被删除也不会影响数据库的正常运行,但是,即使如此,大家也千万不要将用户删除,也许会触发什么BUG,导致数据库瘫痪呢。