注:本文來源於:星火spark 《Oracle的實例占用內存調整》
ORACLE_修改實例的內存大小
一:修改oracle數據庫實例內存大小腳本
1 ---- 1、操作 (oracle使用內存約等於 SGA+PGA,所以可以減少SGA與PGA解決你的問題,生產庫慎用) 2 alter system set sga_max_size=100m scope=spfile; --減少SGA大小,靜態參數,重啟后生效 3 alter system set sga_target=80m scope=both; --動態參數;oracle推薦:啟動時修改此參數,不要動態設置此參數 4 alter system set pga_aggregate_target=40m sope=both; ---減少pga大小
二:知識點拓展:
SGA_MAX_SIZE的大小不是隨意指定的,必須滿足一定條件的。
sga_max_size=100M,必須滿足SGA所有組件的最小和;至少滿足db_cache_size,log_buffer,shared_pool_size,large_pool_size,java_pool_size總和的大小)
1 oracle內存結構介紹: 2 Introduction to Oracle Memory Structures 3 Oracle uses memory to store information such as the following: 4 5 Program code 6 Information about a connected session, even if it is not currently active 7 Information needed during program execution (for example, the current state of a query from which rows are being fetched) 8 Information that is shared and communicated among Oracle processes (for example, locking information) 9 Cached data that is also permanently stored on peripheral memory (for example, data blocks and redo log entries) 10 The basic memory structures associated with Oracle include: 11 System Global Area (SGA), which is shared by all server and background processes. 12 Program Global Areas (PGA), which is private to each server and background process; there is one PGA for each process. 13 14 1.sqlplus “/ as sysdba" 2. 3.create pfile='d:/cj.ora' from spfile; 然后去你的oracle安裝目錄 15 找一個init數據庫名。ora這樣一個文件 16 17 把幾個oracle內存參數改小點 18 19 一個2G的內存是如下配置的: 20 21 *.sga_max_size=712M 22 23 *.large_pool_size=8M 24 25 *.shared_pool_size=250M 26 27 *.sort_area_size=0.5M 28 29 *.db_cache_size=350M 30 31 然后shutdown數據庫 32 33 1.shutdown immediate; 2. 3.create spfile from pfile='d:/cj2.ora'; 4. 5.startup; 然后啟動,就可以了。 34 35 以上就是調整oracle內存參數,減少數據庫內存占用的方法介紹。