pfile,spfile 初始化參數檔案順序【weber出品】

來源:互聯網
上載者:User

標籤:style   blog   color   使用   ar   strong   檔案   資料   div   

一、初始化參數檔案

啟動執行個體時會讀取初始化參數檔案。參數檔案有兩種類型:

1、伺服器參數檔案:這是首選類型的初始化參數檔案。這是一個由資料庫伺服器寫入或讀取的二進位檔案,不得手動進行編輯。此檔案駐留在執行 Oracle 資料庫的伺服器中,而且永遠存在,不受資料庫關閉或啟動的影響。這個檔案通常稱為伺服器參數檔案 (SPFILE)。檔案預設名為 spfile<SID>.ora,啟動時會自動搜尋此檔案。

2、  文本初始化參數檔案:這類初始化參數檔案可由資料庫伺服器讀取,但不能由其寫入。必須使用文字編輯器手動設定和更改初始化參數設定,這些設定是永久的,不受資料庫關閉或啟動的影響。檔案預設名為 init<SID>.ora,如果啟動時未找到 SPFILE,則自動搜尋此檔案。

二、兩個參數檔案的切換

  預設資料庫是使用spfile。

  從spfile--->pfile:

SQL> create pfile=‘/u01/pfile.ora‘ from spfile;File created.

從pfile到spfile:

SQL> create spfile from pfile=‘/u01/pfile.ora‘;File created.

採用startup pfile的方式啟動

[[email protected] dbs]$ startup pfile=’u01/pfile.ora’;

ORACLE instance started.

 

Total System Global Area  285212672 bytes

Fixed Size                  1218992 bytes

Variable Size              79693392 bytes

Database Buffers          201326592 bytes

Redo Buffers                2973696 bytes

Database mounted.

Database opened.

三、初始化參數檔案順序

我們知道參數檔案中有個SGA的大小設定,我們以此為例 :

SQL> shutdown immediate;

把資料庫的spfile給移開

[[email protected]oracle dbs]$ mv spfile.ora spfile.ora.bak[[email protected]-oracle dbs]$ ls hc_orcl.dat  initdw.ora  init.ora  lkORCL  orapworcl  spfile.ora.bak

  啟動資料庫試試看:你會發下

SQL> startup nomount;ORA-01078: failure in processing system parametersLRM-00109: could not open parameter file ‘/u01/oracle/db_1/dbs/initorcl.ora‘SQL> startup nomount;ORACLE instance started.Total System Global Area  281018368 bytesFixed Size                  2020192 bytesVariable Size             100666528 bytesDatabase Buffers          176160768 bytesRedo Buffers                2170880 bytesSQL> show parameter sgaNAME                                 TYPE        VALUE------------------------------------ ----------- ------------------------------lock_sga                             boolean     FALSEpre_page_sga                         boolean     FALSEsga_max_size                         big integer 268Msga_target                           big integer 268M

lock_sga的值為FALSE,這個很明顯參數檔案沒有用到。

我們再查看一下其他參數:

SQL> show parameter controlfile;SQL> show parameter controlNAME                                 TYPE        VALUE------------------------------------ ----------- ------------------------------control_file_record_keep_time        integer     7control_files                        string      /u01/oracle/oradata/orcl/contr                                                 ol01.ctl, /u01/oracle/oradata/                                                 orcl/control02.ctl, /u01/oracl                                                 e/oradata/orcl/control03.ctl

可以查看參數值並能夠修改參數,如果動態修改必須是spfile啟動資料庫。

SQL> select status from v$instance;  STATUS------------STARTED

我們把spfile給移回來

然後把資料庫給:

alter database mount alter database open;

 

資料庫裝載過程包括執行以下任務:

    • 將資料庫與以前啟動的執行個體關聯
    • 定位並開啟參數檔案中指定的控制檔案
    • 通過讀取控制檔案來擷取資料檔案和聯機重做記錄檔的名稱和狀態。但是,此時不執行檢查就可驗證是否存在資料檔案和聯機重做記錄檔

 

pfile,spfile 初始化參數檔案順序【weber出品】

聯繫我們

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