alter database close ORA-16196 ORA-01531 ORA-01093

tengrid發表於2009-05-21

如果沒有其它active連線,Oracle10g中可以用alter database close將DB改到mount狀態. 在mount狀態下如果再用alter database open改到open狀態,則會報錯ora-01109.

必須shutdown 之後再open.
好像是說一個週期內(instance存活期間)只能open一次

在9i中,則是報1531錯誤.

在所有版本中,如果有活動會話,在open狀態下alter database close會報
ORA-01093: ALTER DATABASE CLOSE only permitted with no sessions connected

SQL> shutdown immediate;
ORA-01109: database not open


Database dismounted.
ORACLE instance shut down.
SQL> startup mount;
ORACLE instance started.

Total System Global Area 1258291200 bytes
Fixed Size                  1219184 bytes
Variable Size             503317904 bytes
Database Buffers          738197504 bytes
Redo Buffers               15556608 bytes
Database mounted.
SQL> alter database open;

Database altered.

SQL> alter database close;

Database altered.

SQL> !ps -ef |grep ora_
oracle   21473     1  0 13:47 ?        00:00:00 ora_pmon_orcl
oracle   21475     1  0 13:47 ?        00:00:00 ora_psp0_orcl
oracle   21477     1  0 13:47 ?        00:00:00 ora_mman_orcl
oracle   21479     1  0 13:47 ?        00:00:00 ora_dbw0_orcl
oracle   21481     1  0 13:47 ?        00:00:00 ora_lgwr_orcl
oracle   21483     1  0 13:47 ?        00:00:00 ora_ckpt_orcl
oracle   21485     1  0 13:47 ?        00:00:00 ora_smon_orcl
oracle   21487     1  0 13:47 ?        00:00:00 ora_reco_orcl
oracle   21489     1  0 13:47 ?        00:00:00 ora_mmon_orcl
oracle   21491     1  0 13:47 ?        00:00:00 ora_mmnl_orcl
oracle   21495     1  0 13:47 ?        00:00:00 ora_rvwr_orcl
oracle   21516 21038  0 13:48 pts/2    00:00:00 /bin/bash -c ps -ef |grep ora_
oracle   21518 21516  0 13:48 pts/2    00:00:00 grep ora_

SQL>  select open_mode from v$database;

OPEN_MODE
----------
MOUNTED

SQL> select status from v$instance;

STATUS
------------
MOUNTED

SQL> alter database open;
alter database open
*
ERROR at line 1:
ORA-16196: database has been previously opened and closed

 

總之, 雖然可以用alter database close將open狀態改到mount,但無法再改回來.
所以,這引命令其餘是沒有作用的. 正常的關停還是走shutdown ,startup 就可以了.
並且 <>中關於 alter database的部分也沒有描述 close.

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/94384/viewspace-600666/,如需轉載,請註明出處,否則將追究法律責任。

相關文章