In Oracle10g, Oracle introduced the sga_target initialization parameter to implement ASMM (AutomaticSharedMemoryManagement), that is, set an SGA object
In Oracle10g, Oracle introduced the sga_target initialization parameter to implement ASMM (Automatic Shared Memory Management), that is, set a SGA object
In Oracle10g, Oracle introduced the sga_target initialization parameter to implement ASMM (Automatic Shared Memory Management), that is, set the target value of an SGA and the maximum value of SGA, database to dynamically adjust various components, such as Database buffer cache and Shared pool. From the perspective of usage, the appearance of ASMM greatly simplifies the setting of Oracle memory initialization parameters. There is no big difference between advanced DBA and beginners in the use of ASMM. However, while being convenient, ASMM is a black box with many secrets hidden in it. These secrets Bring more uncertainty than manual management.
Next, let's take a look at how to modify the size of the sga_target initialization parameter.
1. Test Environment
We tested it in Oracle10g. The operating system is Windows Server 2008 R2 Standard.
2. Definition of official documents
Next, let's take a look at the description of the two initialization parameters related to ASMM in the official documentation.
SGA_MAX_SIZE
Attribute
Description
Parameter type
Big integer
Syntax
SGA_MAX_SIZE = integer [K | M | G]
Default Value
Modifiable or not
No
Value Range
0 ~ Depends on the Operating System
SGA_TARGET
Attribute
Description
Parameter type
Big integer
Syntax
SGA_TARGET = integer [K | M | G]
Default Value
Modifiable or not
ALTER SYSTEM
Value Range
64 MB ~ Depends on the Operating System
Basic parameter?
Yes
L Buffer cache (DB_CACHE_SIZE)
L Shared pool (SHARED_POOL_SIZE)
L Large pool (LARGE_POOL_SIZE)
L Java pool (JAVA_POOL_SIZE)
L Streams pool (STREAMS_POOL_SIZE)
L Log buffer
L Fixed SGA and other internal allocations
3. View related initialization parameter values
We can use show parameter to view the initialization parameter values. The related parameters include sga_max_size, sga_target, and pga_aggregate_target.
We can see that the values of the sga_max_size and sga_target parameters are 1232 M.
4. Modify sga_target
We use the alter system statement to modify sga_target. Note that sga_target is a dynamic parameter while sga_max_size is a static parameter.
In this way, when we modify the value <= sga_max_size, we can directly modify the value of sga_target. However, when we modify the value> sga_max_size, we must first modify the value of sga_max_size, restart the database so that the static parameters take effect and then modify the sga_target value. Otherwise, an error is returned.
4.1 modify value <= SGA_MAX_SIZE
First, modify the sga_target parameter value to 800 mb;
Then, try to modify the sga_target parameter value to 500 M, the database reports an error ORA-00827, prompting "unable to compress sga_target to the specified value ";
After modification, we can check the parameter values to confirm whether the modification is successful.
4.2 modify value> SGA_MAX_SIZE
First, try to modify the sga_target parameter value to 2G, the database reports an error ORA-00823, prompt "the value of the specified sga_target is greater than sga_max_size ";
According to the explanation of the two initialization parameters in the official documents, the maximum value of sga_target is sga_max_size.
Therefore, we need to first modify the value of sga_max_size. Because sga_max_size is a static parameter, we need to restart the database. After the static parameter modification takes effect, we can set ga_target to the target value.
But an error is reported during the restart, prompting "ORA-28547: failed to connect to the server, may be an Oracle Net management error ". The error reporting process is as follows:
SQL>
After analysis, it may be related to services in Windows. On Windows, the background processes that constitute instances in oracle are implemented by the threads derived from the oracle service, therefore, the task manager cannot see background processes such as DBWn. Shutdown refers to the process of stopping the instance, which is to close the background process (corresponding to the thread here) and release the SGA memory. Because the thread is closed, no changes can be seen in the task manager. The oracle process can be stopped only after the oracle service is stopped. As a result, I manually shut down and restarted the Oracle service, connected to the sys user again, and successfully logged on.
We can see that the sga_max_size parameter has been successfully modified to 2 GB. Now we can modify the sga_target value.
This article permanently updates the link address: