Oracle如何調整SGA的大小__Oracle

來源:互聯網
上載者:User
 

Oracle 10G開始支援使用SGA_TARGET參數進行SGA自動管理,Oracle可自動調節共用池和資料緩衝池的大小,以下是OS:RH AS4 U7 64bit環境 Oracle 10.2.0.1版本的一個測試,先查看現在已有的SGA設定:

SQL> show parameter sga;
NAME                                 TYPE        VALUE
----------- ------------------------------
lock_sga                             boolean     FALSE
pre_page_sga                         boolean     FALSE
sga_max_size                         big integer 2G
sga_target                           big integer 2G

更改SGA大小:

SQL> alter system set sga_max_size=4096M scope=spfile;
System altered.
SQL> alter system set sga_target=4096M scope=spfile;
System altered.

如果是RAC環境,需要這樣增加sid='*':

alter system set sga_target=20G scope=spfile sid='*';

重啟使更改生效:

SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup
ORACLE instance started.
Total System Global Area 4294967296 bytes
Fixed Size                  2026296 bytes
Variable Size             805307592 bytes
Database Buffers         3472883712 bytes
Redo Buffers               14749696 bytes
Database mounted.
Database opened.
SQL> show parameter sga;
NAME                                 TYPE        VALUE 
----------- ------------------------------
lock_sga                             boolean     FALSE
pre_page_sga                         boolean     FALSE
sga_max_size                         big integer 4G
sga_target                           big integer 4G

如果更改spfile導致資料庫無法啟動,可以在pfile後填加附加參數,現在一般的pfile都是一行SPFILE='spfileSID.ora',在後邊加參數會覆蓋spfile的已有參數:

SQL> alter system set lock_sga=true scope=spfile;
System altered.
SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup
ORA-27102: out of memory
Linux-x86_64 Error: 12: Cannot allocate memory
[oracle@erpdevdb dbs]$ vi initerpstudydb.ora
SPFILE='+DGSTUDY/erpstudydb/spfileerpstudydb.ora'
lock_sga=false

SQL> startup
ORACLE instance started.

啟動後,可以重新設定scope=spfile的參數,再刪除pfile裡後加的資訊即可

聯繫我們

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