sqlplus / as sysdba 登錄oracle時(shí)報(bào)錯(cuò)ORA-01012: not logged on
發(fā)生原因:關(guān)閉數(shù)據(jù)庫(kù)是shutdown 后面沒(méi)有接關(guān)閉參數(shù)中的任何一個(gè)。
以下是shutdown使用的一些參數(shù)
nomal --->所有連接都斷開(kāi)時(shí)才能關(guān)閉;
transactional --->等待事務(wù)結(jié)束后,主動(dòng)斷開(kāi)連接;
immediate --->主動(dòng)斷開(kāi)事務(wù)和連接;
abort --->立刻關(guān)閉數(shù)據(jù)庫(kù),這個(gè)操作是危險(xiǎn)的,不會(huì)同步數(shù)據(jù),不觸發(fā)檢查點(diǎn),回滾段直接清 空,相當(dāng)于掉電,每次啟動(dòng)都要實(shí)例恢復(fù)。
[root@iZ2zeh44pi6rlahxj7s9azZ ~]# su - oracle
[oracle@iZ2zeh44pi6rlahxj7s9azZ ~]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.4.0 Production on Thu Sep 7 10:43:18 2017
Copyright (c) 1982, 2013, Oracle.? All rights reserved.
Connected.
SQL> startup;
ORA-01012: not logged on
SQL> select * from all_tables;
select * from all_tables
*
ERROR at line 1:
ORA-01012: not logged on
Process ID: 0
Session ID: 0 Serial number: 0
第一種方法:
[root@iZ2zeh44pi6rlahxj7s9azZ ~]#?ps -ef | grep ora_dbw0_$Oracle_SID
[root@iZ2zeh44pi6rlahxj7s9azZ ~]# kill -9 pid
[root@iZ2zeh44pi6rlahxj7s9azZ ~]# su - oracle
[oracle@iZ2zeh44pi6rlahxj7s9azZ oracle]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.4.0 Production on Thu Sep 7 11:31:23 2017
Copyright (c) 1982, 2013, Oracle.? All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, Oracle Label Security, OLAP, Data Mining,
Oracle Database Vault and Real Application Testing options
SQL> startup
ORACLE instance started.
Total System Global Area? 768294912 bytes
Fixed Size? ? ? ? ? ? 2257192 bytes
Variable Size? ? ? ? ? 503320280 bytes
Database Buffers? ? ? 260046848 bytes
Redo Buffers? ? ? ? ? ? 2670592 bytes
Database mounted.
Database opened.
第一種方法搞不定,那么用第二種方法(利用oracle的小工具)
[root@iZ2zeh44pi6rlahxj7s9azZ ~]# sysresv
IPC Resources for ORACLE_SID "dtstack" :
Shared Memory:
ID? ? ? ? KEY
262145? ? ? 0x00000000
294914? ? ? 0x00000000
327683? ? ? 0x7d9066c0
Semaphores:
ID? ? ? ? KEY
786437? ? ? 0x50f506b0
Unable to determine if Oracle instance alivefor sid "dtstack"
[root@iZ2zeh44pi6rlahxj7s9azZ ~]# ipcrm -m 262145
[root@iZ2zeh44pi6rlahxj7s9azZ ~]# ipcrm -m 294914
[root@iZ2zeh44pi6rlahxj7s9azZ ~]# ipcrm -m 327683
[root@iZ2zeh44pi6rlahxj7s9azZ ~]# su - oracle
[oracle@iZ2zeh44pi6rlahxj7s9azZ oracle]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.4.0 Production on Thu Sep 7 11:31:23 2017
Copyright (c) 1982, 2013, Oracle.? All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, Oracle Label Security, OLAP, Data Mining,
Oracle Database Vault and Real Application Testing options
SQL> startup
ORACLE instance started.
Total System Global Area? 768294912 bytes
Fixed Size? ? ? ? ? ? 2257192 bytes
Variable Size? ? ? ? ? 503320280 bytes
Database Buffers? ? ? 260046848 bytes
Redo Buffers? ? ? ? ? ? 2670592 bytes
Database mounted.
Database opened.
注:
sysresv的小工具來(lái)查看oracle占用的共享內(nèi)存段和信號(hào)量等系統(tǒng)資源的一些關(guān)鍵信息
ipcs命令用于報(bào)告Linux中進(jìn)程間通信設(shè)施的狀態(tài),顯示的信息包括消息列表、共享內(nèi)存和信號(hào)量的信息。