File tree Expand file tree Collapse file tree 2 files changed +52
-0
lines changed
data-platform/core-converged-db/hybrid-partitioned/scripts Expand file tree Collapse file tree 2 files changed +52
-0
lines changed Original file line number Diff line number Diff line change
1
+ REM Script: 1 - create- partitioned- table .sql
2
+ REM Use data from HR table EMPLOYEES
3
+
4
+ -- prereq EMPLOYEES table from HR schema
5
+ -- HR schema available in https://github.com/oracle-samples/db-sample-schemas/blob/main/human_resources/hr_create.sql
6
+
7
+
8
+ DROP TABLE hr .employees_hybrid ;
9
+
10
+ CREATE TABLE hr .employees_hybrid
11
+ ( EMPLOYEE_ID varchar2 (10 ),
12
+ SALARY number ,
13
+ JOB_TITLE varchar2 (35 ))
14
+ PARTITION BY RANGE (salary)
15
+ ( PARTITION salary_4000 VALUES less than (4000 ), -- internal partition
16
+ PARTITION salary_10000 VALUES less than (10000 ), -- internal partition
17
+ PARTITION salary_30000 VALUES less than (30000 ), -- intern partition
18
+ PARTITION salary_max values less than (MAXVALUE))
19
+ /
20
+
21
+ -- insert rows
22
+
23
+ INSERT INTO hr .employees_hybrid
24
+ SELECT e .employee_id , e .salary , j .job_title
25
+ FROM hr .employees e JOIN hr .jobs j ON e .job_id = j .job_id ;
26
+
27
+ COMMIT ;
Original file line number Diff line number Diff line change
1
+ ## Scripts for hybrid partitioned tables
2
+
3
+ ## Step by step instructions
4
+
5
+ This folder provides step by step instruction to create a hybrid partitioned table. the example uses table EMPLOYEES from schema HR.
6
+
7
+ - 1-create-partitioned-table.sql: create a partitioned table and add rows
8
+
9
+ - 2-add-external-attribute.sql: Use ALTER TABLE command to add external partition attribute
10
+
11
+ - 3-create-external-data.sql: Create external helper table with ORACLE_DATAPUMP
12
+
13
+ - 4-add-external-partition-data.sql: Use EXCHANGE PARTITION to provide data for the external partition
14
+
15
+ - monitor-external-part-tables.sql: Use ALL_EXTERNAL_TAB_PARTITIONS
16
+
17
+ - monitor-hybrid-tables.sql. Use ALL_TABLES with column hybrid
18
+
19
+ # License
20
+
21
+ Copyright (c) 2023 Oracle and/or its affiliates.
22
+
23
+ Licensed under the Universal Permissive License (UPL), Version 1.0.
24
+
25
+ See LICENSE for more details.
You can’t perform that action at this time.
0 commit comments