1.现象
由于之前启动过一次报错,首先关闭数据库,然后重启
$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.2.0 Production on 星期二 5月 26 15:36:50 2015
Copyright (c) 1982, 2010, Oracle. All rights reserved.
连接到:
Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> shutdown immediate
ORA-01507: database not mounted
ORACLE 例程已经关闭。
SQL>
SQL> startup
ORACLE 例程已经启动。
Total System Global Area 5.3447E+10 bytes
Fixed Size 2232248 bytes
Variable Size 3.2481E+10 bytes
Database Buffers 2.0938E+10 bytes
Redo Buffers 26517504 bytes
ORA-01102: cannot mount database in EXCLUSIVE mode
SQL>
SQL> exit
从 Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options 断开
$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.2.0 Production on 星期二 5月 26 15:43:32 2015
Copyright (c) 1982, 2010, Oracle. All rights reserved.
连接到:
Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL>
SQL> shutdown immediate
ORA-01507: database not mounted
ORACLE 例程已经关闭。
SQL>
SQL> exit
从 Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options 断开
2.分析原因
到$ORACLE_HOME/dbs下找到lk开头文件,这个错误主要是lk<SID>文件造成的
它的主要作用是说明DATABASE MOUNT上了,不用在MOUNT了;DATABASE UNMOUNT 后会自动删除,但异常情况时文件存在的话,即使数据库已经停掉,系统也会认为数据库已经mount了
$ cd $ORACLE_HOME/dbs
$ ls -l
total 96
-rw-rw---- 1 oracle oinstall 1544 Nov 17 2014 hc_DBUA0.dat
-rw-rw---- 1 oracle oinstall 1544 Nov 17 2014 hc_itdb1.dat
-rw-rw---- 1 oracle oinstall 1544 May 26 15:43 hc_itsys.dat
-rw-rw---- 1 oracle oinstall 1544 May 26 15:43 hc_itsys1.dat
-rw-rw---- 1 oracle oinstall 1544 May 13 16:16 hc_orcl.dat
-rw-r--r-- 1 oracle oinstall 2851 May 15 2009 init.ora
-rw-r----- 1 oracle oinstall 24 Nov 17 2014 lkITSYS1
-rw-r----- 1 oracle oinstall 24 Aug 04 2014 lkORCL
-rw-r----- 1 oracle oinstall 1536 Nov 17 2014 orapwitsys1
-rw-r----- 1 oracle oinstall 1536 Aug 04 2014 orapworcl
-rw-r----- 1 oracle oinstall 2560 May 05 10:15 spfileitsys1.ora
-rw-r----- 1 oracle oinstall 2560 Feb 10 22:00 spfileorcl.ora
3.解决方法
用fuser命令kill掉占用lkITSYS1文件的进程
$ fuser -k lkITSYS1
lkITSYS1: 5701814 5767372 5832954 6946854 7209198 7667712 7930062 8323164 8388624 8847426 9306156 9633968 9699564 9895986 16187422
$ fuser -u lkITSYS1
lkITSYS1:
$
$
$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.2.0 Production on 星期二 5月 26 15:46:35 2015
Copyright (c) 1982, 2010, Oracle. All rights reserved.
已连接到空闲例程。
SQL>
SQL> startup
ORACLE 例程已经启动。
Total System Global Area 5.3447E+10 bytes
Fixed Size 2232248 bytes
Variable Size 3.2481E+10 bytes
Database Buffers 2.0938E+10 bytes
Redo Buffers 26517504 bytes
数据库装载完毕。
数据库已经打开。
SQL>