MINI MINI MANI MO
<?xml version="1.0"?>
<!--
Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
NAME
kuprtobj.xsl
DESCRIPTION
XSLT stylesheet for XML => DDL conversion of md$_part_obj_t
NOTES
Do NOT modify this file under any circumstance. Copy the file
if you wish to use this stylesheet with an external XML/XSL parser
MODIFIED MM/DD/YY
jjanosik 08/21/17 - Bug 26661529 : emit alter for composite domain
indexes with unusable subpartitions
jjanosik 08/01/17 - Bug 26384085 - embed unusable in the partition
definition instead of using alter
tbhukya 07/17/17 - Bug 22104291: Generate default directory at partition
level for composite partition
jjanosik 06/02/17 - Bug 24803693: make TABLE_COMPRESSION_CLAUSE and
SEGMENT_ATTRIBUTES play nice
tbhukya 05/29/17 - Bug 26036341: Use GenExtTableLoc
jjanosik 05/11/17 - Bug 25321187: Change call to DoSegInMemory
rapayne 04/26/17 - Bug 25732728: TABLE_COMPRESSION_CLAUSE is not getting
apply if the table does not already have compress
attributes defined.
jjanosik 03/24/17 - Bug 24517168: add storage to subpartitions
bwright 03/10/17 - Bug 25326861: Fix INITRANS of part. cluster
tbhukya 02/09/17 - Bug 25414028: Exclude compress for partitioned MV Log
tbhukya 01/30/17 - Bug 25095866: Generate MEMOPTIMIZE clause
jjanosik 12/23/16 - Bug 25301621: get cellmemory on partition when
needed
jjanosik 11/30/16 - Bug 24465253: fix cellmemory working for composite
partitions
sdavidso 08/08/16 - bug 24386897 list partition limited to 4000 chars
jjanosik 08/26/16 - Bug 23625494: fix comment as there is now a flags2
sdavidso 07/04/16 - sharding exchange-out support
tbhukya 06/08/16 - Bug 22171888: Cellmemory support in partitioned table
jjanosik 05/17/16 - bug 21606091 - add segment creation clause to
subpartition template
tbhukya 04/29/16 - Bug 23035753: Add storage clause at sub-partition
jjanosik 04/20/16 - bug 23014537 - new INCLUDE_PARTITIONS param to force
generation of system created partitions
bwright 03/02/16 - Defer AUTOMATIC LIST SUBPARTITIONING
bwright 02/19/16 - Bug 22097063: No TRANSITION for local index
rapayne 01/30/16 - bug 22611512: fix variable Transportable
tbhukya 11/19/15 - Bug 22172461: Handle indexing at sub-partition level
rapayne 11/16/15 - bug 22165030: imc distribute for subpartition
templates.
tbhukya 08/28/15 - Bug 18944465: Partition indexing on
tbhukya 08/17/15 - Bug 21555645: mapping table at partition in tts
bwright 08/14/15 - Bug 20756134: STORE IN autolist part. table
rapayne 07/31/15 - bug 21436670: fix location clause by adding
specific dirobj to file spec.
sdavidso 06/18/15 - bug20864693: read only partition support
rapayne 05/20/15 - external table enhancements for partition locations.
rapayne 05/12/15 - bug 21097611: support for SEGMENT CREATION clause
for queue tables.
aditigu 03/03/15 - Bug 20433683: Unspecified IMC attrs should be null
bwright 02/11/15 - Proj 49143: Add auto-list (sub)partitioning and
range interval subpartitioning w/ transition
rapayne 02/10/15 - lrg 15074144: overflow clause with deferred stg
does not process LOGGING attrib correctly.
rapayne 01/25/15 - lrg 14979799: more dsc cleanup from iot work.
tbhukya 01/05/15 - Bug 20319428: Declare referred params
rapayne 11/07/14 - bug 19976325 - deferred segment support for [P]IOTs.
sogugupt 10/28/14 - Bug 17382480: incorrect ddl generated for subpart
table with lob when tablespace false
tbhukya 07/24/14 - Bug 19055042: Generate segment creation deferred
at sub-partition level
tbhukya 05/06/14 - Bug 18694579: Add tablespace clause at partition
for lob
sdavidso 04/04/14 - bug18385644: new IMC syntax
sdavidso 08/02/13 - bug16915643: extended inmemory options
bwright 08/16/13 - Bug 17312600: Remove hard tabs from DP src code
sdavidso 04/08/13 - proj42352: DP In-memory columnar
mjangir 01/14/13 - lrg 8673827:unusable index (sub)partitions with TTS
mjangir 12/05/12 - bug 15963397: Added the deferred segment creation
syntax in subpart with transportable
rapayne 11/19/12 - lrg-8459934: Fix generation of TRANSITION
clause.
xihua 10/11/12 - Index Compression Factoring Change
lbarton 08/30/12 - bug 14054759: exclude indexes with stale entries and
tables with online moved partitions
dvekaria 07/18/12 - Bug13443703.
rapayne 03/20/12 - proj 32423: OLTP Index compression support.
lbarton 01/11/12 - bug 13458665: PARTITION_NAME for composite
partitioned table
rapayne 12/25/11 - proj 37634: Partial Index support.
ebatbout 06/29/11 - proj. 32404: Support for interval reference
partitioned table
sdavidso 05/07/11 - more full/transportable
sdavidso 03/30/11 - support TRANSPORTABLE xml element
tbhukya 12/20/10 - Bug 9695547:Add Overflow clause for hash partitioned
IOT in tts mode.
sdavidso 09/30/10 - bug10101332: fix nested table/partition attributes
lbarton 04/26/10 - bug 9650606: more dsc details
lbarton 03/02/10 - bug 9396952: display LOB partition descriptor when
deferred segment creation
lbarton 02/12/10 - lrg 4478962: logging in partitions
sdavidso 11/04/09 - bug 9039622: hash-{range,list,hash} composite
partitioning
lbarton 11/02/09 - deferred segment creation for partitions
lbarton 06/15/09 - remove hybrid columnar noise words
sdavidso 06/01/09 - lrg 3876848: default blocksize for composit
partition
rapayne 04/26/09 - bug 8355496: add deferred segment support to
DoPartSegAttrs.
sdavidso 04/23/09 - bug 7597578: support NT partition properties
lbarton 11/25/08 - archive level compression
lbarton 03/19/09 - lrg 3762023: unusable index (sub)partitions and
transportable
rapayne 12/24/08 - merge BLOCKSIZE logic for CM.
mjangir 01/18/09 - bug 7690799: setup correct filter for tablespace
lbarton 09/10/08 - bug 7362930: index (sub)partition UNUSABLE
sdavidso 08/13/08 - bug 7272424: index on system partitioned table
sdavidso 07/05/07 - subpartition compression
rapayne 06/26/07 - Correct the version check for interval partitioning.
htseng 03/14/07 - bug 5759921: transportable for subpartition template
htseng 02/15/07 - bug 5752667: missing keyword LESS THAN in
range subpartition template
lbarton 11/07/06 - bug 5607195: subpartition template in interval
partition
lbarton 10/05/06 - more interval partitioning
lbarton 09/13/06 - interval partitioning
lbarton 08/28/06 - All composite partitioning combinations
sdavidso 05/11/06 - clean up ref partition
msakayed 05/09/06 - backout htseng system partitioning changes
msakayed 04/30/06 - system partitioning support
htseng 05/02/06 - add partition by system support
htseng 04/13/06 - add partition by reference
lbarton 01/25/06 - add comments
htseng 12/16/05 - add transform param PARTITIONING
rapayne 11/02/05 - Bug 4715313: Reformat with XMLSpy
sdavidso 09/20/05 - fix compressed keys in partioned IOT
sdavidso 09/14/05 - deal with index NOCOMPRESS at the partition level
htseng 08/08/05 - bug 3560220: get correct behavior from processor
lbarton 05/09/05 - bug 4331909: use dataobj_num for OBJNO_REUSE in
overflow seg
lbarton 05/11/04 - Bug 3617842: SAMPLE and PCTSPACE
rpfau 04/16/04 - Fix bug 3488157 - values clause missing for
partition by list for piot.
lbarton 12/02/03 - Bug 3283651: fix test for index local partition
htseng 10/03/03 - Fix bug 2977027
lbarton 06/19/03 - Bug 3012732: tte storage params for list subpart'n
htseng 04/10/03 - bug 2896047
htseng 01/06/03 - fix bug 2711197
htseng 11/14/02 - add GLOBAL keyword for INDEX Partition
htseng 10/09/02 - add space before keywrod LOCAL
lbarton 08/02/02 - transportable export
lbarton 01/07/02 - fix formatting
dgagne 11/05/01 - remove row movement from partitions and tablespace
dgagne 10/15/01 - add heap segment compression support
dgagne 09/17/01 - add support for subpartition template
dgagne 09/05/01 - add range-list composite partitioning
dgagne 06/14/01 - Move storage PRETTY statements to kustorag
lbarton 06/01/01 - remove oradb-style imports
lbarton 12/01/00 - PIOT bugfixes
gclaborn 10/30/00 - Add external imports; change name
lbarton 10/25/00 - LRG 50204: sort part cols on pos_num
lbarton 10/24/00 - sort in views, not xsl
lbarton 10/16/00 - bugfix: use ColNameOrAttr for partition col names
lbarton 07/24/00 - use uriref in import
lbarton 06/23/00 - List partitioning
lbarton 05/15/00 - Params for new API
lbarton 03/28/00 - Part. indexes, hash, composite
lbarton 03/17/00 - Add module header
-->
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<!-- Import required scripts -->
<xsl:import href="kucommon.xsl"/>
<xsl:import href="kustorag.xsl"/>
<xsl:import href="kulob.xsl"/>
<!-- Top-level parameters -->
<xsl:param name="PARTITIONING">1</xsl:param>
<xsl:param name="EXPORT">0</xsl:param>
<xsl:param name="INCLUDE_PARTITIONS">0</xsl:param>
<xsl:param name="TABLESPACE">1</xsl:param>
<xsl:param name="SHARD_TABLESPACE"/>
<xsl:param name="SEGMENT_CREATION">1</xsl:param>
<xsl:param name="TRANSPORTABLE">0</xsl:param>
<xsl:param name="PCTSPACE">100</xsl:param>
<xsl:param name="PARTITION_NAME" select="''"/>
<xsl:param name="ALTER_INDEX_PART_UNUSABLE">0</xsl:param>
<!-- Templates -->
<xsl:template name="DoPartObjSegAttrs">
<xsl:param name="ADT_type">TABLE</xsl:param>
<!-- *******************************************************************
Template: DoPartObjSegAttrs - emit default PCTFREE, PCTUSED, etc.
Parameters:
ADT_type: "TABLE" or "INDEX"
******************************************************************** -->
<xsl:apply-templates select="PART_OBJ/PARTOBJ/DEFPCTFREE">
<xsl:with-param name="ADT_type" select="$ADT_type"/>
</xsl:apply-templates>
</xsl:template>
<xsl:template name="DoPartObjLogging">
<!-- *******************************************************************
Template: DoPartObjLogging - emit default LOGGING
******************************************************************** -->
<xsl:apply-templates select="PART_OBJ/PARTOBJ/DEFLOGGING"/>
</xsl:template>
<xsl:template name="DoPartObjStorage">
<xsl:param name="ADT_type">TABLE</xsl:param>
<xsl:param name="Pctspace">100</xsl:param>
<!-- *******************************************************************
Template: DoPartObjStorage - emit default STORAGE
Parameters:
ADT_type: "TABLE" or "INDEX"
Pctspace: percentage by which space allocation is to be modified
defaults to 100 (no modification)
******************************************************************** -->
<xsl:call-template name="DoDefStorage">
<xsl:with-param name="Node" select="PART_OBJ/PARTOBJ"/>
<xsl:with-param name="BlkSize" select="../BLOCKSIZE | BLOCKSIZE"/>
<xsl:with-param name="Pctspace" select="$Pctspace"/>
</xsl:call-template>
</xsl:template>
<xsl:template name="DoPartObjTablespace">
<!-- *******************************************************************
Template: DoPartObjTablespace - emit default tablespace
******************************************************************** -->
<xsl:if test="$TABLESPACE=1">
<xsl:apply-templates select="PART_OBJ/PARTOBJ/DEFTS_NAME"/>
</xsl:if>
</xsl:template>
<xsl:template name="DoPartObjReadOnly">
<!-- *******************************************************************
Template: DoPartObjReadOnly - emit READ ONLY if flag is set.
******************************************************************** -->
<xsl:if test="(PART_OBJ/PARTOBJ/FLAGS mod (65536*2)) >= 65536">
<xsl:text> READ ONLY </xsl:text>
</xsl:if>
</xsl:template>
<xsl:template name="DoCvtPartitionClause">
<xsl:param name="Pctspace">100</xsl:param>
<xsl:param name="TableNode" select="''"/>
<xsl:param name="Part_objNode" select="''"/>
<!-- *******************************************************************
Template: DoCvtPartitionClause - generate PARTITION clause when
departitioning a composite partitioned table
Parameters:
Pctspace: percentage by which space allocation is to be modified
defaults to 100 (no modification)
TableNode - the TABLE_T node if ADT_TYPE = table
Part_objNode: PART_OBJ node
******************************************************************** -->
<xsl:text> PARTITION BY </xsl:text>
<xsl:variable name="SubPartType" select="$Part_objNode/PARTOBJ/SPARE2 mod 256"/>
<xsl:choose>
<xsl:when test="$SubPartType=1">RANGE </xsl:when>
<xsl:when test="$SubPartType=2">HASH </xsl:when>
<xsl:when test="$SubPartType=4">LIST </xsl:when>
</xsl:choose>
<xsl:apply-templates select="$Part_objNode/SUBPARTCOLS"/>
<!-- automatic option added in 12.2 -->
<xsl:if test="$SubPartType=4 and ($Part_objNode/PARTOBJ/FLAGS mod 128)>=64 and $VERSION>=1202000000">
<xsl:text>AUTOMATIC </xsl:text>
<!-- STORE IN -->
<xsl:for-each select="$Part_objNode/INSERT_TS_LIST/INSERT_TS_LIST_ITEM">
<xsl:if test="position()=1">STORE IN (</xsl:if>
<xsl:if test="(not(contains(NAME,'"')))">"</xsl:if>
<xsl:value-of select="NAME"/>
<xsl:if test="(not(contains(NAME,'"')))">"</xsl:if>
<xsl:choose>
<xsl:when test="position()=last()">) </xsl:when>
<xsl:otherwise>, </xsl:otherwise>
</xsl:choose>
</xsl:for-each>
</xsl:if>
<xsl:for-each select="$Part_objNode/COMPART_LIST/COMPART_LIST_ITEM[SCHEMA_OBJ/SUBNAME=$PARTITION_NAME]">
<xsl:for-each select="SUBPARTS/SUBPARTS_ITEM">
<!-- emit the initial open paren -->
<xsl:if test="position()=1">
<xsl:if test="$PRETTY=1">
<xsl:text>
</xsl:text>
</xsl:if>
<xsl:text> (</xsl:text>
</xsl:if>
<xsl:call-template name="DoPartListItem">
<xsl:with-param name="PartobjNode" select="$Part_objNode/PARTOBJ"/>
<xsl:with-param name="Parttype" select="$SubPartType"/>
<xsl:with-param name="Pctspace" select="$Pctspace"/>
<xsl:with-param name="TableNode" select="$TableNode"/>
</xsl:call-template>
<!--
Put out a comma / LF if not the last partition
-->
<xsl:choose>
<xsl:when test="not(position()=last())">
<xsl:text>, </xsl:text>
<xsl:if test="$PRETTY=1">
<xsl:text>
 </xsl:text>
</xsl:if>
</xsl:when>
<xsl:otherwise>) </xsl:otherwise>
</xsl:choose>
</xsl:for-each>
</xsl:for-each>
</xsl:template>
<xsl:template name="DoPartitionClause">
<xsl:param name="ADT_type">TABLE</xsl:param>
<xsl:param name="Pctspace">100</xsl:param>
<xsl:param name="PartCompress" select="false()"/>
<!-- *******************************************************************
Template: DoPartitionClause - the rest of the partitioning clauses
including PARTITION BY and the partition lists
Current node: TABLE_T or MVIEW_TAB
Parameters:
ADT_type: "TABLE" or "INDEX"
Pctspace: percentage by which space allocation is to be modified
defaults to 100 (no modification)
PartCompress: TRUE = compress partition (for index partitions)
defaults to FALSE
******************************************************************** -->
<xsl:if test="$PARTITIONING=1">
<!-- [ LOCAL | GLOBAL ] PARTITION BY ... -->
<xsl:call-template name="DoParttype">
<xsl:with-param name="ADT_type" select="$ADT_type"/>
<xsl:with-param name="PartobjNode" select="PART_OBJ/PARTOBJ"/>
<xsl:with-param name="TempSub" select="PART_OBJ/TSUBPARTS"/>
<xsl:with-param name="ParentNode" select="PART_OBJ"/>
</xsl:call-template>
<!-- SUBPARTITION TEMPLATE ... -->
<xsl:call-template name="SubpartTemplate">
<xsl:with-param name="PartobjNode" select="PART_OBJ/PARTOBJ"/>
<xsl:with-param name="TempSub" select="PART_OBJ/TSUBPARTS/TSUBPARTS_ITEM"/>
</xsl:call-template>
<!-- PARTITION list -->
<xsl:call-template name="DoPartLists">
<xsl:with-param name="ADT_type" select="$ADT_type"/>
<xsl:with-param name="PartobjNode" select="PART_OBJ/PARTOBJ"/>
<xsl:with-param name="Parttype" select="PART_OBJ/PARTOBJ/PARTTYPE"/>
<xsl:with-param name="Subparttype" select="(PART_OBJ/PARTOBJ/SPARE2 mod 256)"/>
<xsl:with-param name="Local">
<xsl:choose>
<xsl:when test="$ADT_type='INDEX'
and (PART_OBJ/PARTOBJ/FLAGS mod 2)=1">1</xsl:when>
<xsl:otherwise>0</xsl:otherwise>
</xsl:choose>
</xsl:with-param>
<xsl:with-param name="ParentNode" select="PART_OBJ"/>
<xsl:with-param name="TableNode" select="."/>
<xsl:with-param name="Pctspace" select="$Pctspace"/>
<xsl:with-param name="PartCompress" select="$PartCompress"/>
</xsl:call-template>
</xsl:if>
</xsl:template>
<xsl:template name="DoPIOTSegAttrs">
<xsl:param name="Node" select="''"/>
<!-- *******************************************************************
Template: DoPIOTSegAttrs - emit default PCTFREE, PCTUSED, etc.
Parameters:
Node: parent of DEFPCTFREE
******************************************************************** -->
<xsl:apply-templates select="$Node/DEFPCTFREE">
<xsl:with-param name="ADT_type">INDEX</xsl:with-param>
</xsl:apply-templates>
</xsl:template>
<xsl:template name="DoPIOTLogging">
<xsl:param name="Node" select="''"/>
<xsl:param name="Pctspace">100</xsl:param>
<!-- *******************************************************************
Template: DoPIOTLogging - emit default LOGGING, TABLESPACE, STORAGE
Parameters:
Node: parent of DEFLOGGING, DEFTS_NAME, STORAGE
Pctspace: percentage by which space allocation is to be modified
defaults to 100 (no modification)
******************************************************************** -->
<xsl:apply-templates select="$Node/DEFLOGGING"/>
<xsl:apply-templates select="$Node/DEFTS_NAME"/>
<xsl:call-template name="DoDefStorage">
<xsl:with-param name="Node" select="$Node"/>
<xsl:with-param name="BlkSize" select="../BLOCKSIZE | BLOCKSIZE"/>
<xsl:with-param name="Pctspace" select="$Pctspace"/>
</xsl:call-template>
</xsl:template>
<xsl:template name="DoPIOTPartitionClause">
<xsl:param name="Pctspace">100</xsl:param>
<xsl:param name="PartCompress" select="false()"/>
<!-- *******************************************************************
Template: DoPIOTPartitionClause - the rest of the partitioning clauses
including PARTITION BY and the partition lists
Parameters:
Pctspace: percentage by which space allocation is to be modified
defaults to 100 (no modification)
PartCompress: TRUE = compress partition (for index partitions)
defaults to FALSE
******************************************************************** -->
<xsl:call-template name="DoParttype">
<xsl:with-param name="PartobjNode" select="PART_OBJ/TABPARTOBJ"/>
</xsl:call-template>
<xsl:call-template name="DoPartLists">
<!-- Treat the PIOT as an ADT_type=INDEX so we don't put out Pctfree and
storage clauses. But set PIOT to 1 so we can tell it is really a
table. -->
<xsl:with-param name="ADT_type">INDEX</xsl:with-param>
<xsl:with-param name="PIOT">1</xsl:with-param>
<xsl:with-param name="PartobjNode" select="PART_OBJ/TABPARTOBJ"/>
<xsl:with-param name="Parttype" select="PART_OBJ/TABPARTOBJ/PARTTYPE"/>
<xsl:with-param name="Subparttype" select="(PART_OBJ/TABPARTOBJ/SPARE2 mod 256)"/>
<xsl:with-param name="Local">0</xsl:with-param>
<xsl:with-param name="ParentNode" select="PART_OBJ"/>
<xsl:with-param name="Pctspace" select="$Pctspace"/>
<xsl:with-param name="TableNode" select="."/>
<xsl:with-param name="PartCompress" select="$PartCompress"/>
</xsl:call-template>
</xsl:template>
<xsl:template name="DoParttype">
<xsl:param name="ADT_type">TABLE</xsl:param>
<xsl:param name="PartobjNode" select="''"/>
<xsl:param name="TempSub" select="''"/>
<xsl:param name="ParentNode" select="''"/>
<!-- *******************************************************************
Template: DoParttype
This template does both partition type/cols and subpartition type/cols
Parameters:
ADT_type: "TABLE" or "INDEX"
PartobjNode: PARTOBJ node
TempSub: TSUBPARTS node
ParentNode - the parent of the (COM)PART_LIST node
******************************************************************** -->
<xsl:choose>
<xsl:when test="$ADT_type='INDEX'
and ($PartobjNode/FLAGS mod 2)=1">
<xsl:text> LOCAL</xsl:text>
</xsl:when>
<xsl:when test="$PartobjNode/PARTTYPE=1">
<!-- range -->
<xsl:if test="$ADT_type='INDEX'"> GLOBAL</xsl:if>
<xsl:text> PARTITION BY RANGE </xsl:text>
<xsl:apply-templates select="$PartobjNode/../PARTCOLS"/>
<!-- INTERVAL clause: what we display depends on the EXPORT, VERSION
and INCLUDE_PARTITIONS params
EXPORT VERSION INCLUDE_PARTITIONS output
====== ======= ================== ======
any any 'ALL' expose all partitions
TRUE ge 11.1 any expose TRANSITION and all partitions
TRUE lt 11.1 any convert to range partition;
existing partitions move to range
section
FALSE any any generate the CREATE TABLE
as the user would have entered it
with no TRANSITION and no partitions
in the interval section
-->
<xsl:if test="$PartobjNode/INTERVAL_STR and ($EXPORT=0 or $VERSION>=1100000000)">
<xsl:text>INTERVAL (</xsl:text>
<xsl:value-of select="$PartobjNode/INTERVAL_STR"/>
<xsl:text>) </xsl:text>
<!-- suppress TRANSITION if EXPORT=0 -->
<xsl:if test="$EXPORT=1">
<!-- TRANSITION clause: if there is a [COM]PART_LIST_ITEM with
the 0x8000 flag set (= partition is in the interval section).
The TRANSITION clause identifies the last customer defined
partition so that when this DDL is executed as part of import,
SQL will be able to properly mark which partitions are user
defined and which are system generated when this table gets
created. The partitioning syntax on a CREATE TABLE looks like
all specified partitions are 'user defined', but in import's
case some of these are system generated and we need a way to
tell this to the target db. -->
<xsl:choose>
<xsl:when test="$ParentNode/PART_LIST/PART_LIST_ITEM[(FLAGS mod 65536)>=32768]">
<xsl:for-each select="$ParentNode/PART_LIST/PART_LIST_ITEM[32768>(FLAGS mod 65536)]">
<xsl:if test="position()=last()">
<xsl:text>TRANSITION ("</xsl:text>
<xsl:value-of select="./SCHEMA_OBJ/SUBNAME"/>
<xsl:text>") </xsl:text>
</xsl:if>
</xsl:for-each>
</xsl:when>
<xsl:when test="$ParentNode/COMPART_LIST/COMPART_LIST_ITEM[(FLAGS mod 65536)>=32768]">
<xsl:for-each select="$ParentNode/COMPART_LIST/COMPART_LIST_ITEM[32768>(FLAGS mod 65536)]">
<xsl:if test="position()=last()">
<xsl:text>TRANSITION ("</xsl:text>
<xsl:value-of select="./SCHEMA_OBJ/SUBNAME"/>
<xsl:text>") </xsl:text>
</xsl:if>
</xsl:for-each>
</xsl:when>
</xsl:choose>
</xsl:if>
<!-- STORE IN -->
<xsl:for-each select="$PartobjNode/INSERT_TS_LIST/INSERT_TS_LIST_ITEM">
<xsl:if test="position()=1">STORE IN (</xsl:if>
<xsl:if test="(not(contains(NAME,'"')))">"</xsl:if>
<xsl:value-of select="NAME"/>
<xsl:if test="(not(contains(NAME,'"')))">"</xsl:if>
<xsl:choose>
<xsl:when test="position()=last()">) </xsl:when>
<xsl:otherwise>, </xsl:otherwise>
</xsl:choose>
</xsl:for-each>
</xsl:if>
<!-- subpartition by -->
<xsl:call-template name="DoSubparttype">
<xsl:with-param name="ADT_type" select="$ADT_type"/>
<xsl:with-param name="PartobjNode" select="$PartobjNode"/>
<xsl:with-param name="TempSub" select="$TempSub"/>
</xsl:call-template>
</xsl:when>
<xsl:when test="$PartobjNode/PARTTYPE=2">
<!-- hash -->
<xsl:if test="$ADT_type='INDEX'"> GLOBAL</xsl:if>
<xsl:text> PARTITION BY HASH </xsl:text>
<xsl:apply-templates select="$PartobjNode/../PARTCOLS"/>
<xsl:call-template name="DoSubparttype">
<xsl:with-param name="ADT_type" select="$ADT_type"/>
<xsl:with-param name="PartobjNode" select="$PartobjNode"/>
<xsl:with-param name="TempSub" select="$TempSub"/>
</xsl:call-template>
</xsl:when>
<xsl:when test="$PartobjNode/PARTTYPE=3">
<!-- system -->
<xsl:if test="$ADT_type='INDEX'"> GLOBAL</xsl:if>
<xsl:text> PARTITION BY SYSTEM </xsl:text>
<xsl:apply-templates select="$PartobjNode/../PARTCOLS"/>
</xsl:when>
<xsl:when test="$PartobjNode/PARTTYPE=4">
<!-- list -->
<xsl:text> PARTITION BY LIST </xsl:text>
<xsl:apply-templates select="$PartobjNode/../PARTCOLS"/>
<!-- automatic option added in 12.2 -->
<xsl:if test="($PartobjNode/FLAGS mod 128)>=64 and $VERSION>=1202000000">
<xsl:text>AUTOMATIC </xsl:text>
<!-- STORE IN -->
<xsl:for-each select="$PartobjNode/INSERT_TS_LIST/INSERT_TS_LIST_ITEM">
<xsl:if test="position()=1">STORE IN (</xsl:if>
<xsl:if test="(not(contains(NAME,'"')))">"</xsl:if>
<xsl:value-of select="NAME"/>
<xsl:if test="(not(contains(NAME,'"')))">"</xsl:if>
<xsl:choose>
<xsl:when test="position()=last()">) </xsl:when>
<xsl:otherwise>, </xsl:otherwise>
</xsl:choose>
</xsl:for-each>
</xsl:if>
<xsl:call-template name="DoSubparttype">
<xsl:with-param name="ADT_type" select="$ADT_type"/>
<xsl:with-param name="PartobjNode" select="$PartobjNode"/>
<xsl:with-param name="TempSub" select="$TempSub"/>
</xsl:call-template>
</xsl:when>
<xsl:when test="$PartobjNode/PARTTYPE=5">
<!-- reference
Here we assume there is exactly one referential constraint governing
the reference partitioning -->
<xsl:text> PARTITION BY REFERENCE ("</xsl:text>
<xsl:for-each select="CON2_LIST/CON2_LIST_ITEM">
<xsl:if test="(FLAGS mod 1024)>=512">
<xsl:value-of select="NAME"/>
</xsl:if>
</xsl:for-each>
<xsl:text>") </xsl:text>
<!-- Use TRANSITION clause when all conditions are met: interval partition
table, import operation, version is 12 or greater and an interval
partition exists -->
<xsl:if test="($PartobjNode/FLAGS mod 128)>=64 and ($EXPORT=1) and
($VERSION>=1200000000) and
$ParentNode/PART_LIST/PART_LIST_ITEM[(FLAGS mod 65536)>=32768]">
<!-- Find the last range partition before the 1st interval partition.
The TRANSITION clause identifies the last customer defined
partition so that when this DDL is executed as part of import,
SQL will be able to properly mark which partitions are user
defined and which are system generated when this table gets
created. The partitioning syntax on a CREATE TABLE looks like
all specified partitions are 'user defined', but in import's
case some of these are system generated and we need a way to
tell this to the target db. -->
<xsl:for-each select="$ParentNode/PART_LIST/PART_LIST_ITEM[32768>(FLAGS mod 65536)]">
<xsl:if test="position()=last()">
<xsl:text>TRANSITION ("</xsl:text>
<xsl:value-of select="./SCHEMA_OBJ/SUBNAME"/>
<xsl:text>") </xsl:text>
</xsl:if>
</xsl:for-each>
</xsl:if>
</xsl:when>
</xsl:choose>
</xsl:template>
<xsl:template name="DoSubparttype">
<xsl:param name="ADT_type">TABLE</xsl:param>
<xsl:param name="PartobjNode" select="''"/>
<xsl:param name="TempSub" select="''"/>
<!-- *******************************************************************
Template: DoSubparttype
This template does subpartition type/cols
Parameters:
ADT_type: "TABLE" or "INDEX"
PartobjNode: PARTOBJ node
TempSub: TSUBPARTS node
******************************************************************** -->
<xsl:choose>
<xsl:when test="($PartobjNode/SPARE2 mod 256)=1">
<!-- range subpart -->
<xsl:if test="$PRETTY=1">
<xsl:text>
 </xsl:text>
</xsl:if>
<xsl:text> SUBPARTITION BY RANGE </xsl:text>
<xsl:apply-templates select="$PartobjNode/../SUBPARTCOLS"/>
<!-- interval option added in 12.2 -->
<xsl:if test="($PartobjNode/FLAGS mod 65536)>=32768 and $VERSION>=1202000000">
<xsl:text>INTERVAL (</xsl:text>
<xsl:value-of select="$PartobjNode/SUBINTERVAL_STR"/>
<xsl:text>) </xsl:text>
</xsl:if>
</xsl:when>
<xsl:when test="($PartobjNode/SPARE2 mod 256)=2">
<!-- hash subpart -->
<xsl:if test="$PRETTY=1">
<xsl:text>
 </xsl:text>
</xsl:if>
<xsl:text> SUBPARTITION BY HASH </xsl:text>
<xsl:apply-templates select="$PartobjNode/../SUBPARTCOLS"/>
<!-- number of subpartitions is bytes 2-3 of SPARE2 -->
<xsl:if test="(floor(($PartobjNode/SPARE2) div 65536) mod 65536) > 0 and
$TempSub=''">
<!-- template not need subpartitions quantity -->
<xsl:if test="$PRETTY=1">
<xsl:text>
 </xsl:text>
</xsl:if>
<xsl:text> SUBPARTITIONS </xsl:text>
<xsl:value-of select="(floor(($PartobjNode/SPARE2) div 65536) mod 65536)"/>
</xsl:if>
</xsl:when>
<xsl:when test="($PartobjNode/SPARE2 mod 256)=4">
<!-- list subpart -->
<xsl:if test="$PRETTY=1">
<xsl:text>
 </xsl:text>
</xsl:if>
<xsl:text> SUBPARTITION BY LIST </xsl:text>
<xsl:apply-templates select="$PartobjNode/../SUBPARTCOLS"/>
<!-- automatic option subpartition deferred until 12.2.0.2,
note no STORE IN at subpart level
<xsl:if test="($PartobjNode/FLAGS mod 65536)>=32768 and $VERSION>=1202000000">
<xsl:text>AUTOMATIC </xsl:text>
</xsl:if>
-->
</xsl:when>
</xsl:choose>
</xsl:template>
<xsl:template match="PARTCOLS | SUBPARTCOLS">
<!-- *******************************************************************
Template: PARTCOLS | SUBPARTCOLS
List the partitioning columns
******************************************************************** -->
<xsl:for-each select="PARTCOLS_ITEM | SUBPARTCOLS_ITEM">
<xsl:if test="position()='1'">
<xsl:text>(</xsl:text>
</xsl:if>
<xsl:call-template name="ColNameOrAttr">
<xsl:with-param name="ColItem" select="COL"/>
</xsl:call-template>
<xsl:choose>
<!-- Put out a comma if not the last col -->
<xsl:when test="not(position()=last())">
<xsl:text>,</xsl:text>
</xsl:when>
<xsl:otherwise>) </xsl:otherwise>
</xsl:choose>
</xsl:for-each>
</xsl:template>
<xsl:template name="SubpartTemplate">
<xsl:param name="PartobjNode" select="''"/>
<xsl:param name="TempSub" select="''"/>
<!-- *******************************************************************
Template: SubpartTemplate
This template Emit SUBPARTITION TEMPLATE
Parameters:
PartobjNode: PARTOBJ node
TempSub: TSUBPARTS node
******************************************************************** -->
<xsl:for-each select="$TempSub">
<xsl:if test="(position()=1)">
<xsl:if test="$PRETTY=1">
<xsl:text>
 </xsl:text>
</xsl:if>
<xsl:text> SUBPARTITION TEMPLATE ( </xsl:text>
<xsl:if test="$PRETTY=1">
<xsl:text>
 </xsl:text>
</xsl:if>
</xsl:if>
<xsl:if test="not(position()=1)">
<xsl:text>, </xsl:text>
<xsl:if test="$PRETTY=1">
<xsl:text>
 </xsl:text>
</xsl:if>
</xsl:if>
<xsl:text> SUBPARTITION "</xsl:text>
<xsl:value-of select="SPART_NAME"/>
<xsl:text>"</xsl:text>
<xsl:if test="HIBOUNDLEN!=0">
<xsl:choose>
<!-- Range subpartition -->
<xsl:when test="($PartobjNode/SPARE2 mod 256)=1">
<xsl:text> VALUES LESS THAN ( </xsl:text>
</xsl:when>
<!-- List subpartition -->
<xsl:when test="($PartobjNode/SPARE2 mod 256)=4">
<xsl:text> VALUES ( </xsl:text>
</xsl:when>
</xsl:choose>
<xsl:value-of select="HIBOUNDVAL"/>
<xsl:value-of select="HIBOUNDVALC"/>
<xsl:text> )</xsl:text>
</xsl:if>
<!-- process partial indexing attribute:
Default INDEXING is ON - so only generate INDEXING attribute if its
disabled and we are 12c or beyond
-->
<xsl:if test="$VERSION>=1200000000 and
(FLAGS mod 256) >= 128">
<xsl:text> INDEXING OFF</xsl:text>
</xsl:if>
<!-- process partial indexing attribute:
Default INDEXING is OFF - so only generate INDEXING attribute if its
enabled and we are 12c or beyond
-->
<xsl:if test="$VERSION>=1200000000 and
(($PartobjNode/FLAGS mod 16384) >= 8192) and
not ((FLAGS mod 256) >= 128)">
<xsl:text> INDEXING ON</xsl:text>
</xsl:if>
<!-- inmemory columnar - compress, load, map/mirror-->
<!--relevant bits in template subpartion template (defsubpart$.flags from kkpac.h):
#define KKPACFRAG_TEMPLATE_IMC_ENABLED (ub4) 0x200 /* IMC specified */ 1
#define KKPACFRAG_TEMPLATE_IMC_NOTENABLED (ub4) 0x400 /* IMC not specified */ 2
#define KKPACFRAG_TEMPLATE_IMC_MIRRORMAP (ub4) 0x800 /* IMC mirror or map */ 4
#define KKPACFRAG_TEMPLATE_IMC_LEVEL1 (ub4)0x1000 /* IMC nocomp or comp */ 8
#define KKPACFRAG_TEMPLATE_IMC_PRELOAD (ub4)0x2000/* IMC ondemand or preload */ 16
#define KKPACFRAG_TEMPLATE_IMC_MAPBY1 (ub4)0x4000 /* IMC rowid or part */ 32
#define KKPACFRAG_TEMPLATE_IMC_MAPBY2 (ub4)0x8000 /* IMC part or subpart */
#define KKPACFRAG_TEMPLATE_IMC_LEVEL2 (ub4)0x10000 /* IMC comp low or high */ 128
#define KKPACFRAG_TEMPLATE_IMC_PPRI_NONE (ub4)0x20000/* IMC preload priority */ 256 mod 32
#define KKPACFRAG_TEMPLATE_IMC_PPRI_LOW (ub4)0x40000 /* priority - LOW */
#define KKPACFRAG_TEMPLATE_IMC_PPRI_MEDIUM (ub4)0x80000 /* priority - MEDIUM */
#define KKPACFRAG_TEMPLATE_IMC_PPRI_HIGH (ub4)0x100000 /* priority - HIGH */
#define KKPACFRAG_TEMPLATE_IMC_PPRI_CRITICAL (ub4)0x200000 /* CRITICAL */
#define KKPACFRAG_TEMPLATE_IMC_PPRI_MASK (ub4)0x3e0000 /* priority MASK */
#define KKPACFRAG_TEMPLATE_IMC_FORCED (ub4)0x400000 /* IMC forced */
#define KKPACFRAG_TEMPLATE_IMC_LEVEL3 (ub4)0x800000/* IMCcomp qry(0) cap(1) */ 16384 mod 4
#define KKPACFRAG_TEMPLATE_IMC_LEVEL4 (ub4)0x1000000 /* IMC memcomp */
#define KKPACFRAG_TEMPLATE_IMC_DUPLICATE1 (ub4)0x2000000 /* IMC duplicate */ 65536 mod 4
#define KKPACFRAG_TEMPLATE_IMC_DUPLICATE2 (ub4)0x4000000 /* IMC duplicate */
we div by 512, to put 'enable' at bit 0. The decimal numbers above are based on that!-->
<xsl:variable name="IMCsegflag" select="floor(FLAGS div 512)"/>
<xsl:variable name="Enabled" select="$IMCsegflag mod 2"/>
<xsl:variable name="Disabled" select="floor($IMCsegflag div 2) mod 2"/>
<xsl:variable name="MirrorMap" select="floor($IMCsegflag div 4) mod 2"/>
<xsl:variable name="Level1" select="floor($IMCsegflag div 8) mod 2"/>
<xsl:variable name="Preload" select="floor($IMCsegflag div 16) mod 2"/>
<xsl:variable name="MapBy12" select="floor($IMCsegflag div 32) mod 4"/>
<xsl:variable name="Level2" select="floor($IMCsegflag div 128) mod 2"/>
<xsl:variable name="Priority" select="floor($IMCsegflag div 256) mod 32"/>
<xsl:variable name="Level34" select="floor($IMCsegflag div 16384) mod 4"/>
<!-- storage is allocated, params are in SEG$ - aka the STORAGE element. -->
<xsl:call-template name="DoInMemory">
<xsl:with-param name="InMemory">
<xsl:choose>
<xsl:when test="$Enabled=1">
<xsl:text>1</xsl:text>
</xsl:when>
<xsl:when test="$Disabled=1">
<xsl:text>2</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:text>0</xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:with-param>
<xsl:with-param name="Priority">
<xsl:choose>
<xsl:when test="$Preload=1">
<!-- above test 'PRELOAD'=1, then we decode the 5 bits of priority-->
<xsl:choose>
<xsl:when test="$Priority=1">
<xsl:text>0</xsl:text>
</xsl:when>
<xsl:when test="$Priority=2">
<xsl:text>1</xsl:text>
</xsl:when>
<xsl:when test="$Priority=4">
<xsl:text>2</xsl:text>
</xsl:when>
<xsl:when test="$Priority=8">
<xsl:text>4</xsl:text>
</xsl:when>
<xsl:when test="$Priority=16">
<xsl:text>6</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:text>5</xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:when test="$Preload=0 and $Priority=0">
<xsl:text>7</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:text>0</xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:with-param>
<xsl:with-param name="Compression" select="($Level34*4)+($Level2*2)+$Level1"/>
<xsl:with-param name="Distribute" select="($MapBy12*2)+$MirrorMap"/>
<xsl:with-param name="Duplicate" select="floor($IMCsegflag div 65536) mod 4"/>
<xsl:with-param name="ServiceName">
<xsl:if test="SVCFLAGS">
<xsl:choose>
<xsl:when test="SVCFLAGS=1">
<xsl:text>DEFAULT</xsl:text>
</xsl:when>
<xsl:when test="SVCFLAGS=2">
<xsl:text>NONE</xsl:text>
</xsl:when>
<xsl:when test="SVCFLAGS=3">
<xsl:text>ALL</xsl:text>
</xsl:when>
<xsl:when test="SVCFLAGS=4">
<xsl:value-of select="SVCNAME"/>
</xsl:when>
</xsl:choose>
</xsl:if>
</xsl:with-param>
</xsl:call-template>
<xsl:apply-templates select="TS_NAME"/>
<xsl:apply-templates select="TLOBS/TLOBS_ITEM"/>
<!--Check for read-only subpartition-->
<xsl:if test="(FLAGS mod (134217728*2)) >= 134217728">
<xsl:text> READ ONLY </xsl:text>
</xsl:if>
<!--Check for read write subpartition-->
<xsl:if test="(FLAGS mod (268435456*2)) >= 268435456">
<xsl:text> READ WRITE </xsl:text>
</xsl:if>
<!-- Check subpartition template for an explicit segment creation option (immediate
or deferred).
Relevant bits in subpartion template (defsubpart$.flags from kkpac.h):
#define KKPACFRAG_TEMPLATE_SEG_CRT_DEFERRED (ub8)0x400000000 /* SEGMENT CRTN DEFERRED */
#define KKPACFRAG_TEMPLATE_SEG_CRT_IMMEDIATE (ub8)0x800000000 /* SEGMENT CRTN IMMEDIATE */
-->
<xsl:if test="$VERSION>=1202000000">
<xsl:if test="(FLAGS2 and (FLAGS2 mod (8*2)) >= 8) or
(FLAGS mod (34359738368*2)) >= 34359738368">
<xsl:text> SEGMENT CREATION IMMEDIATE </xsl:text>
</xsl:if>
<xsl:if test="(FLAGS2 and (FLAGS2 mod (4*2)) >= 4) or
(FLAGS mod (17179869184*2)) >= 17179869184">
<xsl:text> SEGMENT CREATION DEFERRED </xsl:text>
</xsl:if>
</xsl:if>
<xsl:if test="position()=last()">
<xsl:text> ) </xsl:text>
</xsl:if>
</xsl:for-each>
</xsl:template>
<xsl:template name="DoPartLists">
<xsl:param name="ADT_type">TABLE</xsl:param>
<xsl:param name="PIOT">0</xsl:param>
<xsl:param name="PartobjNode" select="''"/>
<xsl:param name="Parttype">0</xsl:param>
<xsl:param name="Subparttype">0</xsl:param>
<xsl:param name="Local">0</xsl:param>
<xsl:param name="ParentNode" select="''"/>
<xsl:param name="TableNode" select="''"/>
<xsl:param name="Pctspace">100</xsl:param>
<xsl:param name="PartCompress" select="false()"/>
<!-- *******************************************************************
Template: DoPartLists
Dispatch to processing for PART_LIST or COMPART_LIST
Parameters:
ADT_type - TABLE = tables
INDEX = PIOTs
CLUSTER = cluster
PIOT - 1 = PIOT, 0 = not PIOT
PartobjNode: PARTOBJ node
Parttype - 1 = range
2 = hash
3 = system
Subparttype - 1 = range
2 = hash
3 = system
4 = list
Local 1 = local index (sys.partobj$.flags)
ParentNode - the parent of the PARTOBJ node, usually PART_OBJ
TableNode - the TABLE_T node if ADT_TYPE = table
Pctspace: percentage by which space allocation is to be modified
defaults to 100 (no modification)
PartCompress: TRUE = compress partition (for index partitions)
defaults to FALSE
******************************************************************** -->
<!-- one of these templates should match -->
<xsl:apply-templates select="$ParentNode/PART_LIST">
<xsl:with-param name="ADT_type" select="$ADT_type"/>
<xsl:with-param name="PIOT" select="$PIOT"/>
<xsl:with-param name="PartobjNode" select="$PartobjNode"/>
<xsl:with-param name="Parttype" select="$Parttype"/>
<xsl:with-param name="Subparttype" select="$Subparttype"/>
<xsl:with-param name="Local" select="$Local"/>
<xsl:with-param name="Pctspace" select="$Pctspace"/>
<xsl:with-param name="PartCompress" select="$PartCompress"/>
<xsl:with-param name="TableNode" select="$TableNode"/>
</xsl:apply-templates>
<xsl:apply-templates select="$ParentNode/COMPART_LIST">
<xsl:with-param name="ADT_type" select="$ADT_type"/>
<xsl:with-param name="PIOT" select="$PIOT"/>
<xsl:with-param name="PartobjNode" select="$PartobjNode"/>
<xsl:with-param name="Parttype" select="$Parttype"/>
<xsl:with-param name="Subparttype" select="$Subparttype"/>
<xsl:with-param name="Local" select="$Local"/>
<xsl:with-param name="UseDef">1</xsl:with-param>
<xsl:with-param name="Pctspace" select="$Pctspace"/>
<xsl:with-param name="TableNode" select="$TableNode"/>
</xsl:apply-templates>
</xsl:template>
<xsl:template match="PART_LIST | COMPART_LIST | SUBPARTS">
<xsl:param name="ADT_type">TABLE</xsl:param>
<xsl:param name="PIOT">0</xsl:param>
<xsl:param name="PartobjNode" select="''"/>
<xsl:param name="Parttype">0</xsl:param>
<xsl:param name="Subparttype">0</xsl:param>
<xsl:param name="Local">0</xsl:param>
<xsl:param name="UseDef">0</xsl:param>
<xsl:param name="Subpartition">0</xsl:param>
<xsl:param name="Pctspace">100</xsl:param>
<xsl:param name="PartCompress" select="false()"/>
<xsl:param name="TableNode" select="''"/>
<!-- *******************************************************************
Template: PART_LIST | COMPART_LIST | SUBPARTS
List each [SUB]PARTITION clause
Parameters:
ADT_type - TABLE = tables
INDEX = PIOTs and indexes
CLUSTER = cluster
PIOT - 1 = PIOT, 0 = not PIOT
Parttype - 1 = range
2 = hash
3 = system
Subparttype - 1 = range
2 = hash
3 = system
4 = list
Local 1 = local index (sys.partobj$.flags)
UseDef 1 = use default (partition-level) attributes
in composite partition
Subpartition 1 = this is a subpartition (0 = it isn't)
Pctspace: percentage by which space allocation is to be modified
defaults to 100 (no modification)
PartCompress: TRUE = compress partition (for index partitions)
defaults to FALSE
TableNode - the TABLE_T node if ADT_TYPE = table
******************************************************************** -->
<!-- if this is an interval partitioned table and EXPORT=0,
then skip partitions in the interval section, i.e., return
the DDL as the user entered it
also skip partitions that are hidden for online move
tabpart$.flags bit 0x800000 (8388608)
-->
<xsl:variable name="Parts" select="PART_LIST_ITEM[(32768>(FLAGS mod 65536) or $EXPORT=1 or
$INCLUDE_PARTITIONS='ALL')
and 8388608 > (FLAGS mod 16777216)]"/>
<xsl:variable name="Comparts" select="COMPART_LIST_ITEM[(32768>(FLAGS mod 65536) or $EXPORT=1 or
$INCLUDE_PARTITIONS='ALL')
and 8388608 > (FLAGS mod 16777216)]"/>
<xsl:variable name="Subparts" select="SUBPARTS_ITEM[(32768>(FLAGS mod 65536) or $EXPORT=1 or
$INCLUDE_PARTITIONS='ALL')
and 8388608 > (FLAGS mod 16777216)]"/>
<xsl:for-each select="$Parts | $Comparts | $Subparts">
<!-- emit the initial open paren -->
<xsl:if test="position()=1">
<xsl:if test="$PRETTY=1">
<xsl:text>
</xsl:text>
</xsl:if>
<xsl:text> (</xsl:text>
</xsl:if>
<xsl:call-template name="DoPartListItem">
<xsl:with-param name="ADT_type" select="$ADT_type"/>
<xsl:with-param name="PIOT" select="$PIOT"/>
<xsl:with-param name="PartobjNode" select="$PartobjNode"/>
<xsl:with-param name="Parttype" select="$Parttype"/>
<xsl:with-param name="Subparttype" select="$Subparttype"/>
<xsl:with-param name="Local" select="$Local"/>
<xsl:with-param name="UseDef" select="$UseDef"/>
<xsl:with-param name="Subpartition" select="$Subpartition"/>
<xsl:with-param name="Pctspace" select="$Pctspace"/>
<xsl:with-param name="PartCompress" select="$PartCompress"/>
<xsl:with-param name="TableNode" select="$TableNode"/>
</xsl:call-template>
<!--
Put out a comma / LF if not the last partition
-->
<xsl:choose>
<xsl:when test="not(position()=last())">
<xsl:text>, </xsl:text>
<xsl:if test="$PRETTY=1">
<xsl:text>
 </xsl:text>
</xsl:if>
</xsl:when>
<xsl:otherwise>) </xsl:otherwise>
</xsl:choose>
</xsl:for-each>
</xsl:template>
<!-- *******************************************************************
Template: DoPartMemoptimize: emit memoptimize at partition level
for a partitioned table
Parameters:
PartNode: partition node PART_LIST_ITEM
******************************************************************** -->
<xsl:template name="DoPartMemoptimize">
<xsl:param name="PartNode" select="''"/>
<xsl:variable name="flagMemoptRead">1073741824</xsl:variable>
<xsl:variable name="flagMemoptWrite">2147483648</xsl:variable>
<xsl:call-template name="DoMemoptimizeSyntax">
<xsl:with-param name="isMemoptRead" select="($PartNode/FLAGS mod ($flagMemoptRead*2)>=$flagMemoptRead)"/>
<xsl:with-param name="isMemoptWrite" select="($PartNode/FLAGS mod ($flagMemoptWrite*2)>=$flagMemoptWrite)"/>
</xsl:call-template>
</xsl:template>
<!-- *******************************************************************
Template: DoPartCellMemory: emit cellmemory at partition level
for a partitioned table
Parameters:
TableNode: TABLE_T
PartNode: partition node PART_LIST_ITEM
******************************************************************** -->
<xsl:template name="DoPartCellMemory">
<xsl:param name="TableNode" select="''"/>
<xsl:param name="PartNode" select="''"/>
<xsl:choose>
<xsl:when test="$PartNode/DEFERRED_STG">
<xsl:variable name="CMCompress" select="$PartNode/DEFERRED_STG/CCFLAG_STG"/>
<!-- 8194 - CELLMEMORY enabled
8196 - MEMCOMPRESS FOR QUERY
8200 - MEMCOMPRESS FOR CAPACITY
16384 - NO CELLMEMORY -->
<xsl:variable name="flagNoCMemory">16384</xsl:variable>
<xsl:variable name="flagCMemory">8192</xsl:variable>
<xsl:variable name="flagCMCompressQuery">4</xsl:variable>
<xsl:variable name="flagCMCompressCapacity">8</xsl:variable>
<xsl:variable name="isCMemory" select="($CMCompress mod ($flagCMemory*2)>=$flagCMemory)"/>
<xsl:call-template name="DoCMemoryCompressSyntax">
<xsl:with-param name="isNoCMemory" select="($CMCompress mod ($flagNoCMemory*2)>=$flagNoCMemory)"/>
<xsl:with-param name="isCMemory" select="$isCMemory"/>
<xsl:with-param name="isCMCompressQuery" select="$isCMemory and ($CMCompress mod ($flagCMCompressQuery*2)>=4)"/>
<xsl:with-param name="isCMCompressCapacity" select="$isCMemory and ($CMCompress mod ($flagCMCompressCapacity*2)>=8)"/>
</xsl:call-template>
</xsl:when>
<xsl:when test="$PartNode/STORAGE">
<xsl:variable name="CMCompress" select="$PartNode/STORAGE/FLAGS"/>
<!-- 281474976710656 - NO CELLMEMORY
140737488355328 - CELLMEMORY Enabled
1125899906842624 - MEMCOMPRESS FOR QUERY
2251799813685248 - MEMCOMPRESS FOR CAPACITY
-->
<xsl:variable name="flagNoCMemory">281474976710656</xsl:variable>
<xsl:variable name="flagCMemory">140737488355328</xsl:variable>
<xsl:variable name="flagCMCompressQuery">1125899906842624</xsl:variable>
<xsl:variable name="flagCMCompressCapacity">2251799813685248</xsl:variable>
<xsl:variable name="isCMemory" select="($CMCompress mod ($flagCMemory*2)>=$flagCMemory)"/>
<xsl:call-template name="DoCMemoryCompressSyntax">
<xsl:with-param name="isNoCMemory" select="($CMCompress mod ($flagNoCMemory*2)>=$flagNoCMemory)"/>
<xsl:with-param name="isCMemory" select="$isCMemory"/>
<xsl:with-param name="isCMCompressQuery" select="$isCMemory and ($CMCompress mod ($flagCMCompressQuery*2)>=$flagCMCompressQuery)"/>
<xsl:with-param name="isCMCompressCapacity" select="$isCMemory and ($CMCompress mod ($flagCMCompressCapacity*2)>=$flagCMCompressCapacity)"/>
</xsl:call-template>
</xsl:when>
<xsl:when test="$PartNode/SPARE2">
<xsl:variable name="CMCompress" select="$PartNode/SPARE2"/>
<!-- SPARE2 bits. These were gleaned (not copied directly) from cdpart.sql
8589934592 0x0200000000 'DISABLED',
4294967296 0x0100000000 'MEMCOMPRESS',
34359738368 0x0800000000 'MEMCOMPRESS FOR QUERY',
68719476736 0x1000000000 'MEMCOMPRESS FOR CAPACITY',
-->
<xsl:variable name="flagNoCMemory">8589934592</xsl:variable>
<xsl:variable name="flagCMemory">4294967296</xsl:variable>
<xsl:variable name="flagCMCompressQuery">34359738368</xsl:variable>
<xsl:variable name="flagCMCompressCapacity">68719476736</xsl:variable>
<xsl:variable name="isCMemory" select="($CMCompress mod ($flagCMemory*2))>=$flagCMemory"/>
<xsl:call-template name="DoCMemoryCompressSyntax">
<xsl:with-param name="isNoCMemory" select="($CMCompress mod ($flagNoCMemory*2))>=$flagNoCMemory"/>
<xsl:with-param name="isCMemory" select="$isCMemory"/>
<xsl:with-param name="isCMCompressQuery" select="$isCMemory and ($CMCompress mod ($flagCMCompressQuery*2))>=$flagCMCompressQuery"/>
<xsl:with-param name="isCMCompressCapacity" select="$isCMemory and ($CMCompress mod ($flagCMCompressCapacity*2))>=$flagCMCompressCapacity"/>
</xsl:call-template>
</xsl:when>
</xsl:choose>
</xsl:template>
<xsl:template name="DeferredSegmentCreationClause">
<xsl:param name="TableNode" select="''"/>
<xsl:param name="PartNode" select="''"/>
<xsl:param name="isXMLType" select="'0'"/>
<!-- *******************************************************************
Template: DeferredSegmentCreationClause: Optionally emit the
deferred segment creation clause
Parameters:
TableNode: TABLE_T
PartNode: partition or subpartition node (PART_LIST_ITEM or SUBPARTS_ITEM)
******************************************************************** -->
<!-- SEGMENT CREATION syntax is new in 11.2;
not valid for *IOTs
*clustered tables
*temporary tables
typed tables
AQ tables
*external tables
tables owned by SYS, SYSTEM, PUBLIC, OUTLN, XDB
(* = case already excluded)
12.2 added deferred segment support for IOTs, xmltype and objtype tables.
-->
<xsl:if test="$SEGMENT_CREATION=1 and $VERSION>=1102000000
and local-name($TableNode)='TABLE_T'
and $TableNode/SCHEMA_OBJ/OWNER_NAME!='SYS'
and $TableNode/SCHEMA_OBJ/OWNER_NAME!='SYSTEM'
and $TableNode/SCHEMA_OBJ/OWNER_NAME!='PUBLIC'
and $TableNode/SCHEMA_OBJ/OWNER_NAME!='OUTLN'
and $TableNode/SCHEMA_OBJ/OWNER_NAME!='XDB'">
<xsl:choose>
<xsl:when test="($TableNode/PROPERTY mod 64)<32">
<!-- see admin/dcore.bsq for tab$.property bit defs.
The following tables are only supported in 12.2:
Type tables Property 0x00001
AQ tables Property 0x20000
-->
<xsl:if test="$VERSION>=1202000000 or
((($TableNode/PROPERTY) mod 2)=0 and
not ((($TableNode/PROPERTY) mod 262144)>=131072))">
<!-- non-partitioned table -->
<xsl:if test="$isXMLType=1">
<xsl:text>
 </xsl:text>
</xsl:if>
<xsl:text>SEGMENT CREATION </xsl:text>
<xsl:choose>
<xsl:when test="($TableNode/PROPERTY2 mod 8)>=4 or $SHARD_TABLESPACE!=''">DEFERRED </xsl:when>
<xsl:otherwise>IMMEDIATE </xsl:otherwise>
</xsl:choose>
<xsl:if test="$PRETTY='1' and $isXMLType=0 and $SEGMENT_ATTRIBUTES=1">
<xsl:text>
 </xsl:text>
</xsl:if>
</xsl:if>
</xsl:when>
<xsl:when test="string-length($PartNode)=0">
<!-- table-level setting of partitioned table -->
<xsl:choose>
<xsl:when test="($TableNode/PART_OBJ/PARTOBJ/FLAGS mod 4096)>=2048 or
($TableNode/PART_OBJ/TABPARTOBJ/FLAGS mod 4096)>=2048">
<xsl:text>SEGMENT CREATION DEFERRED </xsl:text>
<xsl:if test="$PRETTY=1">
<xsl:text>
 </xsl:text>
</xsl:if>
</xsl:when>
<xsl:when test="($TableNode/PART_OBJ/PARTOBJ/FLAGS mod 8192)>=4096 or
($TableNode/PART_OBJ/TABPARTOBJ/FLAGS mod 8192)>=4096">
<xsl:text>SEGMENT CREATION IMMEDIATE </xsl:text>
<xsl:if test="$PRETTY=1">
<xsl:text>
 </xsl:text>
</xsl:if>
</xsl:when>
</xsl:choose>
</xsl:when>
<xsl:when test="local-name($PartNode)='COMPART_LIST_ITEM'">
<!-- composite partition setting -->
<xsl:choose>
<xsl:when test="(($PartNode/SPARE2) mod 512)>=256">
<xsl:text>SEGMENT CREATION DEFERRED </xsl:text>
</xsl:when>
<xsl:when test="(($PartNode/SPARE2) mod 1024)>=512">
<xsl:text>SEGMENT CREATION IMMEDIATE </xsl:text>
</xsl:when>
</xsl:choose>
</xsl:when>
<xsl:otherwise>
<!-- partition leaf setting -->
<xsl:choose>
<xsl:when test="DEFERRED_STG">
<xsl:text>SEGMENT CREATION DEFERRED </xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:text>SEGMENT CREATION IMMEDIATE </xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:otherwise>
</xsl:choose>
</xsl:if>
</xsl:template>
<xsl:template name="DoPartListItem">
<xsl:param name="ADT_type">TABLE</xsl:param>
<xsl:param name="PIOT">0</xsl:param>
<xsl:param name="PartobjNode" select="''"/>
<xsl:param name="Parttype">0</xsl:param>
<xsl:param name="Subparttype">0</xsl:param>
<xsl:param name="Local">0</xsl:param>
<xsl:param name="UseDef">0</xsl:param>
<xsl:param name="Subpartition">0</xsl:param>
<xsl:param name="Pctspace">100</xsl:param>
<xsl:param name="PartCompress" select="false()"/>
<xsl:param name="TableNode" select="''"/>
<!-- Determine whether this is a transportable mode convert.
See kutable.xsl for more details.
-->
<xsl:variable name="TransportObject">
<xsl:choose>
<xsl:when test="$TRANSPORTABLE = 0">0</xsl:when>
<xsl:when test="$TRANSPORTABLE = 1">1</xsl:when>
<xsl:when test='$TRANSPORTABLE = 2 and .//TRANSPORTABLE="1"'>1</xsl:when>
<xsl:otherwise>0</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<!-- *******************************************************************
Template: DoPartListItem
Parameters: (see above)
******************************************************************** -->
<!--
[SUB]PARTITION name VALUES
-->
<xsl:choose>
<xsl:when test="$Subpartition=0">PARTITION "</xsl:when>
<xsl:otherwise> SUBPARTITION "</xsl:otherwise>
</xsl:choose>
<xsl:value-of select="SCHEMA_OBJ/SUBNAME"/>
<xsl:text>" </xsl:text>
<xsl:if test="$Parttype=1 and $Local=0">
<xsl:text> VALUES LESS THAN (</xsl:text>
<xsl:value-of select="HIBOUNDVAL"/>
<xsl:value-of select="HIBOUNDVALC"/>
<xsl:text>) </xsl:text>
</xsl:if>
<!-- Put out values clause for partition by list ($Parttype=4) for both
tables and PIOT's. Note that $ADT_type='INDEX' and $PIOT=1 for a
PIOT. -->
<xsl:if test="$Parttype=4 and ($ADT_type ='TABLE' or ($ADT_type='INDEX'
and $PIOT=1) or $ADT_type='MATERIALIZED_VIEW_LOG')">
<xsl:text> VALUES (</xsl:text>
<xsl:value-of select="HIBOUNDVAL"/>
<xsl:value-of select="HIBOUNDVALC"/>
<xsl:text>) </xsl:text>
</xsl:if>
<!-- if this is an index and we are not forced to use an alter,
and the index is local partitioned, and it's unusable, make
the partition unusable inline. -->
<xsl:if test="($ADT_type='INDEX') and
($ALTER_INDEX_PART_UNUSABLE=0) and
(ancestor::INDEX_T/PART_OBJ/PARTOBJ/FLAGS mod 2)=1 and
(FLAGS mod 2)=1">
<xsl:text> UNUSABLE </xsl:text>
</xsl:if>
<!-- The TRANSITION clause identifies the last customer defined
partition so that when this DDL is executed as part of import,
SQL will be able to properly mark which partitions are user
defined and which are system generated when this table gets
created. The partitioning syntax on a CREATE TABLE looks like
all specified partitions are 'user defined', but in import's
case some of these are system generated and we need a way to
tell this to the target db. Bug 22097063: do not output
TRANSITION clause for a local index that is subpartitioned
by interval range. -->
<xsl:if test="$Subpartition=0 and $EXPORT=1 and $VERSION>=1202000000 and ./SUBPARTS/SUBPARTS_ITEM[(FLAGS mod 65536)>=32768] and not ($Local=1 and $ADT_type='INDEX' and $PIOT=0 and $PartobjNode/SUBINTERVAL_STR and string-length($PartobjNode/SUBINTERVAL_STR)>0)">
<xsl:for-each select="./SUBPARTS/SUBPARTS_ITEM[32768>(FLAGS mod 65536)]">
<xsl:if test="position()=last()">
<xsl:text>TRANSITION ("</xsl:text>
<xsl:value-of select="./SCHEMA_OBJ/SUBNAME"/>
<xsl:text>") </xsl:text>
</xsl:if>
</xsl:for-each>
</xsl:if>
<!-- in a compressed partitioned index BUG 4544267 -->
<!-- some partitions can be NOCOMPRESS -->
<xsl:if test="($ADT_type = 'INDEX')">
<xsl:choose>
<xsl:when test="($Parttype=1 or ($Subpartition = 0 and $VERSION >=1200000000) )
and string-length($Index_Compression_Clause) != 0">
<xsl:choose>
<xsl:when test="$Index_Compression_Clause = 'NONE'"/>
<xsl:otherwise>
<xsl:value-of select="$Index_Compression_Clause"/>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:when test="($Parttype=1)
and $PartCompress
and ((FLAGS mod 2048) < 1024)">
<xsl:text>NOCOMPRESS </xsl:text>
</xsl:when>
<!-- ADVANCED Index Compression
Salient bits/flags:
Index level attributes are indicated in ind$.flags
advanced high index compression: 0x40000000
advanced low index compression: 0x80000000
Deferred stg Partition flags are taken from deferred_stg.cmpflag_stg
advanced high: 2
advanced low: 4
Partition flags are taken from seg$.spare1
advanced high: 0x1000000
advanced low: 0x100000
Composite partition flags are taken from indcompart$.spare3
advanced high: 4
advanced low: 8
-->
<xsl:when test="($Subpartition = 0 and $VERSION >=1200000000 and
((STORAGE/FLAGS mod 2097152) >= 1048576 or
(DEFERRED_STG/CMPFLAG_STG mod 8) >=4))">
<xsl:text> COMPRESS ADVANCED LOW </xsl:text>
</xsl:when>
<xsl:when test="$Subpartition = 0 and $VERSION >=1200000000 and
((STORAGE/FLAGS mod 33554432) >= 16777216 or
(DEFERRED_STG/CMPFLAG_STG mod 4) >=2)">
<xsl:text> COMPRESS ADVANCED HIGH </xsl:text>
</xsl:when>
<xsl:when test="$Subpartition = 0 and $VERSION >=1200000000 and
(SPARE3 mod 8) >= 4">
<xsl:text> COMPRESS ADVANCED HIGH </xsl:text>
</xsl:when>
<xsl:when test="$Subpartition = 0 and $VERSION >=1200000000 and
(SPARE3 mod 16) >= 8">
<xsl:text> COMPRESS ADVANCED LOW </xsl:text>
</xsl:when>
<xsl:when test="$Subpartition = 0 and
(FLAGS mod 1024*2) >= 1024">
<xsl:text>DISABLE</xsl:text>
</xsl:when>
</xsl:choose>
</xsl:if>
<!-- Output the interval fragment number when these conditions are met:
import table operation, interval reference partition table, current
partition is an interval one, and version is 12 or greater -->
<xsl:if test="($ADT_type = 'TABLE') and ($EXPORT=1)
and ($Parttype=5) and (($PartobjNode/FLAGS mod 128) >=64)
and ((FLAGS mod 65536) >=32768)
and ($VERSION>=1200000000)">
<xsl:text> VALUES(INTERVAL FRAGMENT_NUMBER </xsl:text>
<xsl:value-of select="PHYPART_NUM - 2147483647"/>
<xsl:text>) </xsl:text>
</xsl:if>
<!-- In v12.2 partitions in external tables now potentially
have a default directory and location:
e.g., default directory dpump_dir location('tkexpetu_cp1sp1.dat')
-->
<xsl:if test="$VERSION >= 1202000000 and
(EXT_LOCATION/LOCATION/LOCATION_ITEM or (local-name(.) = 'COMPART_LIST_ITEM' and
EXT_LOCATION/DEFAULT_DIR))">
<xsl:if test="EXT_LOCATION/DEFAULT_DIR">
<xsl:text> 
 </xsl:text>
<xsl:text> DEFAULT DIRECTORY </xsl:text>
<xsl:call-template name="QuoteObject">
<xsl:with-param name="Object" select="EXT_LOCATION/DEFAULT_DIR"/>
<xsl:with-param name="TrailingBlank">0</xsl:with-param>
</xsl:call-template>
</xsl:if>
<xsl:call-template name="GenExtTableLoc">
<xsl:with-param name="Loc" select="EXT_LOCATION/LOCATION"/>
</xsl:call-template>
</xsl:if>
<!-- Process partition specific partial Indexing attributes.
SQL's default table level indexing is ON.
If default table level indexing is OFF or if the specific partition
indexing is OFF/[ON for composite partitions] then we need to generate
the indexing attribute for this partition.
note: for composite partitions the indexing attribs are tracked in
SPARE2. Otherwise they are tracked in FLAGS.
-->
<xsl:variable name="defIndexing" select="not(($PartobjNode/FLAGS mod 16384) >= 8192)"/>
<!-- define a variable for INDEXING attribute:
0 - INDEXING OFF
1 - INDEXING ON
3 - NONE (only applicable for composite partitions
-->
<xsl:variable name="partIndexing">
<xsl:choose>
<xsl:when test="(local-name(.)) = 'COMPART_LIST_ITEM'">
<!-- composite partitions use SPARE2 -->
<xsl:choose>
<xsl:when test="(SPARE2 mod (2048*2)) >= 2048">0</xsl:when>
<xsl:when test="(SPARE2 mod (1024*2)) >= 1024">1</xsl:when>
<xsl:otherwise>3</xsl:otherwise>
</xsl:choose>
</xsl:when>
<!-- Composite partition indexing while processing its sub-partitions -->
<xsl:when test="(local-name(.)) = 'SUBPARTS_ITEM' and ../../../COMPART_LIST_ITEM">
<!-- composite partitions use SPARE2 -->
<xsl:choose>
<xsl:when test="(../../SPARE2 mod (2048*2)) >= 2048">0</xsl:when>
<xsl:when test="(../../SPARE2 mod (1024*2)) >= 1024">1</xsl:when>
<xsl:when test="../../SPARE2=0">2</xsl:when>
<xsl:otherwise>3</xsl:otherwise>
</xsl:choose>
</xsl:when>
<!-- Partition indexing -->
<xsl:when test="(local-name(.)) = 'PART_LIST_ITEM'">
<xsl:choose>
<xsl:when test="(FLAGS mod 4194304) >= 2097152">0</xsl:when>
<xsl:otherwise>1</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:otherwise>3</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<!-- Sub-Partition indexing -->
<xsl:variable name="subPartIndexing">
<xsl:choose>
<xsl:when test="(local-name(.)) = 'SUBPARTS_ITEM'">
<xsl:choose>
<xsl:when test="(FLAGS mod 4194304) >= 2097152">0</xsl:when>
<xsl:otherwise>1</xsl:otherwise>
</xsl:choose>
</xsl:when>
</xsl:choose>
</xsl:variable>
<!-- Partition indexing of partition or sub-partition -->
<xsl:variable name="partialIndexing">
<xsl:choose>
<xsl:when test="($partIndexing=0 and $Subpartition = 0) or $subPartIndexing=0">0</xsl:when>
<xsl:when test="($partIndexing=1 and $Subpartition = 0) or $subPartIndexing=1">1</xsl:when>
<xsl:otherwise>3</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<!-- Partition indexing at parition or subpartition level
If object type is table and default indexing is not true
Partition indexing off and its not subpartition OR
Sub-Partition indexing off and ( Parition indexing off or None)
OR
Partition indexing on and its a composite partition
Sub-Partition indexing on and its partition indexing off -->
<xsl:if test="$ADT_type = 'TABLE' and (not($defIndexing) or
((($partIndexing = 0 and $Subpartition = 0) or
($subPartIndexing=0 and ($partIndexing=1 or $partIndexing=2))) or
(($partIndexing=1 and (local-name(.)) = 'COMPART_LIST_ITEM') or
($subPartIndexing=1 and $partIndexing=0))))">
<xsl:choose>
<xsl:when test="$partialIndexing = 0">
<xsl:text>INDEXING OFF </xsl:text>
</xsl:when>
<xsl:when test="$partialIndexing = 1">
<xsl:text>INDEXING ON </xsl:text>
</xsl:when>
</xsl:choose>
</xsl:if>
<!-- inmemory columnar - compress, load, map/mirror
INMEMORY is not supported for indexes or IOTs-->
<xsl:if test="$ADT_type != 'INDEX' and ($TableNode/PROPERTY mod 128) < 64">
<xsl:choose>
<xsl:when test="local-name(.)='COMPART_LIST_ITEM'">
<!-- if this is a composite partition, tabcompart$.spare2
has default InMemory for subpartitions
verified 4/14/2014 against usage in admin/cdpart.sql
compression and duplicate1/2 overlap.
v IMC_ENABLED (ub4) 0x10000 /* IMC specified */ 65536
IMC_NOTENABLED (ub4) 0x20000 /* IMC specified not */ 131072
v IMC_MIRRORMAP (ub4) 0x40000 /* IMC mirror or map */ 262144
v IMC_LEVEL1 (ub4) 0x80000 /* IMC low or other */ 524288
v IMC_PRELOAD (ub4)0x100000/* IMC ondemand or preload */ 1048576
v IMC_MAPBY1 (ub4)0x200000 /* IMC rowid or part */ 2097152
v IMC_MAPBY2 (ub4)0x400000 /* IMC part or subpart */ 4194304
v IMC_LEVEL2 (ub4)0x800000 /* IMC low or high */ 8388608
v IMC_LEVEL3 (ub4)0x1000000 /* IMC qry or cap */ 16777216
v IMC_DUPLICATE1 (ub4)0x4000000 /* IMC copies 1 */ 67108864
v IMC_DUPLICATE2 (ub4)0x8000000 /* IMC copies 1 */ 134217728
By observation: 0x01C000000 mask value
v IMC_PRI_NONE 0x000000000
v IMC_PRI_LOW 0x010000000 268435456
v IMC_PRI_MEDIUM 0x020000000
v IMC_PRI_HIGH 0x030000000
v IMC_PRI_CRITICAL 0x040000000
v IMC_PRI_UNSPECIFIED 0x050000000 (and preload bit is 0)
-->
<xsl:variable name="Enabled" select="floor(SPARE2 div 65536) mod 2"/>
<xsl:variable name="Disabled" select="floor(SPARE2 div 131072) mod 2"/>
<xsl:variable name="MirrorMap" select="floor(SPARE2 div 262144) mod 2"/>
<xsl:variable name="Level1" select="floor(SPARE2 div 524288) mod 2"/>
<xsl:variable name="Preload" select="floor(SPARE2 div 1048576) mod 2"/>
<xsl:variable name="MapBy12" select="floor(SPARE2 div 2097152) mod 4"/>
<xsl:variable name="Level234" select="floor(SPARE2 div 8388608) mod 8"/>
<!-- storage is allocated, params are in SEG$ - aka the STORAGE element. -->
<xsl:variable name="Priority" select="floor(SPARE2 div 268435456) mod 8"/>
<xsl:call-template name="DoInMemory">
<xsl:with-param name="InMemory">
<xsl:choose>
<xsl:when test="$Enabled = 1">
<xsl:text>1</xsl:text>
</xsl:when>
<xsl:when test="$Disabled = 1">
<xsl:text>2</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:text>0</xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:with-param>
<xsl:with-param name="Priority">
<xsl:choose>
<xsl:when test="$Preload=1">
<xsl:choose>
<xsl:when test="$Priority=0">
<xsl:text>0</xsl:text>
</xsl:when>
<xsl:when test="$Priority=1">
<xsl:text>1</xsl:text>
</xsl:when>
<xsl:when test="$Priority=2">
<xsl:text>2</xsl:text>
</xsl:when>
<xsl:when test="$Priority=3">
<xsl:text>4</xsl:text>
</xsl:when>
<xsl:when test="$Priority=4">
<xsl:text>6</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:text>5</xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:when test="$Preload=0">
<xsl:choose>
<xsl:when test="$Priority=5">
<xsl:text>7</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:text>0</xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
</xsl:choose>
</xsl:with-param>
<xsl:with-param name="Compression" select="($Level234*2)+$Level1"/>
<xsl:with-param name="Distribute" select="($MapBy12*2)+$MirrorMap"/>
<xsl:with-param name="Duplicate" select="floor(SPARE2 div 67108864) mod 4"/>
<xsl:with-param name="ServiceName">
<xsl:if test="SVCFLAGS">
<xsl:choose>
<xsl:when test="SVCFLAGS=1">
<xsl:text>DEFAULT</xsl:text>
</xsl:when>
<xsl:when test="SVCFLAGS=2">
<xsl:text>NONE</xsl:text>
</xsl:when>
<xsl:when test="SVCFLAGS=3">
<xsl:text>ALL</xsl:text>
</xsl:when>
<xsl:when test="SVCFLAGS=4">
<xsl:value-of select="SVCNAME"/>
</xsl:when>
</xsl:choose>
</xsl:if>
</xsl:with-param>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<!--.from DEFERRED_STG/IMCFLAG_STG or STORAGE/FLAGS -->
<xsl:call-template name="DoSegInMemory">
<xsl:with-param name="Root" select="current()"/>
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
</xsl:if>
<!-- generate SEGMENT attributes (and/or compression)
if compression clause or segment attributes is set and
if this is not an EXTERNAL TABLE) -->
<xsl:if test="(string-length($Table_Compression_Clause)!=0 or
$SEGMENT_ATTRIBUTES=1) and
not($ADT_type='TABLE' and $TableNode/PROPERTY >= 2147483648)">
<!-- segment creation deferred/immediate is not valid for subpartitions
in versions earlier than 12.2 -->
<xsl:if test="$Subpartition=0 or $VERSION>=1202000000">
<xsl:if test="$ADT_type='TABLE' or $PIOT=1">
<xsl:call-template name="DeferredSegmentCreationClause">
<xsl:with-param name="TableNode" select="$TableNode"/>
<xsl:with-param name="PartNode" select="."/>
</xsl:call-template>
<xsl:call-template name="DoPartCellMemory">
<xsl:with-param name="TableNode" select="$TableNode"/>
<xsl:with-param name="PartNode" select="."/>
</xsl:call-template>
</xsl:if>
</xsl:if>
<xsl:variable name="flagMemoptRead">1073741824</xsl:variable>
<xsl:variable name="flagMemoptWrite">2147483648</xsl:variable>
<xsl:call-template name="DoMemoptimizeSyntax">
<xsl:with-param name="isMemoptRead" select="(FLAGS mod ($flagMemoptRead*2)>=$flagMemoptRead)"/>
<xsl:with-param name="isMemoptWrite" select="(FLAGS mod ($flagMemoptWrite*2)>=$flagMemoptWrite)"/>
</xsl:call-template>
<!--
partition segment attributes (PCTFREE, STORAGE, TABLESPACE, LOBS...)
-->
<xsl:call-template name="DoPartSegAttrs">
<xsl:with-param name="ADT_type" select="$ADT_type"/>
<xsl:with-param name="PIOT" select="$PIOT"/>
<xsl:with-param name="Local" select="$Local"/>
<xsl:with-param name="Parttype" select="$Parttype"/>
<xsl:with-param name="UseDef" select="$UseDef"/>
<xsl:with-param name="Subpartition" select="$Subpartition"/>
<xsl:with-param name="Pctspace" select="$Pctspace"/>
<xsl:with-param name="TransportObject" select="$TransportObject"/>
</xsl:call-template>
</xsl:if>
<!--
call this template recursively to list the subpartitions when
(1) transportable import
or
(2) Data Pump import of an interval partitioned table and this
partition is in the interval section
or
(3) the subpartitions don't match the template
(N.B. SMATCH_TPL is new in 11g, so we have to test for its presence)
-->
<!--Check for read-only subpartition-->
<xsl:if test="(SPARE2 mod (4096*2)) >= 4096">
<xsl:text> READ ONLY </xsl:text>
</xsl:if>
<!--Check for read write subpartition-->
<xsl:if test="(SPARE2 mod (8192*2)) >= 8192">
<xsl:text> READ WRITE </xsl:text>
</xsl:if>
<xsl:if test="$TransportObject=1 or $EXPORT=1 or $INCLUDE_PARTITIONS='ALL' or not (SMATCH_TPL and SMATCH_TPL=1)">
<xsl:apply-templates select="SUBPARTS">
<xsl:with-param name="ADT_type" select="$ADT_type"/>
<xsl:with-param name="PIOT" select="$PIOT"/>
<xsl:with-param name="PartobjNode" select="$PartobjNode"/>
<xsl:with-param name="Parttype" select="$Subparttype"/>
<xsl:with-param name="Local" select="$Local"/>
<xsl:with-param name="UseDef">0</xsl:with-param>
<xsl:with-param name="Subpartition">1</xsl:with-param>
<xsl:with-param name="Pctspace" select="$Pctspace"/>
<xsl:with-param name="TableNode" select="$TableNode"/>
</xsl:apply-templates>
</xsl:if>
<!--if table is partitioned and has a nested table column(s), generate nested table partition properties-->
<xsl:apply-templates select="NT">
<xsl:with-param name="Pctspace" select="$Pctspace"/>
<xsl:with-param name="Parttype" select="$Parttype"/>
<xsl:with-param name="ParentProperty" select="PROPERTY"/>
<xsl:with-param name="DoingTable">0</xsl:with-param>
</xsl:apply-templates>
<!--Check for read-only [sub]partition-->
<xsl:if test='name(.) != "COMPART_LIST_ITEM"'>
<xsl:choose>
<xsl:when test='$ADT_type="INDEX" and (TP_FLAGS mod (67108864*2)) >= 67108864'>
<xsl:text> READ ONLY </xsl:text>
</xsl:when>
<xsl:when test='$ADT_type="TABLE" and (FLAGS mod (67108864*2)) >= 67108864'>
<xsl:text> READ ONLY </xsl:text>
</xsl:when>
<xsl:when test='$EXPORT=1 and $ADT_type="TABLE" and $VERSION>=1202000000'>
<xsl:text> READ WRITE </xsl:text>
</xsl:when>
</xsl:choose>
</xsl:if>
</xsl:template>
<xsl:template name="DoPartSegAttrs">
<xsl:param name="ADT_type">TABLE</xsl:param>
<xsl:param name="PIOT">0</xsl:param>
<xsl:param name="Local">0</xsl:param>
<xsl:param name="Parttype">0</xsl:param>
<xsl:param name="UseDef">0</xsl:param>
<xsl:param name="Subpartition">0</xsl:param>
<xsl:param name="Pctspace">100</xsl:param>
<xsl:param name="TransportObject">0</xsl:param>
<!-- *******************************************************************
Template: DoPartSegAttrs
Emit segment attributes for partition or subpartition, including
LOB storage
PCT_FREE, etc.
storage
tablespace
compress
logging
OV lists - PIOT only
Parameters:
ADT_type - TABLE = tables
INDEX = PIOTs and indexes
CLUSTER = cluster
PIOT - 1 = PIOT, 0 = not PIOT
Local 1 = local index (sys.partobj$.flags)
Parttype - 1 = range
2 = hash
3 = system
UseDef 1 = use default (partition-level) attributes
in composite partition
Subpartition 1 = this is a subpartition (0 = it isn't)
Pctspace: percentage by which space allocation is to be modified
defaults to 100 (no modification)
******************************************************************** -->
<xsl:choose>
<!-- A. hash part'n or hash/list subpartition -->
<xsl:when test="$Parttype=2 or $Subpartition=1">
<!-- Bug:17382480 DoTabCompress is in two places because it would causes 90 logfiles diffs -->
<xsl:if test="$ADT_type='TABLE' and $TABLESPACE=0">
<!-- COMPRESS -->
<xsl:call-template name="DoTabCompress">
<xsl:with-param name="ADT_type" select="$ADT_type"/>
<xsl:with-param name="Subpartition" select="$Subpartition"/>
</xsl:call-template>
</xsl:if>
<xsl:apply-templates select="LOBS">
<xsl:with-param name="PartListItem" select="local-name()"/>
<xsl:with-param name="Parttype" select="$Parttype"/>
<xsl:with-param name="Subpartition" select="$Subpartition"/>
</xsl:apply-templates>
<xsl:choose>
<xsl:when test="$TransportObject=1">
<xsl:choose>
<xsl:when test="STORAGE">
<!-- bug 15963397: support deferred segment clause -->
<xsl:apply-templates select="STORAGE">
<xsl:with-param name="PARTITION">1</xsl:with-param>
<xsl:with-param name="BlkSize" select="../BLOCKSIZE | BLOCKSIZE"/>
<xsl:with-param name="Dataobjnum" select="SCHEMA_OBJ/DATAOBJ_NUM"/>
</xsl:apply-templates>
</xsl:when>
<xsl:when test="DEFERRED_STG">
<!-- bug 15955645: tablespace clause -->
<xsl:apply-templates select="TS_NAME"/>
</xsl:when>
<xsl:when test="$UseDef=1">
<xsl:apply-templates select="DEFTS_NAME"/>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates select="TS_NAME"/>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:when test="$UseDef=1">
<xsl:apply-templates select="DEFTS_NAME"/>
</xsl:when>
<xsl:when test="$Subpartition=1">
<xsl:choose>
<xsl:when test="STORAGE and $VERSION>=1202000000">
<xsl:apply-templates select="STORAGE">
<xsl:with-param name="PARTITION">0</xsl:with-param>
<xsl:with-param name="BlkSize" select="../BLOCKSIZE | BLOCKSIZE"/>
<xsl:with-param name="Dataobjnum" select="SCHEMA_OBJ/DATAOBJ_NUM"/>
<xsl:with-param name="Subpartition" select="$Subpartition"/>
</xsl:apply-templates>
</xsl:when>
<xsl:when test="DEFERRED_STG and $VERSION>=1202000000">
<xsl:call-template name="DoDeferredStg">
<xsl:with-param name="DeferredStg" select="DEFERRED_STG"/>
<xsl:with-param name="Pctspace" select="$PCTSPACE"/>
<xsl:with-param name="ADT_type" select="$ADT_type"/>
<xsl:with-param name="Partition">1</xsl:with-param>
<xsl:with-param name="doCompression">0</xsl:with-param>
<xsl:with-param name="doLogging">0</xsl:with-param>
<xsl:with-param name="IsSubpartition">1</xsl:with-param>
</xsl:call-template>
<xsl:apply-templates select="TS_NAME"/>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates select="TS_NAME"/>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates select="TS_NAME"/>
</xsl:otherwise>
</xsl:choose>
<!-- Bug:17382480 DoTabCompress is in two places because it would causes 90 logfiles diff -->
<xsl:if test="$ADT_type='TABLE' and $TABLESPACE=1">
<!-- COMPRESS -->
<xsl:call-template name="DoTabCompress">
<xsl:with-param name="ADT_type" select="$ADT_type"/>
<xsl:with-param name="Subpartition" select="$Subpartition"/>
</xsl:call-template>
</xsl:if>
<xsl:if test="$PIOT=1 and $TransportObject =1">
<xsl:call-template name="DoIOVList">
<xsl:with-param name="List" select="../../IOV_LIST"/>
<xsl:with-param name="PNUM" select="PART_NUM"/>
<xsl:with-param name="Pctspace" select="$Pctspace"/>
</xsl:call-template>
<xsl:call-template name="DoIMAPList">
<xsl:with-param name="List" select="../../IMAP_LIST"/>
<xsl:with-param name="PNUM" select="PART_NUM"/>
<xsl:with-param name="Pctspace" select="$Pctspace"/>
</xsl:call-template>
</xsl:if>
</xsl:when>
<!-- B. default (partition-level) attibutes in composite partition -->
<xsl:when test="$UseDef=1">
<xsl:if test="$PRETTY=1 and $SEGMENT_ATTRIBUTES=1">
<xsl:text>
</xsl:text>
</xsl:if>
<xsl:apply-templates select="DEFPCTFREE">
<xsl:with-param name="ADT_type" select="$ADT_type"/>
</xsl:apply-templates>
<xsl:call-template name="DoDefStorage">
<xsl:with-param name="Node" select="."/>
<xsl:with-param name="BlkSize" select="../../../BLOCKSIZE | BLOCKSIZE"/>
<xsl:with-param name="Pctspace" select="$Pctspace"/>
</xsl:call-template>
<xsl:apply-templates select="DEFTS_NAME"/>
<xsl:if test="$ADT_type='TABLE'">
<!-- COMPRESS -->
<xsl:call-template name="DoTabCompress">
<xsl:with-param name="ADT_type" select="$ADT_type"/>
</xsl:call-template>
</xsl:if>
<xsl:apply-templates select="DEFLOGGING"/>
<xsl:apply-templates select="LOBS">
<xsl:with-param name="PartListItem" select="local-name()"/>
<xsl:with-param name="Parttype" select="$Parttype"/>
<xsl:with-param name="Subpartition" select="$Subpartition"/>
</xsl:apply-templates>
</xsl:when>
<!-- C. range or list partition -->
<xsl:otherwise>
<xsl:if test="$PRETTY=1">
<xsl:text>
 </xsl:text>
</xsl:if>
<xsl:apply-templates select="PCT_FREE">
<xsl:with-param name="ADT_type" select="$ADT_type"/>
<xsl:with-param name="PartFlag">1</xsl:with-param>
</xsl:apply-templates>
<xsl:choose>
<xsl:when test="DEFERRED_STG">
<!-- DoDeferredStg also does compress and logging -->
<xsl:call-template name="DoDeferredStg">
<xsl:with-param name="DeferredStg" select="DEFERRED_STG"/>
<xsl:with-param name="Pctspace" select="$PCTSPACE"/>
<xsl:with-param name="ADT_type" select="$ADT_type"/>
<xsl:with-param name="Partition">1</xsl:with-param>
</xsl:call-template>
<xsl:if test="$TABLESPACE=1">
<xsl:apply-templates select="TS_NAME"/>
</xsl:if>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="DoTabCompress">
<xsl:with-param name="ADT_type" select="$ADT_type"/>
</xsl:call-template>
<xsl:call-template name="DoAllLogging">
<xsl:with-param name="FlagsNode" select="FLAGS"/>
<xsl:with-param name="ADT_type" select="$ADT_type"/>
<xsl:with-param name="Partition">1</xsl:with-param>
</xsl:call-template>
<xsl:apply-templates select="STORAGE">
<xsl:with-param name="PARTITION">1</xsl:with-param>
<xsl:with-param name="BlkSize" select="../BLOCKSIZE | BLOCKSIZE"/>
<xsl:with-param name="Dataobjnum" select="SCHEMA_OBJ/DATAOBJ_NUM"/>
<xsl:with-param name="Pctspace" select="$Pctspace"/>
</xsl:apply-templates>
</xsl:otherwise>
</xsl:choose>
<xsl:apply-templates select="LOBS">
<xsl:with-param name="PartListItem" select="local-name()"/>
<xsl:with-param name="Parttype" select="$Parttype"/>
<xsl:with-param name="Subpartition" select="$Subpartition"/>
</xsl:apply-templates>
<xsl:if test="$PIOT=1">
<xsl:call-template name="DoIOVList">
<xsl:with-param name="List" select="../../IOV_LIST"/>
<xsl:with-param name="PNUM" select="PART_NUM"/>
<xsl:with-param name="Pctspace" select="$Pctspace"/>
</xsl:call-template>
<xsl:if test="$TransportObject =1">
<xsl:call-template name="DoIMAPList">
<xsl:with-param name="List" select="../../IMAP_LIST"/>
<xsl:with-param name="PNUM" select="PART_NUM"/>
<xsl:with-param name="Pctspace" select="$Pctspace"/>
</xsl:call-template>
</xsl:if>
</xsl:if>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template name="DoTabCompress">
<xsl:param name="ADT_type">TABLE</xsl:param>
<xsl:param name="Subpartition">0</xsl:param>
<!-- *******************************************************************
Template: DoTabCompress - handle the 3 table compress cases:
DEFERRED_STG
partitioned object default
non-partition or leaf
Parameters:
ADT_type - TABLE = tables
INDEX = PIOTs and indexes
******************************************************************** -->
<xsl:choose>
<xsl:when test="$ADT_type!='TABLE'"/>
<xsl:when test="DEFERRED_STG">
<xsl:call-template name="DoDeferredCompress">
<xsl:with-param name="DeferredStg" select="DEFERRED_STG"/>
<xsl:with-param name="ADT_type" select="$ADT_type"/>
</xsl:call-template>
</xsl:when>
<!-- If there are compression attributes set or compress has been requested
with the TABLE_COMPRESSION_CLAUSE parameter call DoPartOBJCompress
-->
<xsl:when test="SPARE2 or string-length($Table_Compression_Clause) != 0">
<!-- exists if table is subpartitioned
tabcompart$.spare2
byte 0: compression attribute of the partition
0-NONE(UNSPECIFIED), 1-COMPRESS 2-NOCOMPRESS
(for other values see DoPartOBJCompress in kustorag.xsl)
note: explicitly take the compression related SPARE2 bits
because it can also contain partial indexing flags.
-->
<xsl:call-template name="DoPartOBJCompress">
<xsl:with-param name="Compress" select="(SPARE2 mod 1024)"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<!-- For leaf partition -->
<!-- Exclude compress generation for MV log -->
<xsl:if test="$ADT_type!='MATERIALIZED_VIEW_LOG'">
<xsl:call-template name="DoSegCompress">
<xsl:with-param name="Compress" select="STORAGE/FLAGS"/>
<xsl:with-param name="Subpartition" select="$Subpartition"/>
</xsl:call-template>
</xsl:if>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template name="DoIOVList">
<xsl:param name="List" select="''"/>
<xsl:param name="PNUM">0</xsl:param>
<xsl:param name="Pctspace">100</xsl:param>
<!-- *******************************************************************
Template: DoIOVList - Emit OVERFLOW for partition number PNUM
Parameters:
List - parent of IOV_LIST_ITEM
PNUM - partition number
Pctspace: percentage by which space allocation is to be modified
defaults to 100 (no modification)
******************************************************************** -->
<xsl:if test="$List/IOV_LIST_ITEM[PART_NUM=$PNUM]">
<xsl:variable name="IOVnode" select="$List/IOV_LIST_ITEM[PART_NUM=$PNUM]"/>
<xsl:if test="$PRETTY=1">
<xsl:text>
</xsl:text>
</xsl:if>
<xsl:text> OVERFLOW </xsl:text>
<xsl:apply-templates select="$IOVnode/PCT_FREE"/>
<xsl:if test="($IOVnode/FLAGS mod 8)>=4"> NOLOGGING </xsl:if>
<xsl:choose>
<xsl:when test="$IOVnode/DATAOBJ_NUM and
$IOVnode/STORAGE">
<xsl:apply-templates select="$IOVnode/STORAGE">
<xsl:with-param name="PARTITION">1</xsl:with-param>
<xsl:with-param name="BlkSize" select="$IOVnode/BLOCKSIZE"/>
<xsl:with-param name="Dataobjnum" select="$IOVnode/DATAOBJ_NUM"/>
<xsl:with-param name="Pctspace" select="$Pctspace"/>
</xsl:apply-templates>
</xsl:when>
<!-- Process DEFERRED_STG if applicable.
Note: Compression clause is not valid for Overflow segments.
Also disable the processing of the logging attribute
because the FLAGS element is NOT in the current node and
it processed earlier for both storage cases.
-->
<xsl:when test="$IOVnode/DEFERRED_STG">
<xsl:call-template name="DoDeferredStg">
<xsl:with-param name="DeferredStg" select="$IOVnode/DEFERRED_STG"/>
<xsl:with-param name="Pctspace" select="$PCTSPACE"/>
<xsl:with-param name="Partition">1</xsl:with-param>
<xsl:with-param name="doCompression">0</xsl:with-param>
<xsl:with-param name="doLogging">0</xsl:with-param>
</xsl:call-template>
<xsl:if test="$TABLESPACE=1">
<xsl:apply-templates select="$IOVnode/TS_NAME"/>
</xsl:if>
</xsl:when>
<xsl:otherwise>
<!-- An old Data Pump dump file may not have DATAOBJ_NUM.
But sometimes OBJ_NUM will contain the same value.
So use it as the value of Dataobjnum and hope we're lucky -->
<xsl:apply-templates select="$IOVnode/STORAGE">
<xsl:with-param name="PARTITION">1</xsl:with-param>
<xsl:with-param name="BlkSize" select="$IOVnode/BLOCKSIZE"/>
<xsl:with-param name="Dataobjnum" select="$IOVnode/OBJ_NUM"/>
<xsl:with-param name="Pctspace" select="$Pctspace"/>
</xsl:apply-templates>
</xsl:otherwise>
</xsl:choose>
</xsl:if>
</xsl:template>
<xsl:template name="DoIMAPList">
<xsl:param name="List" select="''"/>
<xsl:param name="PNUM">0</xsl:param>
<xsl:param name="Pctspace">100</xsl:param>
<!-- *******************************************************************
Template: DoIMAPList - Emit MAPPING TABLE for partition number PNUM
Parameters:
List - parent of IMAP_LIST_ITEM
PNUM - partition number
Pctspace: percentage by which space allocation is to be modified
defaults to 100 (no modification)
******************************************************************** -->
<xsl:if test="$List/IMAP_LIST_ITEM[PART_NUM=$PNUM]">
<xsl:variable name="IMAPnode" select="$List/IMAP_LIST_ITEM[PART_NUM=$PNUM]"/>
<xsl:if test="$PRETTY=1">
<xsl:text>
</xsl:text>
</xsl:if>
<xsl:text> MAPPING TABLE </xsl:text>
<xsl:apply-templates select="$IMAPnode/PCT_FREE"/>
<xsl:choose>
<xsl:when test="$IMAPnode/DATAOBJ_NUM and
$IMAPnode/STORAGE">
<xsl:apply-templates select="$IMAPnode/STORAGE">
<xsl:with-param name="PARTITION">1</xsl:with-param>
<xsl:with-param name="BlkSize" select="$IMAPnode/BLOCKSIZE"/>
<xsl:with-param name="Dataobjnum" select="$IMAPnode/DATAOBJ_NUM"/>
<xsl:with-param name="Pctspace" select="$Pctspace"/>
</xsl:apply-templates>
</xsl:when>
<!-- Process DEFERRED_STG if applicable -->
<xsl:when test="$IMAPnode/DEFERRED_STG">
<xsl:call-template name="DoDeferredStg">
<xsl:with-param name="DeferredStg" select="$IMAPnode/DEFERRED_STG"/>
<xsl:with-param name="Pctspace" select="$PCTSPACE"/>
<xsl:with-param name="Partition">1</xsl:with-param>
<xsl:with-param name="doCompression">0</xsl:with-param>
<xsl:with-param name="doLogging">0</xsl:with-param>
</xsl:call-template>
<xsl:if test="$TABLESPACE=1">
<xsl:apply-templates select="$IMAPnode/TS_NAME"/>
</xsl:if>
</xsl:when>
<xsl:otherwise>
<!-- An old Data Pump dump file may not have DATAOBJ_NUM.
But sometimes OBJ_NUM will contain the same value.
So use it as the value of Dataobjnum and hope we're lucky -->
<xsl:apply-templates select="$IMAPnode/STORAGE">
<xsl:with-param name="PARTITION">1</xsl:with-param>
<xsl:with-param name="BlkSize" select="$IMAPnode/BLOCKSIZE"/>
<xsl:with-param name="Dataobjnum" select="$IMAPnode/OBJ_NUM"/>
<xsl:with-param name="Pctspace" select="$Pctspace"/>
</xsl:apply-templates>
</xsl:otherwise>
</xsl:choose>
</xsl:if>
</xsl:template>
<xsl:template match="LOBS">
<xsl:param name="PartListItem" select="''"/>
<xsl:param name="Parttype">0</xsl:param>
<xsl:param name="Subpartition">0</xsl:param>
<!-- *******************************************************************
Template: LOBS - emit clauses for LOBS, VARRAYs, etc. in this [sub]part'n
Parameters:
PartListItem - PART_LIST_ITEM node or SUBPARTS_ITEM node
Parttype - 1 = range
2 = hash
3 = system
Subpartition 1 = this is a subpartition (0 = it isn't)
******************************************************************** -->
<xsl:for-each select="LOBS_ITEM">
<xsl:choose>
<xsl:when test="$PartListItem='PART_LIST_ITEM'">
<xsl:call-template name="DoLOBStoreAs">
<xsl:with-param name="MetaType">LobFrag</xsl:with-param>
<xsl:with-param name="Parttype" select="$Parttype"/>
<xsl:with-param name="Subpartition" select="$Subpartition"/>
<xsl:with-param name="ColList" select="../../../../../COL_LIST"/>
<xsl:with-param name="Intcolnum" select="INTCOL_NUM"/>
<xsl:with-param name="TabBlocksize" select="../../../../../BLOCKSIZE | BLOCKSIZE"/>
</xsl:call-template>
</xsl:when>
<xsl:when test="$PartListItem='COMPART_LIST_ITEM'">
<xsl:call-template name="DoLOBStoreAs">
<xsl:with-param name="MetaType">LobComppart</xsl:with-param>
<xsl:with-param name="Parttype" select="$Parttype"/>
<xsl:with-param name="Subpartition" select="$Subpartition"/>
<xsl:with-param name="ColList" select="../../../../../COL_LIST"/>
<xsl:with-param name="Intcolnum" select="INTCOL_NUM"/>
<xsl:with-param name="TabBlocksize" select="../../DEFBLOCKSIZE"/>
</xsl:call-template>
</xsl:when>
<xsl:when test="$PartListItem='SUBPARTS_ITEM'">
<xsl:call-template name="DoLOBStoreAs">
<xsl:with-param name="MetaType">LobFrag</xsl:with-param>
<xsl:with-param name="Parttype" select="$Parttype"/>
<xsl:with-param name="Subpartition" select="$Subpartition"/>
<xsl:with-param name="ColList" select="../../../../../../../COL_LIST"/>
<xsl:with-param name="Intcolnum" select="INTCOL_NUM"/>
<xsl:with-param name="TabBlocksize" select="../../../../../../../BLOCKSIZE | BLOCKSIZE"/>
</xsl:call-template>
</xsl:when>
</xsl:choose>
</xsl:for-each>
</xsl:template>
<xsl:template name="DoUnusablePartitions">
<xsl:param name="Idx" select="''"/>
<!-- *******************************************************************
Template: DoUnusablePartitions - Handle UNUSABLE (sub)partitions
Parameters:
Idx - index node
Purpose: This template will generate alter statements for index partitions
that have been marked unusable
Note: Do not use alters unless the transform param ALTER_INDEX_PART_UNUSABLE
is set, or the index is global partitioned, or if it is a composite
domain index.
******************************************************************** -->
<xsl:if test="($ALTER_INDEX_PART_UNUSABLE=1) or
(($Idx/PART_OBJ/PARTOBJ/FLAGS mod 2)!=1) or
($Idx/TYPE_NUM=9 and $Idx/PART_OBJ/COMPART_LIST/COMPART_LIST_ITEM)">
<xsl:for-each select="$Idx/PART_OBJ/PART_LIST/PART_LIST_ITEM[(FLAGS mod 2) >=1]">
<xsl:call-template name="Do1PartUnusable">
<xsl:with-param name="Idx" select="$Idx"/>
<xsl:with-param name="PartNode" select="."/>
</xsl:call-template>
</xsl:for-each>
<xsl:for-each select="$Idx/PART_OBJ/COMPART_LIST/COMPART_LIST_ITEM">
<xsl:for-each select="SUBPARTS/SUBPARTS_ITEM[(FLAGS mod 2) >=1]">
<xsl:call-template name="Do1PartUnusable">
<xsl:with-param name="Idx" select="$Idx"/>
<xsl:with-param name="PartNode" select="."/>
</xsl:call-template>
</xsl:for-each>
</xsl:for-each>
</xsl:if>
</xsl:template>
<xsl:template name="Do1PartUnusable">
<xsl:param name="Idx" select="''"/>
<xsl:param name="PartNode" select="''"/>
<!-- *******************************************************************
Template: Do1PartUnusable - Handle one UNUSABLE (sub)partition
Parameters:
Idx - index node
PartNode - (sub)partition node
******************************************************************** -->
<xsl:call-template name="DoParse">
<xsl:with-param name="Verb">ALTER</xsl:with-param>
<xsl:with-param name="ObjectType">INDEX</xsl:with-param>
<xsl:with-param name="SchemaNode" select="$Idx/SCHEMA_OBJ/OWNER_NAME"/>
<xsl:with-param name="NameNode" select="$Idx/SCHEMA_OBJ/NAME"/>
</xsl:call-template>
<xsl:if test="$PRETTY=1">
<xsl:text>
 </xsl:text>
</xsl:if>
<xsl:text> ALTER INDEX </xsl:text>
<xsl:apply-templates select="$Idx/SCHEMA_OBJ"/>
<xsl:choose>
<xsl:when test="local-name($PartNode)='SUBPARTS_ITEM'"> MODIFY SUBPARTITION "</xsl:when>
<xsl:otherwise> MODIFY PARTITION "</xsl:otherwise>
</xsl:choose>
<xsl:value-of select="$PartNode/SCHEMA_OBJ/SUBNAME"/>
<xsl:text>" UNUSABLE</xsl:text>
<!-- Terminate the SQL statement -->
<xsl:if test="$SQLTERMINATOR=1">
<xsl:text>;</xsl:text>
</xsl:if>
</xsl:template>
</xsl:stylesheet>
OHA YOOOO