0% found this document useful (0 votes)
11 views5 pages

How To Implement IN - MEMORY - BASE - LEVEL

The document explains the IN-MEMORY feature introduced in Oracle Database version 12.1.0.2, which allows data to be stored in a columnar format in memory for improved performance without changing existing applications. It highlights that the Base Level feature enables the use of up to 16GB of the IN-MEMORY column store for free, starting from Oracle Database 19c, and provides implementation steps and considerations. Additionally, it discusses the In-Memory Eligibility Test to assess if a database workload would benefit from this feature.

Uploaded by

Arbaz Shaikh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views5 pages

How To Implement IN - MEMORY - BASE - LEVEL

The document explains the IN-MEMORY feature introduced in Oracle Database version 12.1.0.2, which allows data to be stored in a columnar format in memory for improved performance without changing existing applications. It highlights that the Base Level feature enables the use of up to 16GB of the IN-MEMORY column store for free, starting from Oracle Database 19c, and provides implementation steps and considerations. Additionally, it discusses the In-Memory Eligibility Test to assess if a database workload would benefit from this feature.

Uploaded by

Arbaz Shaikh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

Hello DBA,

Myself Rahul Kurkute. In 12.1.0.2 version, Oracle introduced IN-MEMORY feature which allows you to store the tables,
tablespace, partitions, columns, MVIEW in memory of SGA in a columnar format instead of typical row format. Oracle
Database configured with Database In-Memory delivers optimal performance. Both analytical queries and OLTP
transaction’s processing speeds can be increased without changing existing applications.

The IM column store is a separately licensed option of Oracle Database Enterprise Edition.

Most DBAs are not aware that the IN-MEMORY feature can be used for FREE. Oracle Database In-Memory “Base Level”
feature allows the use of Database In-Memory with up to a 16GB column store without having to license on EE.

Yes!!!!!!! Just need to set SPfile parameters INMEMORY_FORCE to BASE_LEVEL & INMEMORY_SIZE to less than 16 GB
value. This will allow the use of Database In-Memory with up to a 16GB column store for no extra cost. The Base Level
lets you to experiment with Oracle Database In-Memory features without purchasing the Oracle Database In-Memory
option. This setting is available starting with Oracle Database 19c, Release Update 19.8.

When the Base Level is enabled, the value of the INMEMORY_SIZE initialization parameter is limited to 16 GB for a CDB.
In an Oracle RAC environment, the value of INMEMORY_SIZE is limited to 16 GB for each instance. The compression
level for all objects and columns for INMEMORY is automatically and transparently set to QUERY LOW.

Automatic In-Memory is disabled, and In-Memory Column Store feature tracking is tracked for "In-Memory Base Level"
rather than "In-Memory Column Store." The CellMemory feature is disabled for Oracle Exadata.
In-Memory Column Store (IM Column Store)

• A new component called In-Memory Area within SGA.


• It does not replace the Buffer Cache and KEEP POOL.
• It is a Static Pool and is set with the Static Parameter INMEMORY_SIZE initialization parameter. A restart is
required for the changed value to be applied.
• Since it is a Static Pool, it is not affected by AMM (Automatic Memory Management i.e., MEMORY_TARGET value.
• Must have a value of at least 100M.
• In-Memory Area is divided into 1M (IMCU Pool) and 64K (SMU Pool) Pools (each Pool size is set internally).
• 1M Pool => Actual Data in Column Format, 64K Pool => Metadata for Objects.
• You can use the In-Memory Advisor to determine the appropriate size for INMEMORY_SIZE parameter.

In this document, I will demonstrate how to implement the IN-MEMORY BASE-LEVEL feature in Oracle Database, which
enhances query performance by storing tables, partitions, or columns in memory for fast retrieval.

Let’s start then.

Wait..Wait… before actual start, if you are on 19.20+ onwards, you can run a new In-Memory Eligibility Test. The
purpose of the eligibility test is to create a simple way of identifying if your database workload would benefit from
Database In-Memory. If the database is identified as "eligible" then it is a candidate for running the Oracle Database In-
Memory Advisor.

Ensure that a higher percentage of analytic workload results in greater benefits from INMEMORY implementation.
Here is an example of running the In-Memory Eligibility Test

SQL> set serveroutput on;


SQL>
SQL> variable analysis_summary VARCHAR2(1000)
SQL>
SQL> declare
2 v_inmem_eligible boolean;
3 begin
4 dbms_inmemory_advise.is_inmemory_eligible(1008, 1010, v_inmem_eligible, :analysis_summary); --snap id 1008 to 1010
5 --
6 if v_inmem_eligible then
7 dbms_output.put_line('Database is eligible');
8 else
9 dbms_output.put_line('Database is NOT eligible');
10 end if;
11 end;
12 /
Database is eligible

PL/SQL procedure successfully completed.

SQL>
SQL> print analysis_summary

ANALYSIS_SUMMARY
----------------------------------------------------------------------------------------------------------------
Observed Analytic Workload Percentage is 64.10% is greater than target Analytic Workload Percentage 20%

SQL>

Now Let’s proceed for implementation steps.

1) Check DB version (must be 19.8 or higher)

