Oracle 資料庫啟動的不同狀態

來源:互聯網
上載者:User

Oracle資料庫啟動分為三個步驟:

nomount,找到初始設定檔案pfile或者spfile,建立SGA並啟動後台進程但不允許訪問資料庫。

mount,根據初始設定檔案找到控制檔案(Control File),為某些DBA活動裝載資料庫但不允許使用者訪問資料庫。

open,根據控制檔案找到資料檔案(Data File),重做記錄檔(Redo File),使使用者可以訪問資料庫。

 

關閉資料庫的4個不同命令

shutdown normal(等於shutdown)

正常是關閉的預設方式正常的資料庫關閉在下列情況下進行

• 不允許新的串連

• 等待會話結束

• 等待事務結束

• 做一個檢查點並關閉資料檔案

• 下一次啟動時將不要求執行個體恢複

shutdown transactional

交易處理關閉防止客戶丟失工作交易處理資料庫關閉在下列情況下進行

• 不允許新的串連

• 不等待會話結束

• 等待事務結束

• 做一個檢查點並關閉資料檔案

• 下一次啟動將不要求執行個體恢複

shutdown immediate

立即關閉資料庫在下列情況下進行

• 不允許新的串連

• 不等待會話結束

• 不等待事務結束

• 未結束的事務自動復原(rollback)

• 做一個檢查點並關閉資料檔案

• 下一次啟動將不要求常式恢複

shutdown abort

如果正常和立即關閉選項不起作用可以中止當前資料庫常式中止常式可以在下列情況下進行

• 不允許新的串連

• 不等待會話結束

• 不等待事務結束

• 不做檢查點且沒有關閉資料檔案

• 下一次啟動將要求執行個體恢複

 

 

啟動資料庫相關命令

startup(預設啟動到open狀態)

startup nomount

startup mount

alter database mount;

alter database open;

 

初始設定檔案

pfile,文字檔,可以手工編輯該檔案

spfile,二進位檔案,不能手工修改裡面的參數,只能使用資料庫命令進行修改,資料庫啟動預設使用spfile

 

查看初始設定檔案路徑

show parameter spfile;

 

根據spfile建立pfile檔案

create pfile from spfile;

create pfile='/u01/app/pfile.ora' fromspfile;

create spfile from pfile='/u01/app/pfile.ora';

 

查看控制檔案的路徑

select name from v$controlfile;

 

查看控制檔案的內容,可以根據ctl.trc重建控制檔案

alter database backup controlfile to trace as '/u01/app/ctl.trc';

 

查看資料檔案的位置

select name from v$datafile;

 

查看重做記錄檔的位置

select member from v$logfile;

 

資料庫的密碼檔案

Windows,$ORACLE_HOME/database/PWDorcl.ora

Linux/Unix,$ORACLE_HOME/dbs/orapworcl

密碼檔案的作用是允許資料庫的sysdba、sysoper使用者通過口令來遠登陸

 

查看資料庫是否允許使用者遠程登陸資料庫

show parameter remote_login_passwordfile;

如果remote_login_passwordfile為EXCLUSIVE則表示允許遠端連線資料庫

如果remote_login_passwordfile為NONE則表示不允許遠端連線資料庫

 

禁止使用者遠程登陸資料庫(需要重啟資料庫生效)

alter system set remote_login_passwordfile=none scope=spfile;

 

資料表空間

select * from dba_tablespaces;

 

資料檔案

select * from dba_data_files;

 

重做記錄檔

select * from v$logfile;

 

重做記錄檔的狀態

STALE表示資料已經提交到資料庫中,空白狀態表示正在使用該檔案

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.