關於數據庫啟動和關閉的例子


關於數據庫的啟動 :

Oracle 的啟動分為三個步驟;分別是啟動實例,加載數據庫 、打開數據庫。(用戶可以根據自己的實際需要來開啟數據庫)

語法是startup

1:nomount 模式

SQL>
SQL> startup nomount
ORACLE instance started.

Total System Global Area  830930944 bytes
Fixed Size                  2257800 bytes
Variable Size             536874104 bytes
Database Buffers          285212672 bytes
Redo Buffers                6586368 bytes

    

 

這種啟動方式只會創建實例(即創建Oracle實例的各種內存結構和服務進程),並不加載數據庫也不會打開數據文件。

   這種模式一般適用於在創建數據庫和控制文件。

2:mount;模式

SQL>
SQL> startup mount
ORACLE instance started.

Total System Global Area  830930944 bytes
Fixed Size                  2257800 bytes
Variable Size             536874104 bytes
Database Buffers          285212672 bytes
Redo Buffers                6586368 bytes
Database mounted.

這種模式將啟動實例,加載數據庫並保存數據庫的關閉模式

一般用於數據庫維護時,比如:執行數據庫完全恢復操作,更改數據庫的歸檔模式等

3:open模式

SQL> startup
ORACLE instance started.

Total System Global Area  830930944 bytes
Fixed Size                  2257800 bytes
Variable Size             536874104 bytes
Database Buffers          285212672 bytes
Redo Buffers                6586368 bytes
Database mounted.
Database opened.

這種模式就是將啟動實例,加載並打開數據庫。 這是常規的打開數據庫的方式,只要用戶想要對數據庫進行多種操作,必須采取這種方式打開,(用open模式打開數據庫)startup后面不需要加參數的。

4:force模式

SQL> startup force
ORACLE instance started.

Total System Global Area  830930944 bytes
Fixed Size                  2257800 bytes
Variable Size             536874104 bytes
Database Buffers          285212672 bytes
Redo Buffers                6586368 bytes
Database mounted.
Database opened.
SQL>

這種模式將終止實例並重新啟動數據庫(open),這種模式具有一定的強制性(比如在其他啟動模式失效的時候可以嘗試這種模式)

 

二 關於數據庫的關閉

與啟動數據庫一樣,關閉也分為三步,其關閉數據庫,卸載數據庫,關閉Oracle實例

語法是shutdown

1;normal

SQL> shutdown normal
Database closed.
Database dismounted.
ORACLE instance shut down.

這種屬於正常關閉模式(*前提沒有時間限制、通常會選擇這種方式來關閉數據庫)

2:immediate

SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.

這種方式成為立即關閉數據庫,(*盡可能在最近的時間里關閉數據庫)-

-在這種關閉方式下,Oracle不但會立即中斷當前用戶的連接,而且會強行終止用戶的當前活動事物,將未完成的事物回退,以立即關閉方式關閉數據庫。

3:transactional

SQL> shutdown transactional
Database closed.
Database dismounted.
ORACLE instance shut down.

這種方式稱作為事物關閉方式,(它的首要任務是要能保證當前所有的活動事物都可以被提交並在最短的時間內關閉數據庫)

4:abort

SQL> shutdown abort
ORACLE instance shut down.

******--慎重

這種方式被稱為終極關閉方式,終極關閉方式具有一定的強制性和破壞性,使用這種方式會強制中斷任何數據庫操作,這樣可能會丟失一部分數據信息,影響到數據庫的完整性。

(******如果其他三種方法無法關閉時在使用它****  慎重)應當避免


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM