Skip to content

Commit 2cd1e86

Browse files
Final updates to markdown files and added Lab scripts (#99)
* New In-Memory 21c Lab New In-Memory 21c Lab * Removed image files Removed image files and update md files with text to replace images. * Updated misc files Updated manifest.json files for new labs. Only Desktop was up to date. Update README.md for new lab description Fixed setup.md with correct row number for Lineorder table. * Added proper text for moving to next lab Added the proper text for moving to the next lab at the end of each lab's markdown file. * Minor updates to syntax and wording * Minor text updates Changed the text around the videos * Update joins-aggregations.md Remove invalid comments for old video link and description. * Fixed typo and added Lab scripts Fixed a comment typo in joins-aggregations.md and added a script directory with all of the Lab scripts. * Updated some wording and examples. Made a final pass on these Labs updating some wording and examples. * Moved scripts to a files directory under each lab Co-authored-by: Andy Rivenes <andyr.github@gmail.com>
1 parent f86b3af commit 2cd1e86

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

62 files changed

+1483
-48
lines changed

in-memory-21c/aim-high/aim-high.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Automatic In-Memory High
1+
# Automatic In-Memory Level High
22

33
## Introduction
44
Watch the video below to get an overview of Automatic In-Memory:
@@ -31,9 +31,7 @@ In Oracle Database 18c a feature called Automatic In-Memory (AIM) was added. The
3131
This Lab will explore the new AIM level HIGH and how it works. A new schema will be used, the AIM schema with small, medium and large tables. This will make it easier to show how AIM works as the column store experiences "memory pressure" (i.e. gets full). The LINEORDER table in the SSB schema will be used to help "fill up" the IM column store and then the AIM tables will be used to show how AIM can manage the total number of objects for maximum benefit.
3232

3333

34-
## Task 1: Verify Directory Definitions
35-
36-
In this Lab we will be populating external data from a local directory and we will need to define a database directory to use in our external table definitions to point the database to our external data.
34+
## Task 1: AIM Level High
3735

3836
Let's switch to the aim-high folder and log back in to the PDB:
3937

@@ -320,7 +318,7 @@ SQL>
320318
SQL>
321319
```
322320
323-
Verify that all of the LINEORDER partitions are populated before continuing on with the lab.
321+
Verify that all of the LINEORDER partitions are populated before continuing on with the lab. You may have to re-run this script to verify that the partitions are populated since it does take a little bit of time to fully populate the partitions.
324322
325323
5. Let's re-check the inmemory status of the objects in the SSB and AIM schemas:
326324
@@ -807,7 +805,7 @@ SQL>
807805
SQL>
808806
```
809807
810-
11. Let's take a look at the Heat Map statistics for the segments.
808+
11. Let's take a look at the Heat Map statistics for the segments. Although Heat Map is not used directly by AIM, and does not have to be enabled for AIM to work, it does give us an easy way to look at the usage statistics that AIM does base its decisions on.
811809
812810
Run the script *11\_hm\_stats.sql*
813811
@@ -889,6 +887,8 @@ SQL>
889887
SQL>
890888
```
891889
890+
Note that your values may be different than what is shown above. The values shown will be based on the usage that has occurred in your database.
891+
892892
12. Now let's see if we can figure out what has happened with the AIM processing. First we will look at the tasks that are running as part of AIM.
893893
894894
Run the script *12\_aim\_tasks.sql*
@@ -932,7 +932,7 @@ SQL>
932932
SQL>
933933
```
934934
935-
Make note of the last task_id. We will use this as input in the next step. Also note that the tasks are being run approximately every 2 minutes. As was described in Lab13 on AIM level LOW and MEDIUM, AIM tasks will continue to be scheduled during each IMCO cycle when under memory pressure. Again, this means that it may take a couple of cycles before an object is populated by AIM in the IM column store.
935+
Make note of the last task_id. We will use this as input in the next step. Also note that the tasks are being run approximately every 2 minutes. AIM tasks will be scheduled during each IMCO cycle, which is approximately every 2 minutes, when the IM column store is under memory pressure. This means that it may take a couple of cycles before an object is populated by AIM in the IM column store.
936936
937937
13. Now let's look at the AIM task details, or what actually happened.
938938
@@ -998,7 +998,7 @@ SQL>
998998
SQL>
999999
```
10001000
1001-
As a reminder, take a look at the OBJECT_NAME and the ACTION. Now that the IM column store is under memory pressure AIM has taken over control of population and there is a lot going on. Based on usage statistics AIM will populate the objects that will result in the most benefit to queries being run. You may want to take a look at some of the other task details to get a better picture of what has happened. Also note that now that AIM is controlling population the PRIORITY level will be ignored and AIM will decide which objects to populate and which to evict.
1001+
Take a look at the OBJECT_NAME and the ACTION. Now that the IM column store is under memory pressure AIM has taken over control of population and there is a lot going on. Based on usage statistics AIM will populate the objects that will result in the most benefit to queries being run. You may want to take a look at some of the other task details to get a better picture of what has happened. Also note that now that AIM is controlling population the PRIORITY level will be ignored and AIM will decide which objects to populate and which to evict.
10021002
10031003
14. Now let's turn AIM off and see what happens.
10041004
@@ -1141,7 +1141,7 @@ SQL>
11411141
SQL>
11421142
```
11431143
1144-
Notice that all of the objects that were enabled for inmemory when the AIM level was set to high have now been disabled. However, the LINEORDER partitions that we manually enabled are still enabled.
1144+
Notice that all of the objects that were enabled for inmemory when the AIM level was set to HIGH have now been disabled. However, the LINEORDER partitions that we manually enabled are still enabled.
11451145
11461146
16. What has happened to the populated segments in the IM column store?
11471147
@@ -1284,7 +1284,7 @@ SQL>
12841284
12851285
## Conclusion
12861286
1287-
This lab demonstrated how then new INMEMORY\_AUTOMATIC\_LEVEL = HIGH feature works and how AIM level high can enable the automatic management of the contents of IM column store. This means no more having to try and figure out which objects would get the most benefit from being populated. Now the database will do it for you.
1287+
This lab demonstrated how the new INMEMORY\_AUTOMATIC\_LEVEL = HIGH feature works and how AIM level high can enable the automatic management of the contents of IM column store. This means no more having to try and figure out which objects would get the most benefit from being populated. Now the database will do it for you.
12881288
12891289
You may now **proceed to the next lab**.
12901290
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
@../aim_login.sql
2+
3+
set pages 999
4+
set lines 200
5+
set tab off
6+
7+
column owner format a10;
8+
column table_name format a20;
9+
column partition_name format a15;
10+
column inmemory format a10;
11+
column INMEMORY_PRIORITY heading 'INMEMORY|PRIORITY' format a10;
12+
column INMEMORY_DISTRIBUTE heading 'INMEMORY|DISTRIBUTE' format a12;
13+
column INMEMORY_COMPRESSION heading 'INMEMORY|COMPRESSION' format a14;
14+
set echo on
15+
16+
-- Show table attributes
17+
18+
select owner, table_name, NULL as partition_name, inmemory,
19+
inmemory_priority, inmemory_distribute, inmemory_compression
20+
from dba_tables
21+
where owner in ('AIM','SSB')
22+
UNION ALL
23+
select table_owner as owner, table_name, partition_name, inmemory,
24+
inmemory_priority, inmemory_distribute, inmemory_compression
25+
from dba_tab_partitions
26+
where table_owner in ('AIM','SSB')
27+
order by owner, table_name, partition_name;
28+
29+
set echo off
30+
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
@../aim_login.sql
2+
3+
set pages 9999
4+
set lines 150
5+
6+
set serveroutput on;
7+
declare
8+
v_ddl varchar2(1000);
9+
begin
10+
for tab_cursor in (
11+
select owner, table_name
12+
from dba_tables
13+
where owner not in ('AUDSYS','SYS')
14+
and inmemory = 'ENABLED'
15+
)
16+
loop
17+
v_ddl := 'alter table '||tab_cursor.owner||'.'||tab_cursor.table_name||' no inmemory';
18+
dbms_output.put_line(v_ddl);
19+
execute immediate v_ddl;
20+
end loop;
21+
--
22+
for part_cursor in (
23+
select table_owner, table_name, partition_name
24+
from dba_tab_partitions
25+
where table_owner not in ('AUDSYS','SYS')
26+
and inmemory = 'ENABLED'
27+
)
28+
loop
29+
v_ddl := 'alter table '||part_cursor.table_owner||'.'||part_cursor.table_name||
30+
' modify partition '||part_cursor.partition_name||' no inmemory';
31+
dbms_output.put_line(v_ddl);
32+
execute immediate v_ddl;
33+
end loop;
34+
end;
35+
/
36+
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
@../aim_login.sql
2+
3+
set pages 999
4+
set lines 200
5+
set echo on
6+
7+
alter table ssb.lineorder inmemory;
8+
9+
exec dbms_inmemory.populate('SSB','LINEORDER');
10+
11+
set echo off
12+
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
@../aim_login.sql
2+
3+
set pages 9999
4+
set lines 150
5+
set tab off
6+
7+
column owner format a10;
8+
column segment_name format a20;
9+
column partition_name format a15;
10+
column populate_status format a15;
11+
column bytes heading 'Disk Size' format 999,999,999,999
12+
column inmemory_size heading 'In-Memory|Size' format 999,999,999,999
13+
column bytes_not_populated heading 'Bytes|Not Populated' format 999,999,999,999
14+
set echo on
15+
16+
-- Query the view v$IM_SEGMENTS to shows what objects are in the column store
17+
-- and how much of the objects were populated. When the BYTES_NOT_POPULATED is 0
18+
-- it indicates the entire table was populated.
19+
20+
select owner, segment_name, partition_name, populate_status, bytes,
21+
inmemory_size, bytes_not_populated
22+
from v$im_segments
23+
where owner not in ('AUDSYS','SYS')
24+
order by owner, segment_name, partition_name;
25+
26+
select * from v$inmemory_area;
27+
28+
set echo off
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
@../aim_login.sql
2+
3+
set pages 999
4+
set lines 200
5+
set tab off
6+
7+
column owner format a10;
8+
column table_name format a20;
9+
column partition_name format a15;
10+
column inmemory format a10;
11+
column INMEMORY_PRIORITY heading 'INMEMORY|PRIORITY' format a10;
12+
column INMEMORY_DISTRIBUTE heading 'INMEMORY|DISTRIBUTE' format a12;
13+
column INMEMORY_COMPRESSION heading 'INMEMORY|COMPRESSION' format a14;
14+
set echo on
15+
16+
-- Show table attributes
17+
18+
select owner, table_name, NULL as partition_name, inmemory,
19+
inmemory_priority, inmemory_distribute, inmemory_compression
20+
from dba_tables
21+
where owner in ('AIM','SSB')
22+
UNION ALL
23+
select table_owner as owner, table_name, partition_name, inmemory,
24+
inmemory_priority, inmemory_distribute, inmemory_compression
25+
from dba_tab_partitions
26+
where table_owner in ('AIM','SSB')
27+
order by owner, table_name, partition_name;
28+
29+
set echo off
30+
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
@../aim_login.sql
2+
3+
set pages 9999
4+
set lines 150
5+
6+
show parameters inmemory_automatic_level
7+
8+
alter system set inmemory_automatic_level=high;
9+
10+
show parameters inmemory_automatic_level
11+
12+
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
@../aim_login.sql
2+
3+
set pages 999
4+
set lines 200
5+
set tab off
6+
7+
column owner format a10;
8+
column table_name format a20;
9+
column partition_name format a15;
10+
column inmemory format a10;
11+
column INMEMORY_PRIORITY heading 'INMEMORY|PRIORITY' format a10;
12+
column INMEMORY_DISTRIBUTE heading 'INMEMORY|DISTRIBUTE' format a12;
13+
column INMEMORY_COMPRESSION heading 'INMEMORY|COMPRESSION' format a14;
14+
set echo on
15+
16+
-- Show table attributes
17+
18+
select owner, table_name, NULL as partition_name, inmemory,
19+
inmemory_priority, inmemory_distribute, inmemory_compression
20+
from dba_tables
21+
where owner in ('AIM','SSB')
22+
UNION ALL
23+
select table_owner as owner, table_name, partition_name, inmemory,
24+
inmemory_priority, inmemory_distribute, inmemory_compression
25+
from dba_tab_partitions
26+
where table_owner in ('AIM','SSB')
27+
order by owner, table_name, partition_name;
28+
29+
set echo off
30+
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
@../aim_login.sql
2+
3+
set pages 9999
4+
set lines 150
5+
set tab off
6+
7+
column owner format a10;
8+
column segment_name format a20;
9+
column partition_name format a15;
10+
column populate_status format a15;
11+
column bytes heading 'Disk Size' format 999,999,999,999
12+
column inmemory_size heading 'In-Memory|Size' format 999,999,999,999
13+
column bytes_not_populated heading 'Bytes|Not Populated' format 999,999,999,999
14+
set echo on
15+
16+
-- Query the view v$IM_SEGMENTS to shows what objects are in the column store
17+
-- and how much of the objects were populated. When the BYTES_NOT_POPULATED is 0
18+
-- it indicates the entire table was populated.
19+
20+
select owner, segment_name, partition_name, populate_status, bytes,
21+
inmemory_size, bytes_not_populated
22+
from v$im_segments
23+
where owner not in ('AUDSYS','SYS')
24+
order by owner, segment_name, partition_name;
25+
26+
select * from v$inmemory_area;
27+
28+
set echo off
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
@../aim_login.sql
2+
3+
set pages 999
4+
set lines 200
5+
set echo on
6+
7+
select count(*) from lrgtab1;
8+
select count(*) from lrgtab1;
9+
10+
select count(*) from lrgtab2;
11+
select count(*) from lrgtab2;
12+
select count(*) from lrgtab2;
13+
14+
select count(*) from lrgtab3;
15+
select count(*) from medtab1;
16+
select count(*) from medtab1;
17+
select count(*) from medtab1;
18+
select count(*) from medtab2;
19+
select count(*) from medtab2;
20+
select count(*) from medtab2;
21+
22+
select count(*) from lrgtab4;
23+
select count(*) from lrgtab4;
24+
25+
set echo off
26+

0 commit comments

Comments
 (0)