Oracle 10g 修改SGA_TARGET值心得 ORA-01078

來源:互聯網
上載者:User

備份

為了保證記憶體的設定不影響資料庫啟動失敗設定
所以需要備份spfile檔案/pfile檔案
[Oracle@urp65 dbs]$cd /u01/app/oracle/oracle/oraInventory/db_1/dbs
[oracle@urp65 dbs]$ cp spfilejwdb.ora spfilejwdb.ora.bak

cd /u01/app/oracle/oracle/oraInventory/db_1/admin/jwdb/pfile/
cp init.ora.2132009144930 init.ora.2132009144930.bak

實現2種方式
1)init.ora時間點檔案修改sga-target或增加sga_max_size 修改最大記憶體、實際使用記憶體值===》create spfile=spfileSID_NAME.ora
2)http://192.168.0.65:1158/em/
調整記憶體值
以下是整個過程


直接修改測試
--------在EM中直接的修還最大的SGA值
ALTER SYSTEM SET sga_max_size = 524288000 COMMENT='internally adjusted' SCOPE=SPFILE

重新啟動資料庫
SQL> conn sys/jwdb as sysdba
ò?á??ó?£
SQL> shutdown immediate;

Total System Global Area 524288000 bytes
Fixed Size                  1220384 bytes
Variable Size             222298336 bytes
Database Buffers          297795584 bytes
Redo Buffers                2973696 bytes
êy?Y?a×°??íê±??£

SQL> show parameter sga_max_size;

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
sga_max_size                         big integer 500M

證明上述方法有效、但是需要啟動資料庫生效

查看對應的檔案
1)vi /u01/app/oracle/oracle/oraInventory/db_1/dbs/spfilejwdb.ora
$ORACLE_HOME/dbs/spfileSID_NAME.ora
發現
*.sga_max_size=524288000#internally adjusted #此時修改了、在spfilejwdb.ora中增加了一個欄位
*.sga_target=424288000
2)
/u01/app/oracle/oracle/oraInventory/db_1/admin/jwdb/pfile/init.ora.2132009144930
$ORACLE_HOME/admin/SID_NAME/pfile/init.ora.時間點
# SGA Memory
###########################################
sga_target=424288000


--------在EM中直接的修的SGA_TARGET實際值

在em中直接的修改記憶體值
Old
sga_target=408M
sga_max_size=500M

ALTER SYSTEM SET sga_target = 471859200 SCOPE=BOTH
同時的修改spfile/當前服務進程的值、需要重新啟動生效
更新訊息

修改之後報告
1)有變化
vi /u01/app/oracle/oracle/oraInventory/db_1/dbs/spfilejwdb.ora
*.sga_max_size=524288000#internally adjusted
*.sga_target=473956352
2)沒有變化
/u01/app/oracle/oracle/oraInventory/db_1/admin/jwdb/pfile/init.ora.2132009144930
# SGA Memory
###########################################
sga_target=424288000
已成功變更。可能需要一段時間更改才會生效。
3)重新啟動資料庫
SQL> startup
ORACLE ày3ìò??-???ˉ?£

Total System Global Area 524288000 bytes ==500M=sga_max_size
Fixed Size                  1220384 bytes
Variable Size             222298336 bytes
Database Buffers          297795584 bytes
Redo Buffers                2973696 bytes
查看
SQL> show parameter sga_target

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
sga_target                           big integer 452M

SQL> show parameter sga_max_size        

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
sga_max_size                         big integer 500M
1)查看記憶體、沒有變化
vi /u01/app/oracle/oracle/oraInventory/db_1/admin/jwdb/pfile/init.ora.2132009144930
# SGA Memory
###########################################
sga_target=424288000
2)vi /u01/app/oracle/oracle/oraInventory/db_1/dbs/spfilejwdb.ora 沒有變化

*.sga_max_size=524288000#internally adjusted
*.sga_target=473956352

結論
修改當前記憶體時候不需要重新啟動資料庫、但是修改最大記憶體需要重新的啟動資料庫

$ORACLE_HOME/admin/SID_NAME/pfile/init.ora.時間點
$ORACLE_HOME/dbs/spfileSID_NAME.ora
2者之間不存在必然的聯絡、除非使用create spfile from create spfile from pfile='/opt/oracle/admin/jwdb/pfile/init.ora.2132009144930'
從而產生新的spfile檔案格式

