oracle啓動會通過三個過程,分別是nomount
、mount
、open
數據庫
nomount 階段,能夠看到實例已經啓動。oracle進程會根據參數文件開創共享內存池。oracle
SQL> startup nomount; ORACLE instance started. Total System Global Area 1653518336 bytes Fixed Size 2213896 bytes Variable Size 956303352 bytes Database Buffers 687865856 bytes Redo Buffers 7135232 bytes SQL>
能夠看到共享內存已經開闢app
[root@localhost dbs]# ipcs -m ------ Shared Memory Segments -------- key shmid owner perms bytes nattch status 0x00000000 98304 oracle 600 393216 2 dest 0x00000000 131073 oracle 600 393216 2 dest 0x00000000 163842 oracle 600 393216 2 dest 0x00000000 196611 oracle 600 393216 2 dest 0x00000000 229380 oracle 600 393216 2 dest 0x00000000 262149 oracle 600 393216 2 dest 0x00000000 294918 oracle 600 393216 2 dest 0x00000000 327687 oracle 600 393216 2 dest 0x00000000 360456 oracle 600 393216 2 dest 0x33554094 1048585 oracle 660 4096 0 0x00000000 425994 oracle 600 393216 2 dest 0x00000000 458763 oracle 600 393216 2 dest 0x00000000 491532 oracle 600 393216 2 dest 0x00000000 524301 oracle 600 393216 2 dest 0x00000000 557070 oracle 600 393216 2 dest 0x00000000 688143 oracle 600 393216 2 dest 0x00000000 720912 oracle 600 393216 2 dest
進程已經開啓ide
oracle 2965 1 0 04:44 ? 00:00:00 ora_pmon_test oracle 2967 1 0 04:44 ? 00:00:00 ora_vktm_test oracle 2971 1 0 04:44 ? 00:00:00 ora_gen0_test oracle 2973 1 0 04:44 ? 00:00:00 ora_diag_test oracle 2975 1 0 04:44 ? 00:00:00 ora_dbrm_test oracle 2977 1 0 04:44 ? 00:00:00 ora_psp0_test oracle 2979 1 0 04:44 ? 00:00:00 ora_dia0_test oracle 2981 1 0 04:44 ? 00:00:01 ora_mman_test oracle 2983 1 0 04:44 ? 00:00:00 ora_dbw0_test oracle 2985 1 0 04:44 ? 00:00:00 ora_lgwr_test oracle 2987 1 0 04:44 ? 00:00:00 ora_ckpt_test oracle 2989 1 0 04:44 ? 00:00:00 ora_smon_test oracle 2991 1 0 04:44 ? 00:00:00 ora_reco_test oracle 2993 1 0 04:44 ? 00:00:00 ora_mmon_test oracle 2995 1 0 04:44 ? 00:00:00 ora_mmnl_test oracle 2997 1 0 04:44 ? 00:00:00 ora_d000_test oracle 2999 1 0 04:44 ? 00:00:00 ora_s000_test
查看參數配置文件位置日誌
SQL> show parameter spfile NAME TYPE VALUE ------------------------------------ --------------------------------- ------------------------------ spfile string /u01/app/oracle/product/11.2.4 /db_1/dbs/spfiletest.ora SQL>
移除配置文件後startup nomount
,報錯以下:code
SQL> startup nomount; ORA-01078: failure in processing system parameters LRM-00109: could not open parameter file '/u01/app/oracle/product/11.2.4/db_1/dbs/inittest.ora' SQL>
mount
階段,oracle
會根據nomount
階段的參數文件來尋找控制文件的名稱和位置,一旦查找到當即鎖定該控制文件,控制文件裏記錄了數據庫中的數據文件、日誌文件、檢查點信息等很是重要的信息。啓動mount
時,會先自動啓動nomount
進程
startup mountip
mount
階段能夠看到,比nomount
階段多了一個database mounted
的提示。內存
SQL> startup mount; ORACLE instance started. Total System Global Area 1653518336 bytes Fixed Size 2213896 bytes Variable Size 956303352 bytes Database Buffers 687865856 bytes Redo Buffers 7135232 bytes Database mounted. SQL>
查看控制文件位置string
SQL> show parameter control NAME TYPE VALUE ------------------------------------ --------------------------------- ------------------------------ control_file_record_keep_time integer 7 control_files string /u01/app/oracle/oradata/test/c ontrol01.ctl, /u01/app/oracle/ flash_recovery_area/test/contr ol02.ctl control_management_pack_access string DIAGNOSTIC+TUNING SQL>
將配置文件移除,而後在啓動一次。
SQL> startup mount; ORACLE instance started. Total System Global Area 1653518336 bytes Fixed Size 2213896 bytes Variable Size 956303352 bytes Database Buffers 687865856 bytes Redo Buffers 7135232 bytes ORA-00205: error in identifying control file, check alert log for more info SQL>
open
階段會根據控制文件記錄的信息,定位到數據庫文件、日誌文件等,正式開啓實例和數據庫之間的橋樑。若是數據文件或者日誌文件缺乏,那麼open
失敗。open
以後,若是有使用歸檔日誌功能,即可看到歸檔日誌的進程。
SQL> alter database open; Database altered. SQL>
查看日誌文件和日誌文件的位置
SQL> select file_name from dba_data_files; FILE_NAME ------------------------------------------------ /u01/app/oracle/oradata/test/users01.dbf /u01/app/oracle/oradata/test/undotbs01.dbf /u01/app/oracle/oradata/test/sysaux01.dbf /u01/app/oracle/oradata/test/system01.dbf SQL> SQL> select group#,member from v$logfile; GROUP# MEMBER ------------------------------------- 3 /u01/app/oracle/oradata/test/redo03.log 2 /u01/app/oracle/oradata/test/redo02.log 1 /u01/app/oracle/oradata/test/redo01.log
移動一個數據文件後啓動,報錯以下
SQL> startup; ORACLE instance started. Total System Global Area 1653518336 bytes Fixed Size 2213896 bytes Variable Size 956303352 bytes Database Buffers 687865856 bytes Redo Buffers 7135232 bytes Database mounted. ORA-01157: cannot identify/lock data file 4 - see DBWR trace file ORA-01110: data file 4: '/u01/app/oracle/oradata/test/users01.dbf' SQL>
若是我隨便複製一個文件進去可不能夠呢?啓動以下:
SQL> alter database open; alter database open * ERROR at line 1: ORA-01122: database file 4 failed verification check ORA-01110: data file 4: '/u01/app/oracle/oradata/test/users01.dbf' ORA-01210: data file header is media corrupt
咱們可使用statup
來啓動oracle數據庫,也能夠用shutdwon
來關閉。若是使用startup
啓動,其實已經通過了三個過程。
總的來講,沒有參數文件,實例沒法建立,數據庫沒法nomount
成功,沒有配置文件,數據庫沒法mount
;沒有數據文件,數據庫沒法打開使用。