今天开发那边说连不上数据库,我启动的时候发现总是报“ORA-03113: 通信通道的文件结尾”错误,分析可能由于数据库立即关闭,导致文件状态可能不一致,因为正常关闭数据库会同步校验各文件,使得重新启动的时候文件时间点一致并且不用进行崩溃恢复(我的环境是Oracle 11g,AS4)
Last login: Tue Oct 15 08:27:12 2013 from 192.168.1.100
Happy Everyday!
[root@j2ee ~]# ps -ef | grep ora
root      1438  1396  0 Oct10 ?        00:04:24 hald-addon-storage: polling /dev/sr0 (every 2 sec)
oracle    2189     1  0 Oct10 ?        00:02:35 ora_pmon_orcl
oracle    2191     1  0 Oct10 ?        00:06:23 ora_vktm_orcl
oracle    2195     1  0 Oct10 ?        00:00:06 ora_gen0_orcl
oracle    2197     1  0 Oct10 ?        00:00:01 ora_diag_orcl
oracle    2199     1  0 Oct10 ?        00:01:09 ora_dbrm_orcl
oracle    2201     1  0 Oct10 ?        00:00:27 ora_psp0_orcl
oracle    2203     1  1 Oct10 ?        04:30:15 ora_dia0_orcl
oracle    2205     1  0 Oct10 ?        00:00:08 ora_mman_orcl
oracle    2207     1  0 Oct10 ?        00:01:10 ora_dbw0_orcl
oracle    2209     1  0 Oct10 ?        00:19:40 ora_lgwr_orcl
oracle    2211     1  0 Oct10 ?        00:06:31 ora_ckpt_orcl
oracle    2213     1  0 Oct10 ?        00:00:41 ora_smon_orcl
oracle    2215     1  0 Oct10 ?        00:00:00 ora_reco_orcl
oracle    2217     1  0 Oct10 ?        00:03:47 ora_mmon_orcl
oracle    2219     1  0 Oct10 ?        00:30:57 ora_mmnl_orcl
oracle    2221     1  0 Oct10 ?        00:00:07 ora_d000_orcl
oracle    2223     1  0 Oct10 ?        00:00:07 ora_s000_orcl
oracle    2231     1  0 Oct10 ?        00:00:22 ora_arc0_orcl
oracle    2233     1  0 Oct10 ?        00:00:21 ora_arc1_orcl
oracle    2235     1  0 Oct10 ?        00:00:07 ora_arc2_orcl
oracle    2237     1  0 Oct10 ?        00:00:21 ora_arc3_orcl
oracle    2240     1  0 Oct10 ?        00:00:13 ora_qmnc_orcl
oracle    2254     1  0 Oct10 ?        00:03:51 ora_cjq0_orcl
oracle    2268     1  0 Oct10 ?        00:00:00 ora_q001_orcl
oracle    2277     1  0 Oct10 ?        00:01:08 /u01/app/oracle/product/11.2.0/dbhome_1/bin/tnslsnr LISTENER -inherit
oracle    2319     1  0 Oct10 ?        00:00:09 ora_smco_orcl
oracle   13613     1  0 12:13 ?        00:00:00 ora_w000_orcl
root     13693 13662  0 12:20 pts/0    00:00:00 grep ora
oracle   14428     1  0 Oct11 ?        00:00:35 ora_q002_orcl
oracle   16916     1  0 Oct15 ?        00:00:50 oracleorcl (LOCAL=NO)
oracle   16923     1  0 Oct15 ?        00:00:26 oracleorcl (LOCAL=NO)
oracle   16951     1  0 Oct15 ?        00:00:33 oracleorcl (LOCAL=NO)
oracle   26963     1  0 Oct15 ?        00:00:48 oracleorcl (LOCAL=NO)
oracle   32340     1  0 Oct20 ?        00:00:11 ora_j000_orcl
oracle   32342     1  0 Oct20 ?        00:00:29 ora_j001_orcl
oracle   32348     1  0 Oct20 ?        00:00:10 ora_j002_orcl
oracle   32352     1  0 Oct20 ?        00:00:00 ora_j003_orcl
oracle   32504     1  0 Oct20 ?        00:00:10 ora_j004_orcl
oracle   32526     1  0 Oct20 ?        00:00:00 ora_j005_orcl
oracle   32568     1  0 Oct20 ?        00:00:00 ora_j006_orcl
[root@j2ee ~]# su - oracle
[oracle@j2ee ~]$ sqlplus  /nolog 

SQL*Plus: Release 11.2.0.1.0 Production on 星期二 10月 22 12:20:56 2013

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

SQL> conn /as sysdba
Connected.
SQL> startup
ORA-01081: 无法启动已在运行的 ORACLE - 请首先关闭它
SQL> show user
USER is "SYS"
SQL>
SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
[oracle@j2ee ~]$ dbstart
ORACLE_HOME_LISTNER is not SET, unable to auto-start Oracle Net Listener
Usage: /u01/app/oracle/product/11.2.0/dbhome_1/bin/dbstart ORACLE_HOME
Processing Database instance "orcl": log file /u01/app/oracle/product/11.2.0/dbhome_1/startup.log

[oracle@j2ee ~]$ lsnrctl status

LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 22-10月-2013 12:24:42

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

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 11.2.0.1.0 - Production
Start Date                10-10月-2013 12:59:08
Uptime                    11 days 23 hr. 25 min. 33 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /u01/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora
Listener Log File         /u01/app/oracle/diag/tnslsnr/j2ee/listener/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=j2ee)(PORT=1521)))
The listener supports no services
The command completed successfully
[oracle@j2ee ~]$ lsnrctl start

LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 22-10月-2013 12:24:49

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

TNS-01106: Listener using listener name LISTENER has already been started
[oracle@j2ee ~]$ sqlplus  /nolog

SQL*Plus: Release 11.2.0.1.0 Production on 星期二 10月 22 12:25:58 2013

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

SQL> conn /as sysdba
Connected to an idle instance.
SQL> shut immediate
ORA-01034: ORACLE not available
ORA-27101: shared memory realm does not exist
Linux-x86_64 Error: 2: No such file or directory
SQL> show user
USER is "SYS"
SQL> startup
ORACLE instance started.

Total System Global Area  839282688 bytes
Fixed Size                  2217992 bytes
Variable Size             822085624 bytes
Database Buffers            8388608 bytes
Redo Buffers                6590464 bytes
Database mounted.
ORA-03113: 通信通道的文件结尾 进程 ID:
14281
会话 ID: 3012 序列号: 5

SQL> startup
ORA-24324: 未初始化服务句柄
ORA-01041: 内部错误, hostdef 扩展名不存在
SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

[oracle@j2ee ~]$ exit
logout
[root@j2ee ~]# ps -ef | grep ora
root      1438  1396  0 Oct10 ?        00:04:25 hald-addon-storage: polling /dev/sr0 (every 2 sec)
oracle    2277     1  0 Oct10 ?        00:01:08 /u01/app/oracle/product/11.2.0/dbhome_1/bin/tnslsnr LISTENER -inherit
root     14296 13662  0 12:27 pts/0    00:00:00 grep ora

解决方法:
[root@j2ee ~]# su - oracle
SQL> conn /as sysdba
Connected to an idle instance.

SQL> startup mount
ORACLE instance started.

Total System Global Area  839282688 bytes
Fixed Size                  2217992 bytes
Variable Size             822085624 bytes
Database Buffers            8388608 bytes
Redo Buffers                6590464 bytes
Database mounted.
SQL>  select * from v$log;

    GROUP#    THREAD#  SEQUENCE#      BYTES  BLOCKSIZE    MEMBERS ARC STATUS           FIRST_CHANGE# FIRST_TIME     NEXT_CHANGE# NEXT_TIME
---------- ---------- ---------- ---------- ---------- ---------- --- ---------------- ------------- -------------- ------------ --------------
         1          1       2359   52428800        512          1 NO  INACTIVE              48385296 20-10月-13         48412101 20-10月-13
         3          1       2361   52428800        512          1 NO  CURRENT               48427959 20-10月-13       2.8147E+14
         2          1       2360   52428800        512          1 NO  INACTIVE              48412101 20-10月-13         48427959 20-10月-13

SQL> alter database open resetlogs;
alter database open resetlogs
*
ERROR at line 1:
ORA-01139: RESETLOGS 选项仅在不完全数据库恢复后有效

SQL>  select * from v$log;

    GROUP#    THREAD#  SEQUENCE#      BYTES  BLOCKSIZE    MEMBERS ARC STATUS           FIRST_CHANGE# FIRST_TIME     NEXT_CHANGE# NEXT_TIME
---------- ---------- ---------- ---------- ---------- ---------- --- ---------------- ------------- -------------- ------------ --------------
         1          1       2359   52428800        512          1 NO  INACTIVE              48385296 20-10月-13         48412101 20-10月-13
         3          1       2361   52428800        512          1 NO  CURRENT               48427959 20-10月-13       2.8147E+14
         2          1       2360   52428800        512          1 NO  INACTIVE              48412101 20-10月-13         48427959 20-10月-13

SQL>  recover database until time '2013-10-20 1:45:02';
Media recovery complete.
SQL> alter database open resetlogs;

Database altered.

SQL> shutdown
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup
ORACLE instance started.

Total System Global Area  839282688 bytes
Fixed Size                  2217992 bytes
Variable Size             796919800 bytes
Database Buffers           33554432 bytes
Redo Buffers                6590464 bytes
Database mounted.
Database opened.
SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
[oracle@j2ee ~]$  lsnrctl start

LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 22-10月-2013 12:44:49

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

Starting /u01/app/oracle/product/11.2.0/dbhome_1/bin/tnslsnr: please wait...

TNSLSNR for Linux: Version 11.2.0.1.0 - Production
System parameter file is /u01/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora
Log messages written to /u01/app/oracle/diag/tnslsnr/j2ee/listener/alert/log.xml
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=j2ee)(PORT=1521)))

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 11.2.0.1.0 - Production
Start Date                22-10月-2013 12:44:51
Uptime                    0 days 0 hr. 0 min. 0 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /u01/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora
Listener Log File         /u01/app/oracle/diag/tnslsnr/j2ee/listener/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=j2ee)(PORT=1521)))
The listener supports no services
The command completed successfully
[oracle@j2ee ~]$ emctl start dbconsole
Environment variable ORACLE_UNQNAME not defined. Please set ORACLE_UNQNAME to database unique name.