記一次修改sga大小以後出現的一系列報錯

記錄一次修改sga大小以後出現的一系列報錯

修改了oracle的sga大小以後,遇到了一系列的報錯。數據庫

00844和00851報錯oracle

SQL> startup;
ORA-00844: Parameter not taking MEMORY_TARGET into account
ORA-00851: SGA_MAX_SIZE 2147483648 cannot be set to more than MEM
SQL>

01078報錯app

SQL> startup;
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'

1、修改過程

1.1 爲何我要修改sga大小

在測試的時候,插入大量數據發現30009錯誤,我覺得是sga小致使的ide

SQL> insert into t select rownum from dual connect by level<=10000000;
insert into t select rownum from dual connect by level<=10000000
            *
ERROR at line 1:
ORA-30009: Not enough memory for CONNECT BY operation

Elapsed: 00:00:13.51
SQL>

查看sga測試

SQL> show parameter sga;

NAME                     TYPE                  VALUE
------------------------------------ --------------------------------- ------------------------------
lock_sga                 boolean                   FALSE
pre_page_sga                 boolean                   FALSE
sga_max_size                 big integer               1584M
sga_target               big integer               1G
SQL>

查看pgacode

SQL> show parameter pga

NAME                     TYPE                  VALUE
------------------------------------ --------------------------------- ------------------------------
pga_aggregate_target             big integer               0
SQL>

1.2 修改sga

更改sga內存

SQL> alter system set sga_max_size=2048M scope=spfile;

System altered.

Elapsed: 00:00:00.06
SQL>

1.3 報錯1

關閉和啓動數據庫get

SQL> shutdown
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL>
SQL> startup
ORA-00844: Parameter not taking MEMORY_TARGET into account
ORA-00851: SGA_MAX_SIZE 2147483648 cannot be set to more than MEMORY_TARGET 1660944384.

結果出錯了。通過查找資料,發現11g新增了個參數MEMORY_TARGET,其大小等於PGA+SGA,當sga的大小大於MEMORY_TARGET就會報如上錯誤。it

查看MEMORY_TARGET大小,發現大小爲1584M,與sga不符。io

SQL> show parameter memory_target;

NAME                     TYPE                  VALUE
------------------------------------ --------------------------------- ------------------------------
memory_target                big integer               1584M
SQL>

修改spfile文件中的參數

sga_max_size=1653604352

啓動數據庫

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>

1.4 報錯2

啓動後遇到了01078報錯。解決辦法以下:
test(實例名)文件夾下的init.ora.xxx 文件複製到dbs目錄下便可,複製後的名字按照以前報錯的提示輸入。

[oracle@localhost ~]$ cp /u01/app/oracle/admin/test/pfile/init.ora.922018114616 /u01/app/oracle/product/11.2.4/db_1/dbs/inittest.ora

啓動數據庫

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.
Database opened.
SQL>

2、總結

歸根結底仍是對數據庫原理不熟致使的,牢記memory_target值需爲sga+pga內存的和。

相關文章
相關標籤/搜索