為了保證記憶體的設定不影響資料庫啟動失敗設定
所以需要備份spfile檔案/pfile檔案
[oracle@urp65 dbs]$cd /u01/app/oracle/oracle/oraInventory/db_1/dbs
[oracle@urp65 dbs]$ cp spfilejwdb.ora spfilejwdb.ora.bak

cd /u01/app/oracle/oracle/oraInventory/db_1/admin/jwdb/pfile/
cp init.ora.2132009144930 init.ora.2132009144930.bak

------------單獨建立spfile檔案

 

SQL> create spfile from pfile='/u01/app/oracle/oracle/oraInventory/db_1/admin/jwdb/pfile/init.ora.2132009144930'
2 /
create spfile from pfile='/u01/app/oracle/oracle/oraInventory/db_1/admin/jwdb/pfile/init.ora.2132009144930'
*
μú 1 DD3???′í?ó:
ORA-32002: ?T·¨′′?¨ò?óéêμàyê1ó?μ? SPFILE


需要關閉資料庫在nmount下建立pfile否則如果在使用的話、失敗
SQL> shutdown immediate;
êy?Y?aò??-1?±??£
ò??-D???êy?Y?a?£
ORACLE ày3ìò??-1?±??£
SQL> create spfile from pfile='/u01/app/oracle/oracle/oraInventory/db_1/admin/jwdb/pfile/init.ora.2132009144930'
2 /


SQL> startup
ORACLE ày3ìò??-???ˉ?£

Total System Global Area 436207616 bytes
Fixed Size                  1219856 bytes
Variable Size             125829872 bytes
Database Buffers          306184192 bytes
Redo Buffers                2973696 bytes


啟動發現記憶體值變化了spfilejwdb.ora與init.ora2132009144930保持一致的
*.sga_target=434288000;
但是此時沒有sga_max_size在sfilejwdb.ora中出現、應為在init.ora2132009144930沒有指定


[oracle@urp65 pfile]$ pwd
/u01/app/oracle/oracle/oraInventory/db_1/admin/jwdb/pfile
[oracle@urp65 pfile]$ vi init.ora.2132009144930


sga_max_size=524288000#internally adjusted

---關閉
SQL> shutdown immediate;
êy?Y?aò??-1?±??£
ò??-D???êy?Y?a?£
ORACLE ày3ìò??-1?±??£

SQL> create spfile from pfile='/u01/app/oracle/oracle/oraInventory/db_1/admin/jwdb/pfile/init.ora.2132009144930'
2 /

SQL> startup
ORACLE ày3ìò??-???ˉ?£

Total System Global Area 524288000 bytes
Fixed Size                  1220384 bytes
Variable Size             213909728 bytes
Database Buffers          306184192 bytes
Redo Buffers                2973696 bytes
êy?Y?a×°??íê±??£
êy?Y?aò??-′ò?a?£

啟動發現值發生了變化、最大記憶體變化為524288000 bytes 與sga_max_size=524288000#internally adjusted
增加保持一致了

因此直接修改 init.ora.2132009144930---->增加sga_max_size=524288000#internally adjusted、*.sga_target=434288000;===》 create spfile 產生
達到同時修改的功效、最有效


-----直接修改spfilejwdb.ora值
*.sga_max_size=504288000#internally adjusted
*.sga_target=404288000
SQL> shutdown immediate
êy?Y?aò??-1?±??£
ò??-D???êy?Y?a?£
ORACLE ày3ìò??-1?±??£
SQL> startup
ORA-01078: failure in processing system parameters
LRM-00109: ???????????????? '/u01/app/oracle/oracle/oraInventory/db_1/dbs/initjwdb.ora'

報告錯誤說明、無法直接的修改spfilejwdb.ora檔案而是需要通過修改init.ora.2132009144930 實現

解決辦法:

SQL> create spfile from pfile='/u01/app/oracle/oracle/oraInventory/db_1/admin/jwdb/pfile/init.ora.2132009144930'
2 /


SQL> startup
ORACLE


Total System Global Area 524288000 bytes
Fixed Size                  1220384 bytes
Variable Size             213909728 bytes
Database Buffers          306184192 bytes
Redo Buffers                2973696 bytes

設定成功!!!!

相關文章

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.