In-Memory Column Store in Oracle Database 12c Release 1 (12.1.0.2)
This article provides an overview of the In-Memory Column Store feature in Oracle 12c Release 1 (12.1.0.2).
oracle 12cconfigurationintermediate
by OracleDba
13 views
This article provides an overview of the In-Memory Column Store feature in Oracle 12c Release 1 (12.1.0.2).
123456
CREATE TABLE
ALTER TABLE
CREATE TABLESPACE
ALTER TABLESPACE
CREATE MATERIALIZED VIEW
ALTER MATERIALIZED VIEW123456789101112131415161718192021222324252627282930313233343536373839
ALTER SYSTEM SET SGA_TARGET=3G SCOPE=SPFILE;
ALTER SYSTEM SET INMEMORY_SIZE=2G SCOPE=SPFILE;
SHUTDOWN IMMEDIATE;
STARTUP;
ORACLE instance started.
Total System Global Area 3221225472 bytes
Fixed Size 2929552 bytes
Variable Size 419433584 bytes
Database Buffers 637534208 bytes
Redo Buffers 13844480 bytes
In-Memory Area 2147483648 bytes
Database mounted.
Database opened.
SQL>
SQL> SHOW PARAMETER INMEMORY
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
inmemory_clause_default string
inmemory_force string DEFAULT
inmemory_max_populate_servers integer 1
inmemory_query string ENABLE
inmemory_size big integer 2G
inmemory_trickle_repopulate_servers_ integer 1
percent
optimizer_inmemory_aware boolean TRUE
SQL>
CONN sys@pdb1 AS SYSDBA
-- Disable IM column store in the PDB
ALTER SYSTEM SET INMEMORY_SIZE=0;
-- OR
ALTER SYSTEM RESET INMEMORY_SIZE;
-- Assign a PDB-specific size.
ALTER SYSTEM SET INMEMORY_SIZE=1G;123456789101112131415
-- System level
ALTER SYSTEM SET INMEMORY_FORCE=OFF;
ALTER SYSTEM SET INMEMORY_FORCE=DEFAULT;
-- System level
ALTER SYSTEM SET INMEMORY_QUERY=DISABLE;
ALTER SYSTEM SET INMEMORY_QUERY=ENABLE;
-- Session level
ALTER SESSION SET INMEMORY_QUERY=DISABLE;
ALTER SESSION SET INMEMORY_QUERY=ENABLE;
ALTER SYSTEM RESET INMEMORY_SIZE SCOPE=SPFILE;
SHUTDOWN IMMEDIATE;
STARTUP;123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
CONN test/test@pdb1
CREATE TABLE im_tab (
id NUMBER
) INMEMORY;
CREATE TABLE noim_tab (
id NUMBER
) NO INMEMORY;
CREATE TABLE default_tab (
id NUMBER
);
COLUMN table_name FORMAT A20
SELECT table_name,
inmemory,
inmemory_priority,
inmemory_distribute,
inmemory_compression,
inmemory_duplicate
FROM user_tables
ORDER BY table_name;
TABLE_NAME INMEMORY INMEMORY INMEMORY_DISTRI INMEMORY_COMPRESS INMEMORY_DUPL
-------------------- -------- -------- --------------- ----------------- -------------
DEFAULT_TAB DISABLED
IM_TAB ENABLED NONE AUTO FOR QUERY LOW NO DUPLICATE
NOIM_TAB DISABLED
3 rows selected.
SQL>
ALTER TABLE IM_TAB NO INMEMORY;
ALTER TABLE NOIM_TAB INMEMORY MEMCOMPRESS FOR CAPACITY LOW;
ALTER TABLE DEFAULT_TAB INMEMORY PRIORITY HIGH;
SELECT table_name,
inmemory,
inmemory_priority,
inmemory_distribute,
inmemory_compression,
inmemory_duplicate
FROM user_tables
ORDER BY table_name;
TABLE_NAME INMEMORY INMEMORY INMEMORY_DISTRI INMEMORY_COMPRESS INMEMORY_DUPL
-------------------- -------- -------- --------------- ----------------- -------------
DEFAULT_TAB ENABLED HIGH AUTO FOR QUERY LOW NO DUPLICATE
IM_TAB DISABLED
NOIM_TAB ENABLED NONE AUTO FOR CAPACITY LOW NO DUPLICATE
3 rows selected.
SQL>123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
CREATE TABLE im_col_tab (
id NUMBER,
col1 NUMBER,
col2 NUMBER,
col3 NUMBER,
col4 NUMBER
) INMEMORY
INMEMORY MEMCOMPRESS FOR QUERY HIGH (col1, col2)
INMEMORY MEMCOMPRESS FOR CAPACITY HIGH (col3)
NO INMEMORY (id, col4);
CONN sys@pdb1 AS SYSDBA
SELECT table_name,
segment_column_id,
column_name,
inmemory_compression
FROM v$im_column_level
WHERE owner = 'TEST'
and table_name = 'IM_COL_TAB'
ORDER BY segment_column_id;
TABLE_NAME SEGMENT_COLUMN_ID COLUMN_NAME INMEMORY_COMPRESSION
-------------------- ----------------- ------------------------------- --------------------------
IM_COL_TAB 1 ID NO INMEMORY
IM_COL_TAB 2 COL1 FOR QUERY HIGH
IM_COL_TAB 3 COL2 FOR QUERY HIGH
IM_COL_TAB 4 COL3 FOR CAPACITY HIGH
IM_COL_TAB 5 COL4 NO INMEMORY
5 rows selected.
SQL>
CONN test/test@pdb1
ALTER TABLE im_col_tab
NO INMEMORY (col1, col2)
INMEMORY MEMCOMPRESS FOR CAPACITY HIGH (col3)
NO INMEMORY (id, col4);
CONN sys@pdb1 AS SYSDBA
SELECT table_name,
segment_column_id,
column_name,
inmemory_compression
FROM v$im_column_level
WHERE owner = 'TEST'
and table_name = 'IM_COL_TAB'
ORDER BY segment_column_id;
TABLE_NAME SEGMENT_COLUMN_ID COLUMN_NAME INMEMORY_COMPRESSION
-------------------- ----------------- ------------------------------- --------------------------
IM_COL_TAB 1 ID NO INMEMORY
IM_COL_TAB 2 COL1 NO INMEMORY
IM_COL_TAB 3 COL2 NO INMEMORY
IM_COL_TAB 4 COL3 FOR CAPACITY HIGH
IM_COL_TAB 5 COL4 NO INMEMORY
5 rows selected.
SQL>1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
CONN test/test@pdb1
CREATE TABLE t1 AS
SELECT * FROM all_objects;
CREATE MATERIALIZED VIEW t1_mv INMEMORY
AS SELECT * FROM t1;
SELECT table_name,
inmemory,
inmemory_priority,
inmemory_distribute,
inmemory_compression,
inmemory_duplicate
FROM user_tables
WHERE table_name = 'T1_MV';
TABLE_NAME INMEMORY INMEMORY INMEMORY_DISTRI INMEMORY_COMPRESS INMEMORY_DUPL
-------------------- -------- -------- --------------- ----------------- -------------
T1_MV ENABLED NONE AUTO FOR QUERY LOW NO DUPLICATE
1 row selected.
SQL>
ALTER MATERIALIZED VIEW t1_mv
INMEMORY MEMCOMPRESS FOR CAPACITY HIGH PRIORITY HIGH;
SELECT table_name,
inmemory,
inmemory_priority,
inmemory_distribute,
inmemory_compression,
inmemory_duplicate
FROM user_tables
WHERE table_name = 'T1_MV';
TABLE_NAME INMEMORY INMEMORY INMEMORY_DISTRI INMEMORY_COMPRESS INMEMORY_DUPL
-------------------- -------- -------- --------------- ----------------- -------------
T1_MV ENABLED HIGH AUTO FOR CAPACITY HIGH NO DUPLICATE
1 row selected.
SQL>
ALTER MATERIALIZED VIEW t1_mv NO INMEMORY;
SELECT table_name,
inmemory,
inmemory_priority,
inmemory_distribute,
inmemory_compression,
inmemory_duplicate
FROM user_tables
WHERE table_name = 'T1_MV';
TABLE_NAME INMEMORY INMEMORY INMEMORY_DISTRI INMEMORY_COMPRESS INMEMORY_DUPL
-------------------- -------- -------- --------------- ----------------- -------------
T1_MV DISABLED
1 row selected.
SQL>12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
CONN sys@pdb1 AS SYSDBA
CREATE TABLESPACE new_ts
DATAFILE '/u01/app/oracle/oradata/CDB1/datafile/pdb1/pdb1_new_ts.dbf' SIZE 10M
DEFAULT INMEMORY;
SELECT tablespace_name,
def_inmemory,
def_inmemory_priority,
def_inmemory_distribute,
def_inmemory_compression,
def_inmemory_duplicate
FROM dba_tablespaces
ORDER BY tablespace_name;
TABLESPACE_NAME DEF_INME DEF_INME DEF_INMEMORY_DI DEF_INMEMORY_COMP DEF_INMEMORY_
------------------------------ -------- -------- --------------- ----------------- -------------
NEW_TS ENABLED NONE AUTO FOR QUERY LOW NO DUPLICATE
SYSAUX DISABLED
SYSTEM DISABLED
TEMP DISABLED
USERS DISABLED
5 rows selected.
SQL>
ALTER TABLESPACE new_ts
DEFAULT INMEMORY MEMCOMPRESS FOR CAPACITY HIGH;
SELECT tablespace_name,
def_inmemory,
def_inmemory_priority,
def_inmemory_distribute,
def_inmemory_compression,
def_inmemory_duplicate
FROM dba_tablespaces
ORDER BY tablespace_name;
TABLESPACE_NAME DEF_INME DEF_INME DEF_INMEMORY_DI DEF_INMEMORY_COMP DEF_INMEMORY_
------------------------------ -------- -------- --------------- ----------------- -------------
NEW_TS ENABLED NONE AUTO FOR CAPACITY HIGH NO DUPLICATE
SYSAUX DISABLED
SYSTEM DISABLED
TEMP DISABLED
USERS DISABLED
SQL>
ALTER TABLESPACE new_ts
DEFAULT NO INMEMORY;
SELECT tablespace_name,
def_inmemory,
def_inmemory_priority,
def_inmemory_distribute,
def_inmemory_compression,
def_inmemory_duplicate
FROM dba_tablespaces
ORDER BY tablespace_name;
TABLESPACE_NAME DEF_INME DEF_INME DEF_INMEMORY_DI DEF_INMEMORY_COMP DEF_INMEMORY_
------------------------------ -------- -------- --------------- ----------------- -------------
NEW_TS DISABLED
SYSAUX DISABLED
SYSTEM DISABLED
TEMP DISABLED
USERS DISABLED
5 rows selected.
SQL>Please to add comments
No comments yet. Be the first to comment!