OCP-1Z0-052-V8.02-13题

13. You have executed this command to change the size of the database buffer cache:

SQL> ALTER SYSTEM SET DB_CACHE_SIZE=2516582;

System altered.

To verify the change in size, you executed this command:

SQL> SHOW PARAMETER DB_CACHE_SIZE

NAME TYPE VALUE

------------------- ----------- ------------------

db_cache_size big integer 4194304 4M

Why is the value set to 4194304 and not to 2516582?

A.because 4194304 is the granule size

B.because 4194304 is the standard block size

C.because 4194304 is the largest nonstandard block size defined in the database

D.because 4194304 is the total size of data already available in the database buffer cache

Answer: A
答案解析:
sys@TEST0924> select 2516582/1024/1024 from dual;
2516582/1024/1024
-----------------
2.39999962
sys@TEST0924> select 4194304/1024/1024 from dual;
4194304/1024/1024
-----------------
4
All SGA components allocate and deallocate space in units of granules. Oracle Database tracks SGA memory use in internal numbers of granules for each SGA component.

The memory for dynamic components in the SGA is allocated in the unit of granules. The granule size is determined by the amount of SGA memory requested when the instance starts. Specifically, the granule size is based on the value of the SGA_MAX_SIZE initialization parameter. Table 6-1shows the granule size for different amounts of SGA memory.

Table 6-1 Granule Size

SGA Memory Amount Granule Size

Less than or equal to 1 GB

4 MB

Greater than 1 GB and less than or equal to 8 GB

16 MB

Greater than 8 GB and less than or equal to 16 GB

32 MB

Greater than 16 GB and less than or equal to 32 GB

64 MB

Greater than 32 GB and less than or equal to 64 GB

128 MB

Greater than 64 GB and less than or equal to 128 GB

256 MB

Greater than 128 GB

512 MB

You can query the V$SGAINFO view to see the granule size that is being used by an instance. The same granule size is used for all components in the SGA.

If you specify a size for a component that is not a multiple of granule size, Oracle Database rounds the specified size up to the nearest multiple. For example, if the granule size is 4 MB and you specify DB_CACHE_SIZE as 10 MB, the database actually allocates 12 MB.

如果指定的size不是granule size的整数倍,则rounds到整数倍,例如,如果granule size为4M,指定DB_CACHE_SIZE as 10 MB,不是4的整数倍,则实际上DB_CACHE_SIZE as 为12M。

一下是我的环境,因为我的sga大于1G,故granule size为16M。

sys@TEST0924> desc V$SGAINFO
Name Null? Type
----------------------------------------------------- -------- ------------------------------------
NAME VARCHAR2(32)
BYTES NUMBER
RESIZEABLE VARCHAR2(3)
sys@TEST0924> select * from V$SGAINFO ;
NAME BYTES RES
-------------------------------- ---------- ---
Fixed SGA Size 2230952 No
Redo Buffers 20078592 No
Buffer Cache Size 1862270976 Yes
Shared Pool Size 570425344 Yes
Large Pool Size 16777216 Yes
Java Pool Size 16777216 Yes
Streams Pool Size 16777216 Yes
Shared IO Pool Size 0 Yes
Granule Size 16777216 No
Maximum SGA Size 2505338880 No
Startup overhead in Shared Pool 117947968 No
Free SGA Memory Available 0
12 rows selected.
原文地址:https://www.cnblogs.com/hzcya1995/p/13317122.html