Professional Documents
Culture Documents
Class - 20200808 Mypractice Amm To Asmm and Asmm To Amm
Class - 20200808 Mypractice Amm To Asmm and Asmm To Amm
SQL> startup
ORACLE instance started.
SQL>
SQL> select sum(bytes/1024/1024) Current_SGA_SIZE_in_MB from v$sgastat;
CURRENT_SGA_SIZE_IN_MB
----------------------
643.998726
SQL>
SQL>
SQL>
SQL> select sum(bytes/1024/1024) MAX_SGA_SIZE_in_MB from v$sgainfo where name =
'Maximum SGA Size';
MAX_SGA_SIZE_IN_MB
------------------
1024
SQL>
SQL>
SQL>
SQL>
SQL> show parameter memory_max_target;
CURRENT_PGA_IN_USE_IN_MB
------------------------
91.3339844
SQL>
SQL>
SQL>
SQL>
SQL> select (value/1024/1024) MAX_PGA_ALLOCATED_in_MB from v$pgastat where name =
'maximum PGA allocated';
MAX_PGA_ALLOCATED_IN_MB
-----------------------
169.042969
SQL>
SQL>
SQL>
SQL>
SQL> select (value/1024/1024) PGA_TARGET_in_MB from v$pgastat where name =
'aggregate PGA target parameter';
PGA_TARGET_IN_MB
----------------
368
SQL>
SQL>
SQL>
SQL>
Disable AMM
-------------------------------------------------
SQL>
SQL>
SQL> alter system reset memory_max_target scope=spfile sid='*';
System altered.
System altered.
SQL>
Enable ASMM
---------------------------
System altered.
SQL>
SQL>
SQL>
SQL> alter system set SGA_TARGET=650m scope=spfile sid='*';
System altered.
SQL>
SQL>
SQL> alter system set PGA_AGGREGATE_TARGET=368m scope=spfile sid='*';
System altered.
SQL>
Reboot database and verify that it switched from AMM(automatic memory management)
to ASMM(automatic shared memory management)--------
----------------------------------------------------------------------------------
The switch from AMM to ASMM frees space in /dev/shm but allocates shared memomry
for the SGA
[oracle@oracle ~]$ ipcs -m
------ Shared Memory Segments --------
key shmid owner perms bytes nattch status
0x00000000 131072 oracle 777 16384 1 dest
0x00000000 163841 oracle 777 3145728 2 dest
0x00000000 393218 oracle 777 3145728 2 dest
0x00000000 360451 oracle 600 524288 2 dest
0x00000000 491524 oracle 600 524288 2 dest
0x00000000 589829 oracle 600 393216 2 dest
0x00000000 622598 oracle 777 16384 1 dest
0x00000000 655367 oracle 777 16384 2 dest
0x00000000 753672 gdm 777 16384 1 dest
0x00000000 851977 gdm 777 2555904 2 dest
0x00000000 884746 oracle 600 524288 2 dest
0x00000000 1179659 oracle 600 8630272 84
0x00000000 1212428 oracle 600 1061158912 42 <-------here
1061158912/1024/1024 = 1012 ~ 1024MB
0x00000000 1245197 oracle 600 3952640 42
0x20af44f8 1277966 oracle 600 20480 42
[oracle@oracle ~]$
[oracle@oracle ~]$ df -h
Filesystem Size Used Avail Use% Mounted on
devtmpfs 1.8G 0 1.8G 0% /dev
tmpfs 1.8G 0 1.8G 0% /dev/shm
tmpfs 1.8G 9.7M 1.8G 1% /run
tmpfs 1.8G 0 1.8G 0% /sys/fs/cgroup
/dev/mapper/ol_stby-root 85G 27G 58G 32% /
/dev/sda1 509M 218M 291M 43% /boot
tmpfs 368M 36K 368M 1% /run/user/54321 <---------
PGA_AGGREGATE_TARGET : 368 Mbyte used 36K oracle
tmpfs 368M 12K 368M 1% /run/user/42
[oracle@oracle ~]$
[oracle@oracle ~]$ id oracle
uid=54321(oracle) gid= 54321(oinstall)
groups=54321(oinstall),54322(dba),54323(oper),54324(backupdba),54325(dgdba),54326(k
mdba),54330(racdba)
[oracle@oracle ~]$
Connected to:
Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production
SQL> show parameter sga
System altered.
System altered.
System altered.
SQL>
Disabled ASMM
---------------------------
Reboot database and verify that it switched from AMM(automatic memory management)
to ASMM(automatic shared memory management)--------
----------------------------------------------------------------------------------
SQL> startup
ORACLE instance started.
File created.
SQL> exit
Disconnected
[oracle@oracle dbs]$ ll
total 24
-rw-rw----. 1 oracle oinstall 1544 Sep 28 11:07 hc_orcl.dat
-rw-r--r--. 1 oracle oinstall 3079 May 15 2015 init.ora
-rw-r--r--. 1 oracle oinstall 1287 Sep 28 11:19 initorcl.ora
-rw-r-----. 1 oracle oinstall 24 Sep 16 00:23 lkORCL
-rw-r-----. 1 oracle oinstall 3584 Sep 16 00:34 orapworcl
-rw-r-----. 1 oracle oinstall 3584 Sep 28 11:03 spfileorcl.ora
[oracle@oracle dbs]$ vi initorcl.ora
[oracle@oracle dbs]$ vi initorcl.ora
[oracle@oracle dbs]$ vi initorcl.ora
[oracle@oracle dbs]$
[oracle@oracle dbs]$
[oracle@oracle dbs]$ pwd
/u01/app/oracle/product/12.2.0.1/dbs
[oracle@oracle dbs]$ sqlplus / as sysdba
SQL> exit
Disconnected
[oracle@oracle dbs]$ pwd
/u01/app/oracle/product/12.2.0.1/dbs
[oracle@oracle dbs]$ vi initorcl.ora
[oracle@oracle dbs]$ vi initorcl.ora
[oracle@oracle dbs]$ sqlplus / as sysdba
Connected to:
Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production
SQL>
SQL>
SQL>
SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL>
SQL>
SQL>
SQL> startup
ORACLE instance started.