Orcle 12c 新特性---IM快速启动

1 说明

In-Memory Column Store allows objects (for example, tables, partitions, and subpartitions) to be populated in-memory in a compressed columnar format. Until now, the columnar format has only been available in-memory. That meant that after a database restart, the In-Memory Column Store would have to be populated from scratch using a multiple step process that converts traditional row formatted data into the compressed columnar format and placed in-memory. In-Memory FastStart enables data to be repopulated into the In-Memory Column Store at a much faster rate than previously possible by saving a copy of the data currently populated in the In-Memory Column Store on disk in its compressed columnar format.

IM中的数据,在数据库重启之后需要重新加载到数据库中,通过保存IM中对象的备份文件到磁盘上大大加快加载速度,从而缩短打开数据库时间。

In-Memory FastStart significantly reduces the time it takes to repopulate data into the In-Memory Column Store after a system restart. This allows businesses to start taking advantage of the analytic query performance benefits of accessing data in a columnar format much sooner than before.

多租户环境下,所有PDB都共享一个FastStart区域和一个FastStart表空间。在RAC环境下,所有节点共享同一份FastStart数据。

通过DBMS_INMEMORY_ADMIN.FASTSTART_ENABLE存储过程启用一个FastStart表空间,Space Management Worker Processes (Wnnn)会创建一个空的SecureFiles LOB,叫SYSDBinstance_name_LOBSEG$。

注意:该表空间不需要DBA来维护,Oracle自动维护。

Oracle按以下规则来自动管理FastStart区域:

  • Whenever population or repopulation of an object occurs, the database writes its columnar data to the FastStart area.

  • If you define an ADO policy on a segment, then the database manages the segment in the FastStart area based on the rule in the policy. For example, if ADO specifies that an object changes its attribute to NO INMEMORY based on a policy, then the IM column store removes its data from the FastStart area.

  • If the attribute of a populated object is changed to NOINMEMORY, then the database automatically removes its IMCUs from the FastStart area.

  • If the FastStart tablespace runs out of space, then the database uses an internal algorithm to drop the oldest segments, and continues writing to the FastStart area. If no space remains, then the database stops writing to the FastStart area.

    扫描二维码关注公众号,回复: 6555013 查看本文章

图1 表示FastStart Area
在这里插入图片描述

1.1 启用IM FastStart条件

  1. The tablespace that will be designated as the FastStart area must exist.

  2. This tablespace must have enough space to store data for the IM column store, and it must not contain any other data before you designate it as the FastStart area. Oracle recommends that you create the FastStart tablespace with twice the size of the INMEMORY_SIZE setting.

  3. You must have administrator privileges.

2 实验

注意:下面所有操作都是PDB级别,或者是在non-CDB下进行。不要在CDB下进行。

2.1 创建FastStart表空间

CREATE TABLESPACE fs_tbs
  DATAFILE '/u01/app/oracle/oradata/orcl/fs_tbs.dbf' SIZE 500M REUSE
  AUTOEXTEND ON NEXT 500K MAXSIZE 1G;

Tablespace created.

2.2 启用IM FastStart

SQL> EXEC DBMS_INMEMORY_ADMIN.FASTSTART_ENABLE('fs_tbs');

PL/SQL procedure successfully completed.

2.3 查看FastStart区域大小

SQL> SELECT TABLESPACE_NAME, STATUS,
       ( (ALLOCATED_SIZE/1024) / 1024 ) AS ALLOC_MB,
       ( (USED_SIZE/1024) / 1024 ) AS USED_MB
FROM   V$INMEMORY_FASTSTART_AREA  2    3    4  
  5  ;

TABLESPACE_NAME STATUS	 ALLOC_MB    USED_MB
--------------- ----------------------- --------------------- ---------------
FS_TBS	ENABLE	    500  1

2.4 查看FastStart logging模式

COL SEGMENT_NAME FORMAT a20
SELECT SEGMENT_NAME, LOGGING
FROM   DBA_LOBS
WHERE  TABLESPACE_NAME = 'FS_TBS';
SEGMENT_NAME	     LOGGING
-------------------- --------------
SYSDBIMFS_LOBSEG$    NO

2.5 强行使IM列式存储重新插入所有IM中的对象

SQL> SELECT /*+ FULL(s) NO_PARALLEL(s) */ COUNT(*) FROM lei.bonus s;

  COUNT(*)
----------
27

SQL> SELECT /*+ FULL(s) NO_PARALLEL(s) */ COUNT(*) FROM lei.cndba s;

  COUNT(*)
----------
 1

2.6 再次查看FastStart区域大小

SQL> SELECT TABLESPACE_NAME, STATUS,
       ( (ALLOCATED_SIZE/1024) / 1024 ) AS ALLOC_MB,
       ( (USED_SIZE/1024) / 1024 ) AS USED_MB
FROM   V$INMEMORY_FASTSTART_AREA  2    3    4  
  5  ;
TABLESPACE_NAME STATUS	 ALLOC_MB    USED_MB
--------------- ----------------------- --------------------- ---------------
FS_TBS	ENABLE	    500     1.1875

更多信息,参考官方文档:
http://docs.oracle.com/database/122/INMEM/managing-im-faststart-for-im-column-store.htm#INMEM-GUID-CAA790EA-0CF6-44A8-A332-3CE23EC0FE79

猜你喜欢

转载自blog.csdn.net/qianglei6077/article/details/92794935