SQL> set lines 200 pages 1000


SQL> select * from v$version;

BANNER BANNER_FULL BANNER_LEGACY


CON_ID
------------------------------------------------------------ -------------------- -------------------------------------------
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Oracle Database 19c Oracle Database 19c Enterprise Edition
Release 19.0.0.0.0 - Production 0
Production Enterprise Edition R
elease 19.0.0.0.0 -
Production
Version 19.8.0.0.0

2) Setting the in-memory parameters

SQL> alter system set inmemory_force=base_level scope=spfile;

System altered.

SQL> alter system set inmemory_size=500M scope=spfile;

System altered.

SQL> Shutdown immediate


SQL> Startup

3) Check space allocation inside the INMEMORY area.


SQL> SELECT A.POOL, A.ALLOC_BYTES/1024/1024 ALLOC_MB, A.USED_BYTES, A.POPULATE_STATUS, A.CON_ID, B.NAME
FROM V$INMEMORY_AREA A, V$CONTAINERS B WHERE A.CON_ID = B.CON_ID;

POOL ALLOC_MB USED_BYTES POPULATE_STATUS CON_ID NAME


-------------------------- ---------- ---------- -------------------------- ---------- --------------------
1MB POOL 347 0 DONE 0 orcl1980
64KB POOL 136 0 DONE 0 orcl1980

As we can see out of assigned 500 MB, 347 MB allocated for 1MB Pool and 136MB allocated to a 64KB memory pool.
So, make a note while deciding value for INMEMORY_SIZE parameter always consider and add 30% more memory to
existing value. This is because approx. 30% of the INMEMORY_SIZE is allocated to a 64KB memory pool used for storing
metadata information.

4) In-Memory setting at the Table level.

SQL> conn test/test


Connected.
SQL>
SQL> create table table1 as select * from dba_objects;

Table created.

SQL> create table table2 as select * from dba_objects;

Table created.

SQL> alter table table1 inmemory priority high; <<<<<<<<<<<<< Changed table1 table property to inmemory

Table altered.
SQL>

Check the details of Tables :


SQL>
set lines 200 pages 1000
col owner for a20
col table_name for a20
select owner, table_name,inmemory,inmemory_priority,inmemory_distribute,inmemory_compression,inmemory_duplicate
from dba_tables where owner like 'TEST' order by table_name;

OWNER TABLE_NAME INMEMORY INMEMORY INMEMORY_DISTRI INMEMORY_COMPRESS INMEMORY_DUPL


-------------------- -------------------- -------- -------- --------------- ----------------- -------------
TEST TABLE1 ENABLED HIGH AUTO FOR QUERY LOW NO DUPLICATE
TEST TABLE2 DISABLED

Check the inmemory allocation segment of the corresponding table.


SQL>
col owner for a20
col segment_name for a20
SELECT OWNER, SEGMENT_NAME, BYTES/1024/1024 SIZE_IN_MB,INMEMORY_SIZE/1024/1024 INMEMORY_SIZE_MB,
BYTES/INMEMORY_SIZE COMP_RATIO, BYTES_NOT_POPULATED, POPULATE_STATUS FROM V$IM_SEGMENTS;

OWNER SEGMENT_NAME SIZE_IN_MB INMEMORY_SIZE_MB COMP_RATIO BYTES_NOT_POPULATED POPULATE_STAT


