修改oracle初始化參數

來源:互聯網
上載者:User

標籤:修改oracle初始化參數


1、初始化參數檔案

啟動執行個體,會讀取初始化參數

(1)spfile (伺服器參數檔案)二進位檔案 不能手動修改 spfile<SID>.ora


SQL> show parameter spfile;


NAME     TYPE VALUE

------------------------------------ ----------- ------------------------------

spfile     string +DATA/orcl/spfileorcl.ora



(2)pfile 文本初始化參數檔案 手動修改  init<SID>.ora


SQL> show parameter pfile;


NAME     TYPE VALUE

------------------------------------ ----------- ------------------------------

spfile     string +DATA/orcl/spfileorcl.ora


初始化參數類型:

派生參數:不建議修改

與作業系統相關的參數:例如 DB_FILE_MULTIBLOCK_READ_COUNT

普通參數:最可能改進系統效能


簡化的初始化參數:(30個)

processes 最大使用者進程數

undo_tablespace

db_block_size 資料庫快大小



進階初始化參數:(300個)

db_cache_size 標準塊緩衝區快取大小

read_count

shared_pool_size


#######

db_files 最大資料庫檔案數

control_files 一個或多個控制檔案名稱



動態效能檢視:v$parameter


show parameter sga


select name,value from v$parameter where name like ‘%sga_max_size%‘;

show sga;

SQL> set lines 50;

SQL> col name for a50;

SQL> select name,value from v$parameter where name like ‘%sga_max_size%‘;


NAME

--------------------------------------------------

VALUE

--------------------------------------------------

sga_max_size

7180648448




SQL> show parameter sga_max_size


NAME     TYPE VALUE

------------------------------------ ----------- ------------------------------

sga_max_size     big integer 6848M


綁定變數查詢:


select name,type,value from v$parameter where name like ‘%&parameter_name%‘;

SQL> /

Enter value for parameter_name: undo

old   1: select name,type,value from v$parameter where name like ‘%&parameter_name%‘

new   1: select name,type,value from v$parameter where name like ‘%undo%‘


NAME     TYPE VALUE

------------------------------ ---------- ------------------------------

undo_management       ########## AUTO

undo_tablespace       ########## UNDOTBS1

undo_retention       ########## 900

(3)

靜態參數:

只能在參數檔案中更改

必須重新啟動資料庫執行個體才會生效


動態參數:

會話層級 alter session

系統層級 alter system 


session 會話持續期間有效


scope 有如下設定

memory  記憶體生效

spfile  設定檔有效(需要重啟)

both     二者


SQL> desc v$parameter;

 Name       Null?Type

 ----------------------------------------------------- -------- ----------------------

-------------- NUMNUMBER

 NAMEVARCHAR2(80)

 TYPENUMBER

 VALUEVARCHAR2(4000)

 DISPLAY_VALUEVARCHAR2(4000)

 ISDEFAULTVARCHAR2(9)

 ISSES_MODIFIABLEVARCHAR2(5)

 ISSYS_MODIFIABLEVARCHAR2(9)

 ISINSTANCE_MODIFIABLEVARCHAR2(5)

 ISMODIFIEDVARCHAR2(10)

 ISADJUSTEDVARCHAR2(5)

 ISDEPRECATEDVARCHAR2(5)

 ISBASICVARCHAR2(5)

 DESCRIPTIONVARCHAR2(255)

 UPDATE_COMMENT VARCHAR2(255)

 HASHNUMBER


注意:

ISSES_MODIFIABLE 會話層級更改生效(true/false)

ISSYS_MODIFIABLE 系統層級更改生效(true/false)

ISINSTANCE_MODIFIABLE             (true/false)


例子1:

select sysdate from dual;


SQL> select ISSES_MODIFIABLE,ISSYS_MODIFIABLE,ISINSTANCE_MODIFIABLE from v$parameter w

here name=‘nls_date_format‘;

ISSES ISSYS_MOD ISINS

----- --------- -----

TRUE  FALSEFALSE


alter  system set nls_date_format=‘yyyy-mm-dd hh24:mi:ss‘;   //這條命令執行失敗

alter  system set nls_date_format=‘yyyy-mm-dd hh24:mi:ss‘ scope=memory;  //執行失敗

alter  system set nls_date_format=‘yyyy-mm-dd hh24:mi:ss‘ scope=both;  //失敗

alter  system set nls_date_format=‘yyyy-mm-dd hh24:mi:ss‘ scope=spfile; //執行成功 為啥? 自己思考一下



查看哪些支援會話層級或者系統層級或者執行個體層級的修改

set lines 100

col name for a30

col ISSES_MODIFIABLE for a15

col ISSYS_MODIFIABLE for a15

col ISINSTANCE_MODIFIABLE for a15

select name, ISSES_MODIFIABLE,ISSYS_MODIFIABLE,ISINSTANCE_MODIFIABLE from v$parameter  order by 1;


例子2:

SQL> show parameter undo_retention;


NAME     TYPE    VALUE

------------------------------------ ------------------------------ ------------------------------

undo_retention     integer    900

SQL> alter system set undo_retention=600 scope=memory;


System altered.


SQL> alter system set undo_retention=900 scope=spfile;    


System altered.


SQL> show parameter undo_retention;


NAME     TYPE    VALUE

------------------------------------ ------------------------------ ------------------------------

undo_retention     integer    600



################################


本文出自 “梁小明的部落格” 部落格,請務必保留此出處http://7038006.blog.51cto.com/7028006/1925184

修改oracle初始化參數

聯繫我們

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