您好,登錄后才能下訂單哦!
今天靜默安裝完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進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。