Oracle啟動的方式和命令參數(shù)的匯總
以下的文章主要是對Oracle啟動的方式與其相關(guān)的命令參數(shù)的匯總,以及對一些常用常用參數(shù)的介紹,如果你對這些相關(guān)的實際操作感興趣的話,你就可以瀏覽以下的文章了,下面就是文章的具體內(nèi)容描述。
Oracle的啟動方式:
- startup nomount
- startup mount
- startup open (startup的默認(rèn)選項)
其他常用的參數(shù):read only ,read write ,force,restrict
這些參數(shù)可以一起使用,比如 startup 與 startup open read write 是一樣的效果。
Oracle的啟動過程:啟動實例 -> 裝載數(shù)據(jù)庫 -> 打開數(shù)據(jù)庫
與之對應(yīng)的讀取相應(yīng)文件的順序: 參數(shù)文件 -> 控制文件 -> 數(shù)據(jù)文件
我們驗證一下這些步驟的區(qū)別:
- startup nomount
使用nomount方式啟動數(shù)據(jù)庫時,表示只啟動數(shù)據(jù)庫實例,不裝載數(shù)據(jù)庫,不打開數(shù)據(jù)庫
這時只讀取參數(shù)文件,主要有兩部分工作:一是分配內(nèi)存SGA區(qū),二是啟動Oracle后臺進(jìn)程
如下我們修改Oracle參數(shù)文件的名稱,并以nomount 的方式Oracle啟動數(shù)據(jù)庫
這里需要將pfile,spfile 都進(jìn)行修改,數(shù)據(jù)庫默認(rèn)使用spfile啟動,在找不到spfile時用pfile啟動。
- [Oracle@localhost dbs]$ pwd
- /Oracle/orc10g/product/10.1.0/db_1/dbs
- [Oracle@localhost dbs]$ mv initorcl.ora initorcl1.ora
- [Oracle@localhost dbs]$ mv spfileorcl.ora spfileorcl1.ora
- SYS@orcl>shutdown abort
- Oracle instance shut down.
- SYS@orcl>startup nomount
- ORA-01078: failure in processing system parameters
- LRM-00109: could not open parameter file
'/Oracle/orc10g/product/10.1.0/db_1/dbs/initorcl.ora'- SYS@orcl>
保持參數(shù)文件正確,修改控制文件名稱
- [Oracle@localhost orcl]$ pwd
- /Oracle/orc10g/oradata/orcl
- [Oracle@localhost orcl]$ mv control01.ctl control01a.ctl
- [Oracle@localhost orcl]$ mv control02.ctl control02a.ctl
- [Oracle@localhost orcl]$ mv control03.ctl control03a.ctl
- .....
- SYS@orcl>startup nomount
- Oracle instance started.
- Total System Global Area 167772160 bytes
- Fixed Size 778212 bytes
- Variable Size 61874204 bytes
- Database Buffers 104857600 bytes
- Redo Buffers 262144 bytes
- SYS@orcl>
在nomount的方式下修改控制文件名稱,并沒有報錯。說明在nomount的方式下,并沒有讀取控制文件。
繼續(xù)以上的步驟,我們以mount的方式Oracle啟動:
- SYS@orcl>alter database mount;
- alter database mount
- *
- ERROR at line 1:
- ORA-00205: error in identifying controlfile, check alert log for more info
裝載數(shù)據(jù)庫時,需要讀取控制文件確定數(shù)據(jù)文件的位置。
繼續(xù)上面的例子,我們將控制文件修改正確,使數(shù)據(jù)庫可以正確的找到控制文件,
我們修改數(shù)據(jù)文件的名稱.
- [Oracle@localhost orcl]$ mv tp_test.dbf tp_test1.dbf
- .....
- SYS@orcl>startup mount
- Oracle instance started.
- Total System Global Area 167772160 bytes
- Fixed Size 778212 bytes
- Variable Size 61874204 bytes
- Database Buffers 104857600 bytes
- Redo Buffers 262144 bytes
- Database mounted.
雖然我修改了數(shù)據(jù)文件,但是在mount的方式下,并沒有報錯。說明在mount的方式下,Oracle啟動過程只讀取了參數(shù)文件和控制文件。
下面我們打開數(shù)據(jù)庫。
- SYS@orcl>alter database open
- 2 ;
- alter database open
- *
- ERROR at line 1:
- ORA-01157: cannot identify/lock data file 5 - see DBWR trace file
- ORA-01110: data file 5: '/Oracle/orc10g/oradata/orcl/tp_test.dbf'
提示我們找不到tp_test.dbf這個文件了。
至此我們大概的了解了數(shù)據(jù)庫的啟動過程以及啟動過程中每一步驟的所做的工作和讀取的文件。
總結(jié)如下:Oracle按照如下過程啟動數(shù)據(jù)庫
nomount
Oracle啟動實例 | mount
(參數(shù)文件) |---------------
| 裝載數(shù)據(jù)庫 | open
(控制文件) |-----------
| 打開數(shù)據(jù)庫
(數(shù)據(jù)文件)
1.nomount方式下還沒有讀取控制文件,該選項用于在數(shù)據(jù)庫的控制文件全部損壞,需要重新創(chuàng)建數(shù)據(jù)庫控制文件或創(chuàng)建一個新的數(shù)據(jù)庫時使用。
2.mount 選項下并沒有打開數(shù)據(jù)文件,該選項可以用來修改數(shù)據(jù)庫的運行模式或進(jìn)行數(shù)據(jù)庫恢復(fù)。
上述的相關(guān)內(nèi)容就是對Oracle啟動方式的描述,希望會給你帶來一些幫助在此方面。
【編輯推薦】