Anda di halaman 1dari 3

Changing SGA_MAX_SIZE and SGA_TARGET

After encountering numerous errors in regards to ORA-04031 we opened an SR and c


onfirmed our suspicion. We needed to increase the size of our sga. After furth
er review we decided to keep the values of SGA_MAX_SIZE and SGA_TARGET the same.
Here are the steps we followed (very cautious and backup of everything done befo
re we start):
1) VERIFY that LVL 0 backup completed successfully before updating compatible pa
rameter.
2) Log into SQLPLUS (sqlplus / as sysdba) to perform the change
a) Get dbname, current timestamp and show sga parameters
set lines 200;
select current_timestamp, name from v$database;
show parameter sga;
b) Backup spfile to pfile before the change and cat it out to show the valu
es
create pfile='/home/oracle/test_pfile_b4_sga_chg_201208121230.txt' fro
m spfile;
!cat /home/oracle/test_pfile_b4_sga_chg_201208121230.txt | grep sga
c) Alter the sga_max_size and sga_target parameters
alter system set sga_max_size=2G sid='*' scope=spfile;
alter system set sga_target=2G sid='*' scope=spfile;
d) Create another pfile as an after the fact backup and cat it out to show
the values
create pfile='/home/oracle/test_pfile_b4_sga_chg_201208121232.txt' fro
m spfile;
!cat /home/oracle/test_pfile_b4_sga_chg_201208121232.txt | grep sga
3) Since we are exadata, we will bounce the database using srvctl
a) srvctl stop database -d test
srvctl start database -d test
4) Log into SQLPLUS (sqlplus / as sysdba) to perform varification
a) Get dbname, current timestamp and show sga parameters
set lines 200;
select current_timestamp, name from v$database;
show parameter sga;
b) Cat your alert log and grep for sga
cat $BDUMP/alert_$ORACLE_SID.log | grep sga
Here is the output received from following the above mentioned steps:
sqlplus / as sysdba
set lines 200;
select current_timestamp, name from v$database;
show parameter sga;
CURRENT_TIMESTAMP NAME
--------------------------------------------------------------------------- -------12-AUG-12 12.30.16.570722 PM -04:00 TEST
SQL> show parameter sga

NAME TYPE VALUE


------------------------------------ ----------- -----------------------------lock_sga boolean FALSE
pre_page_sga boolean FALSE
sga_max_size big integer 10G
sga_target big integer 5G
SQL> create pfile='/home/oracle/test_pfile_b4_sga_chg_201208121230.txt' from spf
ile;
File created.
SQL> !cat /home/oracle/test_pfile_b4_sga_chg_201208121230.txt | grep sga
test4.__sga_target=5368709120
test1.__sga_target=5368709120
test2.__sga_target=5368709120
test3.__sga_target=5368709120
*.sga_max_size=10737418240
*.sga_target=5368709120
SQL> alter system set sga_max_size=10G sid='*' scope=spfile;
System altered.
SQL> alter system set sga_target=10G sid='*' scope=spfile;
System altered.
SQL> create pfile='/home/oracle/test_pfile_aft_sga_chg_201208121231.txt' from sp
file;
File created.
SQL> !cat /home/oracle/test_pfile_aft_sga_chg_201208121231.txt | grep sga
test4.__sga_target=5368709120
test1.__sga_target=5368709120
test2.__sga_target=5368709120
test3.__sga_target=5368709120
*.sga_max_size=10737418240
*.sga_target=10737418240
srvctl stop database -d test
srvctl start database -d test
sqlplus / as sysdba
SQL> set lines 200
SQL> select current_timestamp, name from v$database;
CURRENT_TIMESTAMP NAME
--------------------------------------------------------------------------- -------12-AUG-12 12.34.49.857105 PM -04:00 TEST
SQL> show parameter sga
NAME TYPE VALUE
------------------------------------ ----------- -----------------------------lock_sga boolean FALSE
pre_page_sga boolean FALSE
sga_max_size big integer 10G
sga_target big integer 10G

SQL> !cat $BDUMP/alert_"$ORACLE_SID".log | grep sga


ALTER SYSTEM SET sga_max_size='8G' SCOPE=SPFILE SID='*';
ALTER SYSTEM SET sga_target='8G' SCOPE=SPFILE SID='*';
ALTER SYSTEM set shared_pool_size='2G' SCOPE=SPFILE SID='*';
ALTER SYSTEM set shared_pool_reserved_sizet=500M SCOPE=SPFILE SID='*';
sga_max_size = 10G
sga_target = 10G
SQL> exit