-------------------- -------------------- ---------- ---------------- ---------- ------------------- -------------
TEST TABLE1 11.1015625 4.25 2.61213235 0 COMPLETED
SQL>
SELECT A.POOL, A.ALLOC_BYTES/1024/1024 ALLOC_MB, A.USED_BYTES/1024/1024 USED_MB, A.POPULATE_STATUS, A.CON_ID, B.NAME
FROM V$INMEMORY_AREA A, V$CONTAINERS B WHERE A.CON_ID = B.CON_ID;

POOL ALLOC_MB USED_MB POPULATE_STATUS CON_ID NAME


-------------------------- ---------- ---------- -------------------------- ---------- --------------------
1MB POOL 347 4 DONE 0 orcl1980
64KB POOL 136 .25 DONE 0 orcl1980

5) In-Memory setting at column level.

--Cleared all the previous in-memory setup


SQL> SELECT OWNER, SEGMENT_NAME, BYTES/1024/1024 SIZE_IN_MB,INMEMORY_SIZE/1024/1024 INMEMORY_SIZE_MB,
BYTES/INMEMORY_SIZE COMP_RATIO, BYTES_NOT_POPULATED, POPULATE_STATUS FROM V$IM_SEGMENTS;

no rows selected

Elapsed: 00:00:00.03
11:01:09 SQL> alter table test.table3 inmemory(OBJECT_NAME,OBJECT_ID,STATUS) no inmemory(EDITIONABLE,SHARDED,DATA_OBJECT_ID);

Table altered.

Elapsed: 00:00:00.49
11:02:21 SQL> select count(*) from test.table3;

COUNT(*)
----------
73243

Elapsed: 00:00:00.08
11:02:42 SQL>
col owner for a20
col segment_name for a20
SELECT OWNER, SEGMENT_NAME, BYTES/1024/1024 SIZE_IN_MB,INMEMORY_SIZE/1024/1024 INMEMORY_SIZE_MB,
BYTES/INMEMORY_SIZE COMP_RATIO, BYTES_NOT_POPULATED, POPULATE_STATUS FROM V$IM_SEGMENTS;

no rows selected <<<<<<<<<<< in-memory segments are empty.

Elapsed: 00:00:00.02
11:03:06 SQL>

11:03:22 SQL> SELECT OWNER, TABLE_NAME, COLUMN_NAME, INMEMORY_COMPRESSION FROM V$IM_COLUMN_LEVEL;

OWNER TABLE_NAME COLUMN_NAME INMEMORY_COMPRESSION


---------- -------------------- ------------------------------ --------------------------
TEST TABLE3 OWNER DEFAULT
TEST TABLE3 OBJECT_NAME DEFAULT
TEST TABLE3 SUBOBJECT_NAME DEFAULT
TEST TABLE3 OBJECT_ID DEFAULT
TEST TABLE3 DATA_OBJECT_ID NO INMEMORY
TEST TABLE3 OBJECT_TYPE DEFAULT
TEST TABLE3 CREATED DEFAULT
TEST TABLE3 LAST_DDL_TIME DEFAULT
TEST TABLE3 TIMESTAMP DEFAULT
TEST TABLE3 STATUS DEFAULT
TEST TABLE3 TEMPORARY DEFAULT
TEST TABLE3 GENERATED DEFAULT
TEST TABLE3 SECONDARY DEFAULT
TEST TABLE3 NAMESPACE DEFAULT
TEST TABLE3 EDITION_NAME DEFAULT
TEST TABLE3 SHARING DEFAULT
TEST TABLE3 EDITIONABLE NO INMEMORY
TEST TABLE3 ORACLE_MAINTAINED DEFAULT
TEST TABLE3 APPLICATION DEFAULT
TEST TABLE3 DEFAULT_COLLATION DEFAULT
TEST TABLE3 DUPLICATED DEFAULT
TEST TABLE3 SHARDED NO INMEMORY
TEST TABLE3 CREATED_APPID DEFAULT
TEST TABLE3 CREATED_VSNID DEFAULT
TEST TABLE3 MODIFIED_APPID DEFAULT
TEST TABLE3 MODIFIED_VSNID DEFAULT

26 rows selected. <<<<<<<<<<< column level specifications are available.

Elapsed: 00:00:00.05

