Oracle 11g中SYS串連阻止關閉資料庫

來源:互聯網
上載者:User

以前就發現11g的Oracle有這個問題,一直沒有太在意,直到今天關閉資料庫的時候發現很長時間Oracle都無法正常關閉。

  從後台查詢,探索資料庫出現錯誤提示:

SHUTDOWN: Active processes prevent shutdown operation


  檢查資料庫後台進程,未發現佔用大量資源的串連,實際上整個資料庫中只有一個本地串連:

      bash-3.00$ ps -ef|grep oraclerac11g2
  oracle 22273 22272 0 19:59:51 ? 0:00 oraclerac11g2 (DESCRIPTION=(LOCAL=YES)(ADDRESS=(PROTOCOL=beq)))
  oracle 29307 22520 0 20:09:28 pts/2 0:00 grep oraclerac11g2


  經過檢查發現,似乎是由於當前的SYS串連沒有退出,而直接通過HOST命令啟動了另一個sqlplus命令,並在其中執行了shutdown immediate操作,這時就會導致shutdown immediate被hang住:

    $ sqlplus "/ as sysdba"
  SQL*Plus: Release 11.1.0.6.0 - Production on 星期五 8月 22 19:49:35 2008
  Copyright (c) 1982, 2007, Oracle. All rights reserved.
  串連到:
  Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - 64bit Production
  With the Partitioning, Real Application Clusters, OLAP, Data Mining
  and Real Application Testing options
  SQL> shutdown immediate資料庫已經關閉。已經卸載資料庫。
  ORACLE 常式已經關閉。
  SQL> startup
  ORACLE 常式已經啟動。
  Total System Global Area 1.7108E+10 bytes
  Fixed Size 2101632 bytes
  Variable Size 3344420480 bytes
  Database Buffers 1.3757E+10 bytes
  Redo Buffers 4431872 bytes資料庫裝載完畢。資料庫已經開啟。


  下面啟動另一個會話,並以SYS登陸資料庫,然後嘗試關閉資料庫:

      SQL> shutdown immediate資料庫已經關閉。已經卸載資料庫。
  ORACLE 常式已經關閉。

探索資料庫可以正常關閉,然後根據剛才的描述,在sqlplus中切換到主機命令列,然後再新啟動一個sqlplus,執行shutdown immediate:


      SQL> startup
  ORACLE 常式已經啟動。
  Total System Global Area 1.7108E+10 bytes
  Fixed Size 2101632 bytes
  Variable Size 3344420480 bytes
  Database Buffers 1.3757E+10 bytes
  Redo Buffers 4431872 bytes資料庫裝載完畢。資料庫已經開啟。
  SQL> select count(*) from v$session;
  COUNT(*)
  ----------
  36
  SQL> host
  $ sqlplus "/ as sysdba"
  SQL*Plus: Release 11.1.0.6.0 - Production on 星期五 8月 22 19:59:51 2008
  Copyright (c) 1982, 2007, Oracle. All rights reserved.
  串連到:
  Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - 64bit Production
  With the Partitioning, Real Application Clusters, OLAP, Data Mining
  and Real Application Testing options
  SQL> shutdown immediate


  和預期的一樣,關閉命令被hang住了,檢查alert檔案就可以看到上面的提示資訊。

  退出當前的會話,回到原始會話,並重新串連,就可以正常的關閉資料庫了:

    SQL> shutdown immediate
  ^CORA-01013: 使用者請求取消當前的操作
  SQL> exit從 Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - 64bit Production
  With the Partitioning, Real Application Clusters, OLAP, Data Mining
  and Real Application Testing options 斷開
  $ exit
  SQL> shutdown immediate
  ORA-03135: 串連失去聯絡
  SQL> conn / as sysdba已串連。
  SQL> shutdown immediate資料庫已經關閉。已經卸載資料庫。
  ORACLE 常式已經關閉。


而920版本的資料庫是沒有這個問題的:

      [oracle@bjtest ~]$ sqlplus "/ as sysdba"
  SQL*Plus: Release 9.2.0.4.0 - Production on 星期六 8月 23 04:14:36 2008
  Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.
  已串連到空閑常式。
  SQL> host
  [oracle@bjtest ~]$ ps -ef|grep ora
  root 3804 3792 0 Jul18 ? 00:00:29 hald-addon-storage: polling /dev/hda
  root 26417 26385 0 04:14 pts/1 00:00:00 su - oracle
  oracle 26418 26417 0 04:14 pts/1 00:00:00 -bash
  oracle 26451 26418 0 04:14 pts/1 00:00:00 sqlplus
  oracle 26452 26451 0 04:14 ? 00:00:00 oraclebjtest (DESCRIPTION=(LOCAL=YES)(ADDRESS=(PROTOCOL=beq)))
  oracle 26453 26451 0 04:14 pts/1 00:00:00 /bin/bash
  oracle 26481 26453 0 04:14 pts/1 00:00:00 ps -ef
  oracle 26482 26453 0 04:14 pts/1 00:00:00 grep ora
  [oracle@bjtest ~]$ exit
  exit
  SQL> startup
  ORACLE 常式已經啟動。
  Total System Global Area 9415145752 bytes
  Fixed Size 755992 bytes
  Variable Size 822083584 bytes
  Database Buffers 8589934592 bytes
  Redo Buffers 2371584 bytes資料庫裝載完畢。資料庫已經開啟。
  SQL> host
  [oracle@bjtest ~]$ sqlplus "/ as sysdba"
  SQL*Plus: Release 9.2.0.4.0 - Production on 星期六 8月 23 04:15:08 2008
  Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.
  串連到:
  Oracle9i Enterprise Edition Release 9.2.0.4.0 - 64bit Production
  With the Partitioning, OLAP and Oracle Data Mining options
  JServer Release 9.2.0.4.0 - Production
  SQL> shutdown immediate資料庫已經關閉。已經卸載資料庫。
  ORACLE 常式已經關閉。
  SQL> exit從Oracle9i Enterprise Edition Release 9.2.0.4.0 - 64bit Production
  With the Partitioning, OLAP and Oracle Data Mining options
  JServer Release 9.2.0.4.0 - Production中斷開
  [oracle@bjtest ~]$ exit
  exit
  SQL> exit
  ERROR:
  ORA-03113: 通訊通道的檔案結束
  從Oracle9i Enterprise Edition Release 9.2.0.4.0 - 64bit Production
  With the Partitioning, OLAP and Oracle Data Mining options
  JServer Release 9.2.0.4.0 - Production(情況複雜)中斷開

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.