一、症状
在启动oracle数据库时,报了这个错:
- [oracle@ltdit3 ~]$ ./startOracle.sh start
- Starting Oracle:
- LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 27-JUN-2013 10:20:45
- Copyright (coffee) 1991, 2009, Oracle. All rights reserved.
- TNS-01106: Listener using listener name LISTENER has already been started
- SQL*Plus: Release 11.2.0.1.0 Production on Thu Jun 27 10:20:45 2013
- Copyright (c) 1982, 2009, Oracle. All rights reserved.
- SQL> Connected to an idle instance.
- SQL> ORA-01078: failure in processing system parameters
- LRM-00109: could not open parameter file '/opt/oracle/112/dbs/initorcaleexport.ora'
- SQL> Disconnected
- OK
二、原因
注意其中这句话:
- SQL> ORA-01078: failure in processing system parameters
- LRM-00109: could not open parameter file '/opt/oracle/112/dbs/initorcaleexport.ora'
还原启动过程,发现执行者用的是su oracle切换到oracle用户,查了一下资料,su oracle 和 su - oracle是有区别的:
-, -l ,--login make the shell a login shell
加了"-",是以login shell登陆的,所以会设置环境变量,如果不加,使用的还是切换前用户的环境变量,所以会出错。
- [oracle@ltdit3 ~]$ su --help
- Usage: su [OPTION]... [-] [USER [ARG]...]
- Change the effective user id and group id to that of USER.
- -, -l, --login make the shell a login shell
- -c, --command=COMMAND pass a single COMMAND to the shell with -c
- --session-command=COMMAND pass a single COMMAND to the shell with -c
- and do not create a new session
- -f, --fast pass -f to the shell (for csh or tcsh)
- -m, --preserve-environment do not reset environment variables
- -p same as -m
- -s, --shell=SHELL run SHELL if /etc/shells allows it
- --help display this help and exit
- --version output version information and exit
- A mere - implies -l. If USER not given, assume root.
- Report bugs to <bug-coreutils@gnu.org>.
- [oracle@ltdit3 ~]$
三、解决方法
用su - oracle 取代 su oracle就可以了。
四、总结
1、做事要细心。
2、遇到问题多问一个为什么。
开始用户报错给我的时候,直接就在本地解决了,之后突发奇想,为什么用户那里会报错,过去看了一下,发现问题所在,就在一个“-”上,打了一下su --help,就知道加和不加的原因了。