--To place the table into the in-memory store, “INMEMORY” must be done explicitly at the table level.

11:03:50 SQL> alter table test.table3 inmemory;

Table altered.

Elapsed: 00:00:00.45

11:04:00 SQL> select count(*) from test.table3;

COUNT(*)
----------
73243

Elapsed: 00:00:00.02
11:04:08 SQL>

11:04:30 SQL> SELECT OWNER, SEGMENT_NAME, BYTES/1024/1024 SIZE_IN_MB,INMEMORY_SIZE/1024/1024 INMEMORY_SIZE_MB,


BYTES/INMEMORY_SIZE COMP_RATIO, BYTES_NOT_POPULATED, POPULATE_STATUS FROM V$IM_SEGMENTS;

OWNER SEGMENT_NAME SIZE_IN_MB INMEMORY_SIZE_MB COMP_RATIO BYTES_NOT_POPULATED POPULATE_STAT


-------------------- -------------------- ---------- ---------------- ---------- ------------------- -------------
TEST TABLE3 11.1015625 4.25 2.61213235 0 COMPLETED

Elapsed: 00:00:00.00
11:13:30 SQL>

7) Removing Table from INMEMORY.

1) To remove the tables from IN-MEMORY execute the below statement.

ALTER TABLE "OWNER"."TABLE_NAME_A" noinmemory;


Key Notes:

1) The In-Memory feature can be applied on a tablespace, table, partition, sub-partition, or materialized view,
however there are a few exceptions like:

o Objects owned by SYS or stored in the SYSTEM or SYSAUX tablespaces.


o IOT
o Cluster table
o LONG data type column
o Separately stored LOB
o Tables smaller than 64K (to avoid wasting 1M chunks)

2) Test INMEMORY implementation on lower/UAT environment first and then on PROD environment.
3) Make sure to set INMEMORY_QUERY=ENABLE and INMEMORY_MAX_POPULATE_SERVERS to Half of the
value of CPU_COUNT or the PGA_AGGREGATE_TARGET value divided by 512M, whichever is less.
4) For the Base Level, the IM column store size must not exceed 16 GB.
5) Execute the IN-MEMORY advisory to identify objects recommended for placement in-memory to enhance
analytical queries processing.

Thanks for taking your time and reading this. Stay tuned for the next PART.

Please share your opinions, results, suggestions if any.

Join Our WhatsApp Oracle DBA community:


https://chat.whatsapp.com/GGYmd5H1RG6BX5No3glk20

LinkedIn Profile: Rahul Kurkute


References / For more Info:
https://mikedietrichde.com/2020/07/20/oracle-database-in-memory-base_level-feature-available-since-19-8-0/

https://blogs.oracle.com/in-memory/post/oracle-database-in-memory-base-level-feature

https://blogs.oracle.com/in-memory/post/database-in-memory-base-level-feature-now-available-in-198-ru

https://docs.oracle.com/en/database/oracle/oracle-database/19/refrn/INMEMORY_SIZE.html#GUID-B5BEB6BF-5308-485F-920D-CBB584DDDE8F

https://docs.oracle.com/en/database/oracle/oracle-database/19/refrn/INMEMORY_FORCE.html#GUID-1CAEDEBC-AE38-428D-B07E-6718A7225548

https://blogs.oracle.com/in-memory/post/dbim-resources

https://connor-mcdonald.com/2020/05/01/in-memory-opportunities-abound/

https://connor-mcdonald.com/2020/01/06/getting-the-most-out-of-in-memory/

https://docs.oracle.com/en/database/oracle/oracle-database/19/inmem/intro-to-in-memory-column-store.html#GUID-50E76567-3AD4-4886-A3B0-
A9089C67F9A7

https://www.youtube.com/watch?v=yoHlV7eH708&feature=youtu.be

https://oracle-base.com/articles/12c/in-memory-column-store-12cr1

https://www.youtube.com/watch?v=NkrTczwY8yM

https://hiteshgondalia.wordpress.com/configure-and-manage-in-memory-features/

https://www.oracle.com/a/tech/docs/twp-oracle-database-in-memory-19c.pdf

https://blog.yannickjaquier.com/oracle/in-memory-column-store-simple-example.html

Using Oracle Database In-Memory with Oracle E-Business Suite (Doc ID 2025309.1)

You might also like