今天静默安装完oracle11gr2版本后,连入数据库后,出现如下情况:
[oracle@oracle response]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.1.0 Production on Fri Sep 29 09:04:40 2017
Copyright (c) 1982, 2009, Oracle. All rights reserved.
Connected to an idle instance.
SQL> shutdown 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> alter system register;
alter system register
*
ERROR at line 1:
ORA-01034: ORACLE not available
Process ID: 0
Session ID: 0 Serial number: 0
于是上网查了一下资料,排除了内存不足问题,说是数据库没有打开,然后尝试重新打开,结果还是报错。如下:
SQL> startup mount;
ORA-01078: failure in processing system parameters
LRM-00109: could not open parameter file '/u01/app/oracle/product/11.2.0/dbhome_1/dbs/initORCL.ora'
根据提示查找initORCL.ora文件,发现没有。于是将$ORACLE_BASE/admin/orcl/pfile目录下的init.ora.***形式的文件copy到$ORACLE_HOME/dbs目录下重命名为initORCL.ora即可。(注:initORCL.ora中的orcl为你的实例名 ORACLE_SID,这里我的SID为:ORCL)
或者将$ORACLE_HOME/dbs目录下spflieoracl.ora改名为spfileORCL.ora即可。(注:spfileORCL.ora中的ORCL为环境变量中设置的SID)
[oracle@oracle ~]$ cp /u01/app/oracle/admin/orcl/pfile/init.ora.82920179156 $ORACLE_HOME/dbs/initORCL.ora
[oracle@oracle ~]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.1.0 Production on Fri Sep 29 11:58:27 2017
Copyright (c) 1982, 2009, Oracle. All rights reserved.
Connected to an idle instance.
SQL> startup mount;
ORACLE instance started.
Total System Global Area 626327552 bytes
Fixed Size 2215944 bytes
Variable Size 184553464 bytes
Database Buffers 436207616 bytes
Redo Buffers 3350528 bytes
ORA-01102: cannot mount database in EXCLUSIVE mode
尝试正常关闭数据库:
SQL> shutdown immediate;
ORA-01507: database not mounted
ORACLE instance shut down.
查了一下资料,发现是lk<SID>文件造成的,该文件位于ORALCE_HOME下的dbs目录下,马上检查该文件:
[oracle@oracle ~]$ ls $ORACLE_HOME/dbs
hc_DBUA0.dat hc_ORCL.dat initORCL.ora orapworcl
hc_orcl.dat init.ora lkORCL spfileorcl.ora
[oracle@oracle dbs]$ fuser -u lkORCL
lkORCL: 7621(oracle) 7627(oracle) 7631(oracle) 7633(oracle) 7637(oracle) 7639(oracle) 7641(oracle) 7643(oracle) 7645(oracle) 7647(oracle) 7649(oracle) 7651(oracle) 7663(oracle) 7680(oracle) 7682(oracle) 7684(oracle) 7692(oracle) 8272(oracle)
果然该文件没有释放,用fuser命令kill掉:
[oracle@oracle dbs]$ fuser -k lkORCL
lkORCL: 7621 7627 7631 7633 7637 7639 7641 7643 7645 7647 7649 7651 7663 7680 7682 7684 7692 8272
[oracle@oracle dbs]$ fuser -u lkORCL
然后:
SQL> startup mount;
ORACLE instance started.
Total System Global Area 626327552 bytes
Fixed Size 2215944 bytes
Variable Size 184553464 bytes
Database Buffers 436207616 bytes
Redo Buffers 3350528 bytes
Database mounted.
在进行归档时发现:
SQL> alter database archivelog;
alter database archivelog
*
ERROR at line 1:
ORA-00265: instance recovery required, cannot set ARCHIVELOG mode
继续查资料,发现需要先将数据库起到open状态:
SQL> alter dababase open;
alter dababase open
*
ERROR at line 1:
ORA-00940: invalid ALTER command
发现还是报错,继续查资料,找到一个datafile被offline的解决办法。解决办法。
shutdown immediate
startup mount
recover datafile 2
alter database datafile 2 online
alter datebase open
结果如下:
SQL> recover datafile 2;
Media recovery complete.
SQL> alter database datafile 2 online;
Database altered.
SQL> alter database open;
Database altered.
然后对数据库进行重启,问题解决。
静默安装了很多次,头一次出现安装好就无法登陆数据库的问题,折腾到半夜两点,还是度参数不熟悉,继续努力吧!
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。