依運行環境不同,啟動關閉所需的 OS 用戶與指令有所差異。本文整理單機 (Linux/Unix) 與雙機 (HA) 環境的標準操作步驟,並補充 9i 版本的 SQL*Plus 啟動範例。
# 切換至 oracle 用戶
su - oracle
# --- 啟動資料庫 ---
svrmgrl
SVRMGR> CONNECT INTERNAL
SVRMGR> STARTUP
SVRMGR> QUIT
# --- 關閉資料庫 ---
svrmgrl
SVRMGR> CONNECT INTERNAL
SVRMGR> SHUTDOWN
SVRMGR> QUIT
注意:Oracle 9i 之後建議改用 sqlplus / as sysdba 替代 svrmgrl。
$ sqlplus /nolog
SQL> CONNECT / AS SYSDBA
Connected to an idle instance.
SQL> STARTUP
Oracle instance started.
Database mounted.
Database opened.
# 切換至 root
su - root
# 啟動 Oracle 資源組
hareg -y oracle
# 關閉 Oracle 資源組
hareg -n oracle
雙機環境下,資料庫啟停由叢集軟體 (如 Veritas Cluster Server, Oracle Clusterware) 托管,僅需控制資源組線上/離線即可。
pfile/spfile 參數SHUTDOWN ABORT 再 STARTUP FORCE