Database 19c - Hybrid Partitioning
Database 19c - Hybrid Partitioning
Compartment
LL80180-COMPARTMENT
Username
LL80180-USER
Password
wO0kGz6Rv18_l([Jq#mx
Tenancy Name
C4U03
Objectives
In this lab, you will:
Objectives
In this lab, you will setup sample schema:
Hybrid Partition Tables enable you to easily integrate internal partitions and external
partitions into a single partition table. With this feature, you can also easily move non-
active partitions to external files, such as Oracle Data Pump files, for a cheaper storage
solution. Partitions of hybrid partitioned tables can reside on both Oracle tablespaces
and external sources, such as Linux files with comma-separated values (CSV) records or
files on Hadoop Distributed File System (HDFS) with Java server. Hybrid partitioned
tables support all existing external table types for external partitions:
ORACLE_DATAPUMP, ORACLE_LOADER, ORACLE_HDFS, ORACLE_HIVE. External table
types for external partitions use the following access driver types:
ORACLE_DATAPUMP
ORACLE_LOADER
ORACLE_HDFS
ORACLE_HIVE
For external partitions of ORACLE_LOADER and ORACLE_DATAPUMP access driver type,
you must grant the following privileges to the user:
p_tname in varchar2,
p_pname in varchar2,
p_dir in varchar2,
p_filename in varchar2)
is
l_output utl_file.file_type;
l_columnValue varchar2(4000);
l_status integer;
l_query varchar2(1000) default 'select * from '|| p_tname || ' partition (' || p_pname || ') where 1=1';
l_colCnt number := 0;
l_separator varchar2(1);
l_descTbl dbms_sql.desc_tab;
begin
l_separator := ',';
end loop;
utl_file.new_line( l_output );
l_status := dbms_sql.execute(l_theCursor);
l_separator := '';
l_separator := ',';
end loop;
utl_file.new_line( l_output );
end loop;
dbms_sql.close_cursor(l_theCursor);
utl_file.fclose( l_output );
END table_part_to_csv;
-- QUERY
exec table_part_to_csv('SALES','SALES_Q1_1998','SALES_98','SALES_Q1_1998.csv');
exec table_part_to_csv('SALES','SALES_Q2_1998','SALES_98','SALES_Q2_1998.csv');
exec table_part_to_csv('SALES','SALES_Q3_1998','SALES_98','SALES_Q3_1998.csv');
exec table_part_to_csv('SALES','SALES_Q4_1998','SALES_98','SALES_Q4_1998.csv');
exec table_part_to_csv('SALES','SALES_Q1_1999','SALES_99','SALES_Q1_1999.csv');
exec table_part_to_csv('SALES','SALES_Q2_1999','SALES_99','SALES_Q2_1999.csv');
exec table_part_to_csv('SALES','SALES_Q3_1999','SALES_99','SALES_Q3_1999.csv');
exec table_part_to_csv('SALES','SALES_Q4_1999','SALES_99','SALES_Q4_1999.csv');
set pages 999
-- QUERY
TABLESPACE "USERS"
EXTERNAL PARTITION ATTRIBUTES (
TYPE ORACLE_LOADER
ACCESS PARAMETERS(
(prod_id, cust_id,
EXTERNAL
EXTERNAL
EXTERNAL
EXTERNAL
EXTERNAL
EXTERNAL
EXTERNAL
TABLESPACE "USERS" ,
TABLESPACE "USERS" ,
TABLESPACE "USERS" ,
TABLESPACE "USERS" ,
TABLESPACE "USERS" ,
TABLESPACE "USERS" ,
TABLESPACE "USERS" ,
TABLESPACE "USERS" ,
TABLESPACE "USERS" ,
TABLESPACE "USERS" ,
TABLESPACE "USERS" ,
TABLESPACE "USERS" ,
TABLESPACE "USERS" ,
TABLESPACE "USERS" ,
NOCOMPRESS NOLOGGING
TABLESPACE "USERS" );