sqlplus / as sysdba 登录oracle时报错ORA-01012: not logged on
发生原因:关闭数据库是shutdown 后面没有接关闭参数中的任何一个。
以下是shutdown使用的一些参数
nomal --->所有连接都断开时才能关闭;
transactional --->等待事务结束后,主动断开连接;
immediate --->主动断开事务和连接;
abort --->立刻关闭数据库,这个操作是危险的,不会同步数据,不触发检查点,回滚段直接清 空,相当于掉电,每次启动都要实例恢复。
[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的小工具来查看oracle占用的共享内存段和信号量等系统资源的一些关键信息
ipcs命令用于报告Linux中进程间通信设施的状态,显示的信息包括消息列表、共享内存和信号量的信息。
原文链接