MINI MINI MANI MO
<?xml version="1.0"?>
<!--
Copyright (c) 2001, 2017, Oracle and/or its affiliates. All rights reserved.
NAME
kutblspc.xsl
DESCRIPTION
XSLT stylesheet for XML => DDL conversion of ku$_tablespace_t UDTs
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
tbhukya 09/24/17 - Bug 26744170: Generate lost write protection
during import
tbhukya 05/26/17 - Bug 26075370:lost write protection in undo tablespace
jjanosik 05/05/17 - Bug 25239237: handle suspend lost write protection
jjanosik 03/20/17 - Bug 25238495: fix encryption check
tbhukya 02/03/17 - Bug 25468408: Double quote tablespace group name
tbhukya 01/18/17 - Bug 25377884: Generate encryption for dictionary
manager tablespace
tbhukya 01/13/17 - Bug 25372491: encryption for tablespace converted
from offline to online
tbhukya 06/09/16 - Bug 22171888: CellMemory support
rapayne 06/01/16 - bug 23510805: fix LEAF datafile.
drosash 05/12/16 - Bug 23245222: change RIM for LEAF
rapayne 02/05/16 - remove Transportable variable def (not referenced).
tbhukya 12/24/16 - RTI 18868579: Replace cellcache with cellmemory
rapayne 11/13/15 - Bug 22186632: fix cellcache.
tbhukya 11/10/15 - Bug 21747321: Generate offline temp tablespace
tbhukya 09/22/15 - Bug 21816026: Offline shadow, undo tablespace
tbhukya 09/08/15 - Bug 21769074: Support encryption with temp,
undo tablespaces
rapayne 08/20/15 - rti 17886242: local temp tbsp for rim located on
a read/write instance do not track fsize (i.e., temp
files are not created on read/write instances.
tbhukya 08/04/15 - Rti 17738685: Use FLAGS2 for lost write protection
rapayne 06/02/15 - Bug 21147617: extended inMemory DISTRIBUTE support
to include FOR SERVICE attribute.
tbhukya 05/11/15 - Bug 20980538: lost write protection
rapayne 02/01/15 - proj 47411: local temporary tablepsaces.
dvekaria 09/19/14 - Bug 19601420: Inc encryption for uniform tablespaces.
sdavidso 04/04/14 - bug18385644: new IMC syntax
dvekaria 03/07/14 - Bug14661934: Omit ALTER commands for OMF's.
dvekaria 12/20/13 - Bug17494709: Output tablespace encryption algorithm
sdavidso 08/02/13 - bug16915643: extended inmemory options
dvekaria 09/10/13 - Bug 16766691 Output compress data.
bwright 08/21/13 - Bug 17312600: Remove hard tabs from DP src code
sdavidso 04/09/13 - proj42352: DP In-memory columnar
sdavidso 03/31/11 - support TRANSPORTABLE xml element
lbarton 11/20/08 - archive level compression
tbhukya 03/23/09 - Bug 7699521: Tablespace with encryption, retention
tbhukya 12/18/07 - Bug 6676420: add default compress clause
mjangir 10/16/07 - bug 6472131: temporary ts of dictionary manage
htseng 08/09/07 - bug 5738829
lbarton 11/29/06 - fix IS_OMF test
lbarton 02/20/06 - bug 4752442: BIGFILE
sdavidso 11/02/05 - fix inconsistent stylesheet format
sdavidso 10/21/05 - generate group name for temporary tbs
sdavidso 08/23/05 - Allow OMF datafiles in tablespaces
htseng 08/19/04 - bug 3794006: add alter command to resize tbs
lbarton 05/11/04 - Bug 3617842: SAMPLE and PCTSPACE
htseng 12/18/03 - bug 3324545: remove maxsize UNLIMITED
lbarton 11/07/03 - Bug 3238141: SEGMENT_ATTRIBUTES param
htseng 04/04/03 - fix bug 2880535
htseng 02/05/03 - condition for generate read only
htseng 01/28/03 - bug fix 2770880 read only tbs
lbarton 10/02/02 - add REUSE param
htseng 08/02/02 - add grantee parse param
htseng 07/29/02 - add more parse params
lbarton 08/02/02 - transportable export
lbarton 06/13/02 - define EXPORT param
dgagne 11/05/01 - remove row movement from partitions and tablespace
dgagne 10/12/01 - add compression to tablespace
dgagne 09/24/01 - add support for force logging
dgagne 08/22/01 - Merged dgagne_add_xsl_stylesheets
dgagne 05/09/01 - Created
-->
<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"/>
<!-- Top-level parameters -->
<xsl:param name="PRETTY">1</xsl:param>
<xsl:param name="SQLTERMINATOR">0</xsl:param>
<xsl:param name="REUSE">0</xsl:param>
<!-- these parameters are for storage clause only -->
<xsl:param name="SEGMENT_ATTRIBUTES">1</xsl:param>
<xsl:param name="STORAGE">1</xsl:param>
<xsl:param name="TABLESPACE">0</xsl:param>
<xsl:param name="EXPORT">0</xsl:param>
<xsl:param name="TRANSPORTABLE">0</xsl:param>
<xsl:param name="PCTSPACE">100</xsl:param>
<xsl:param name="VERSION">9999999999</xsl:param>
<xsl:param name="LOST_WRITE_PROTECTION">0</xsl:param>
<!-- params for parse -->
<xsl:param name="PRS_DDL">0</xsl:param>
<xsl:param name="PRS_DELIM">\{]`</xsl:param>
<xsl:param name="PRS_VERB">0</xsl:param>
<xsl:param name="PRS_OBJECT_TYPE">0</xsl:param>
<xsl:param name="PRS_SCHEMA">0</xsl:param>
<xsl:param name="PRS_NAME">0</xsl:param>
<xsl:param name="PRS_GRANTEE">0</xsl:param>
<xsl:param name="PRS_GRANTOR">0</xsl:param>
<xsl:param name="PRS_BASE_OBJECT_SCHEMA">0</xsl:param>
<xsl:param name="PRS_BASE_OBJECT_NAME">0</xsl:param>
<xsl:param name="PRS_BASE_OBJECT_TYPE">0</xsl:param>
<!-- Templates -->
<xsl:template match="TABLESPACE_T">
<!-- *******************************************************************
Template: TABLESPACE_T - top-level template for tablespaces.
Depending on the tablespace type this template calls
DoUndoTS
DoPermanentTS
DoTemporaryTS
Then if necessary it does ALTER TABLESPACE to resize the datafiles
******************************************************************** -->
<xsl:call-template name="DoParse">
<xsl:with-param name="Verb">CREATE</xsl:with-param>
<xsl:with-param name="ObjectType">TABLESPACE</xsl:with-param>
<xsl:with-param name="NameNode" select="NAME"/>
</xsl:call-template>
<xsl:choose>
<xsl:when test="CONTENTS = 0">
<xsl:choose>
<xsl:when test="(FLAGS mod 32) >= 16">
<xsl:call-template name="DoUndoTS"/>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="DoPermanentTS"/>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="DoTemporaryTS"/>
</xsl:otherwise>
</xsl:choose>
<xsl:if test="$SQLTERMINATOR=1">
<xsl:text>;</xsl:text>
<!-- Terminate the SQL statement -->
</xsl:if>
<!-- Offline temp tablespace when temp file status is offline -->
<xsl:if test="CONTENTS = 1 and FILESPEC/FILESPEC_ITEM[(TFSTATUS mod 4)<2]">
<xsl:call-template name="DoParse">
<xsl:with-param name="Verb">ALTER</xsl:with-param>
<xsl:with-param name="ObjectType">TABLESPACE</xsl:with-param>
<xsl:with-param name="NameNode" select="NAME"/>
</xsl:call-template>
<xsl:if test="$PRETTY=1">
<xsl:text>
 </xsl:text>
</xsl:if>
<xsl:text> ALTER TABLESPACE </xsl:text>
<xsl:call-template name="QuoteObject">
<xsl:with-param name="Object" select="NAME"/>
</xsl:call-template>
<xsl:text> TEMPFILE OFFLINE</xsl:text>
<xsl:if test="$SQLTERMINATOR=1">
<xsl:text>;</xsl:text>
<!-- Terminate the SQL statement -->
</xsl:if>
</xsl:if>
<!-- resize tablespace -->
<xsl:variable name="BlkSize" select="BLOCKSIZE"/>
<xsl:for-each select="FILESPEC/FILESPEC_ITEM">
<xsl:if test="(FSIZE != RESIZE) and RESIZE !=0">
<xsl:call-template name="DoParse">
<xsl:with-param name="Verb">ALTER</xsl:with-param>
<xsl:with-param name="ObjectType">TABLESPACE</xsl:with-param>
<xsl:with-param name="NameNode" select="NAME"/>
</xsl:call-template>
<xsl:if test="$PRETTY=1">
<xsl:text>
 </xsl:text>
</xsl:if>
<!-- IS_OMF is not necessarily in the document -->
<xsl:choose>
<xsl:when test="IS_OMF!=0"/>
<xsl:otherwise>
<xsl:text> ALTER DATABASE DATAFILE </xsl:text>
<xsl:if test="$PRETTY=1">
<xsl:text>
 </xsl:text>
</xsl:if>
<xsl:text>'</xsl:text>
<xsl:value-of select="FNAME"/>
<xsl:text>' RESIZE </xsl:text>
<xsl:value-of select="RESIZE*$BlkSize"/>
<xsl:if test="$SQLTERMINATOR=1">
<xsl:text>;</xsl:text>
<!-- Terminate the SQL statement -->
</xsl:if>
</xsl:otherwise>
</xsl:choose>
</xsl:if>
</xsl:for-each>
</xsl:template>
<xsl:template name="DoPermanentTS">
<!-- *******************************************************************
Template: DoPermanentTS
Output complete "Create Tablespace" statement for permanent
tablespaces (not undo or temporary)
If necessary it subsequently does an ALTER TABLESPACE
to set it READ ONLY.
******************************************************************** -->
<xsl:call-template name="DoCreateVerb"/>
<xsl:text>TABLESPACE "</xsl:text>
<xsl:value-of select="NAME"/>
<xsl:text>" DATAFILE </xsl:text>
<xsl:variable name="BlkSize" select="BLOCKSIZE"/>
<xsl:variable name="BF_LWProtect" select="$VERSION>=1202000200 and
((FLAGS mod 512)>=256 and (FLAGS2 mod 2097152) >= 1048576)"/>
<xsl:for-each select="FILESPEC/FILESPEC_ITEM">
<xsl:call-template name="DoDataFile">
<xsl:with-param name="BlkSize" select="$BlkSize"/>
</xsl:call-template>
</xsl:for-each>
<xsl:if test="$PRETTY=1">
<xsl:text>
 </xsl:text>
</xsl:if>
<!-- Lost write protection for big file tablespace-->
<xsl:choose>
<xsl:when test="$BF_LWProtect=1">
<xsl:if test="STATUS=2">
<xsl:text> OFFLINE</xsl:text>
</xsl:if>
<xsl:text> LOST WRITE PROTECTION</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:choose>
<xsl:when test="(DFLOGGING mod 2) = 0">
<xsl:text> NOLOGGING</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:text> LOGGING</xsl:text>
</xsl:otherwise>
</xsl:choose>
<xsl:if test="(DFLOGGING mod 4) >= 2">
<xsl:text> FORCE LOGGING</xsl:text>
</xsl:if>
<xsl:choose>
<xsl:when test="STATUS = 1 or STATUS = 4">
<xsl:text> ONLINE</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:text> OFFLINE</xsl:text>
</xsl:otherwise>
</xsl:choose>
<xsl:choose>
<xsl:when test="CONTENTS = 0">
<xsl:text> PERMANENT BLOCKSIZE </xsl:text>
<xsl:value-of select="$BlkSize"/>
</xsl:when>
<xsl:otherwise>
<xsl:text> TEMPORARY</xsl:text>
</xsl:otherwise>
</xsl:choose>
<xsl:call-template name="ExtentManagement">
<xsl:with-param name="BlkSize" select="$BlkSize"/>
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
<!-- Generate alter stmt when tablespace is read only or
lost write protection is enabled during import as well -->
<xsl:if test="($VERSION>=1202000200 and
(((FLAGS2 mod 1073741824)>=536870912 or
(FLAGS2 mod 2147483648)>=1073741824) and
($LOST_WRITE_PROTECTION=1 or $EXPORT =0))) or
($EXPORT=0 and STATUS =4)">
<xsl:call-template name="DoParse">
<xsl:with-param name="Verb">ALTER</xsl:with-param>
<xsl:with-param name="ObjectType">TABLESPACE</xsl:with-param>
<xsl:with-param name="NameNode" select="NAME"/>
</xsl:call-template>
<xsl:if test="$SQLTERMINATOR=1">
<xsl:text>;</xsl:text>
<!-- Terminate the SQL statement -->
</xsl:if>
<xsl:text>
 </xsl:text>
<xsl:text> ALTER TABLESPACE "</xsl:text>
<xsl:value-of select="NAME"/>
<xsl:choose>
<xsl:when test="STATUS =4">
<xsl:text>" READ ONLY</xsl:text>
</xsl:when>
<xsl:when test="(FLAGS2 mod 1073741824)>=536870912">
<xsl:text>" ENABLE LOST WRITE PROTECTION</xsl:text>
</xsl:when>
<xsl:when test="(FLAGS2 mod 2147483648)>=1073741824">
<xsl:text>" SUSPEND LOST WRITE PROTECTION</xsl:text>
</xsl:when>
</xsl:choose>
</xsl:if>
</xsl:template>
<xsl:template name="DoCreateVerb">
<!-- *******************************************************************
Template: DoCreateVerb
Output CREATE [BIGFILE]
******************************************************************** -->
<xsl:text>CREATE </xsl:text>
<xsl:if test="(FLAGS mod 512)>=256">BIGFILE </xsl:if>
<!-- LOCAL TEMPORARY tablespace flags are defined in ktt3.h
KTT_LOCAL_TEMP ((ub8) 0x800000000000) /* LOCAL TEMP TS */
KTT_LOCAL_TEMP_ALL ((ub8)0x40000000000000) /* LOC TEMP TS FOR ALL*/
-->
<xsl:if test="$VERSION>=1202000000 and FLAGS2 and
(FLAGS2 mod 65536)>=32768">
<xsl:text>LOCAL </xsl:text>
</xsl:if>
</xsl:template>
<xsl:template name="DoUndoTS">
<!-- *******************************************************************
Template: DoUndoTS
Output complete "Create Undo Tablespace" statement
******************************************************************** -->
<xsl:call-template name="DoCreateVerb"/>
<xsl:text>UNDO TABLESPACE "</xsl:text>
<xsl:value-of select="NAME"/>
<xsl:text>" DATAFILE </xsl:text>
<xsl:variable name="BlkSize" select="BLOCKSIZE"/>
<xsl:for-each select="FILESPEC/FILESPEC_ITEM">
<xsl:call-template name="DoDataFile">
<xsl:with-param name="BlkSize" select="$BlkSize"/>
</xsl:call-template>
</xsl:for-each>
<xsl:if test="$PRETTY=1">
<xsl:text>
 </xsl:text>
</xsl:if>
<xsl:if test="STATUS=2">
<xsl:text> OFFLINE</xsl:text>
</xsl:if>
<xsl:text> BLOCKSIZE </xsl:text>
<xsl:value-of select="$BlkSize"/>
<xsl:call-template name="ExtentManagement">
<xsl:with-param name="BlkSize" select="$BlkSize"/>
<xsl:with-param name="Undo">1</xsl:with-param>
</xsl:call-template>
<xsl:if test="(FLAGS mod 1024) >= 512">
<xsl:text> RETENTION GUARANTEE </xsl:text>
</xsl:if>
<!--Generate alter stmt when lost write protection is enabled or suspended
during import as well -->
<xsl:if test="($VERSION>=1202000200 and
((FLAGS2 mod 1073741824)>=536870912 or
(FLAGS2 mod 2147483648)>=1073741824) and
($LOST_WRITE_PROTECTION=1 or $EXPORT=0))">
<xsl:call-template name="DoParse">
<xsl:with-param name="Verb">ALTER</xsl:with-param>
<xsl:with-param name="ObjectType">TABLESPACE</xsl:with-param>
<xsl:with-param name="NameNode" select="NAME"/>
</xsl:call-template>
<xsl:if test="$SQLTERMINATOR=1">
<xsl:text>;</xsl:text>
<!-- Terminate the SQL statement -->
</xsl:if>
<xsl:text>
 </xsl:text>
<xsl:text> ALTER TABLESPACE "</xsl:text>
<xsl:value-of select="NAME"/>
<xsl:choose>
<xsl:when test="(FLAGS2 mod 1073741824)>=536870912">
<xsl:text>" ENABLE LOST WRITE PROTECTION</xsl:text>
</xsl:when>
<xsl:when test="(FLAGS2 mod 2147483648)>=1073741824">
<xsl:text>" SUSPEND LOST WRITE PROTECTION</xsl:text>
</xsl:when>
</xsl:choose>
</xsl:if>
</xsl:template>
<xsl:template name="DoTemporaryTS">
<!-- *******************************************************************
Template: DoTemporaryTS
Output complete "Create Temporary Tablespace" statement
******************************************************************** -->
<xsl:call-template name="DoCreateVerb"/>
<!-- Define a quick flag to designate Local Temp Tblsp type if
applicable:
0 - not a local temp tbsp
1 - FOR ALL
2 - FOR LEAF
-->
<xsl:variable name="LTT_type">
<xsl:choose>
<xsl:when test="FLAGS2 and
((FLAGS2 mod (4194304*2))>=4194304)">1</xsl:when>
<xsl:when test="FLAGS2 and
((FLAGS2 mod (32768*2))>=32768)">2</xsl:when>
<xsl:otherwise>0</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:choose>
<xsl:when test="BITMAPPED = 0">
<xsl:text> TABLESPACE "</xsl:text>
<xsl:value-of select="NAME"/>
<xsl:text>" DATAFILE </xsl:text>
<xsl:variable name="BlkSize" select="BLOCKSIZE"/>
<xsl:for-each select="FILESPEC/FILESPEC_ITEM">
<xsl:call-template name="DoDataFile">
<xsl:with-param name="BlkSize" select="$BlkSize"/>
</xsl:call-template>
</xsl:for-each>
<xsl:if test="string-length(GROUPNAME)!=0">
<xsl:if test="$PRETTY=1">
<xsl:text>
 </xsl:text>
</xsl:if>
<xsl:text> TABLESPACE GROUP </xsl:text>
<xsl:call-template name="QuoteObject">
<xsl:with-param name="Object" select="GROUPNAME"/>
</xsl:call-template>
</xsl:if>
<xsl:if test="$PRETTY=1">
<xsl:text>
 </xsl:text>
</xsl:if>
<xsl:text> EXTENT MANAGEMENT DICTIONARY TEMPORARY </xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:text>TEMPORARY TABLESPACE </xsl:text>
<xsl:if test="$VERSION>=1202000000">
<xsl:choose>
<xsl:when test="$LTT_type=1">FOR ALL </xsl:when>
<xsl:when test="$LTT_type=2">FOR LEAF </xsl:when>
</xsl:choose>
</xsl:if>
<xsl:call-template name="QuoteObject">
<xsl:with-param name="Object" select="NAME"/>
</xsl:call-template>
<xsl:text> TEMPFILE </xsl:text>
<xsl:variable name="BlkSize" select="BLOCKSIZE"/>
<xsl:for-each select="FILESPEC/FILESPEC_ITEM">
<xsl:call-template name="DoDataFile">
<xsl:with-param name="BlkSize" select="$BlkSize"/>
</xsl:call-template>
</xsl:for-each>
<xsl:if test="string-length(GROUPNAME)!=0">
<xsl:if test="$PRETTY=1">
<xsl:text>
 </xsl:text>
</xsl:if>
<xsl:text> TABLESPACE GROUP </xsl:text>
<xsl:call-template name="QuoteObject">
<xsl:with-param name="Object" select="GROUPNAME"/>
</xsl:call-template>
</xsl:if>
<xsl:if test="$PRETTY=1">
<xsl:text>
 </xsl:text>
</xsl:if>
<xsl:text> EXTENT MANAGEMENT LOCAL UNIFORM SIZE </xsl:text>
<xsl:value-of select="DFLINIT * $BlkSize"/>
<xsl:if test="$SEGMENT_ATTRIBUTES=1 and $VERSION>=1202000000">
<xsl:call-template name="DoEncryption"/>
</xsl:if>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template name="DoDataFile">
<xsl:param name="BlkSize"/>
<!-- *******************************************************************
Template: DoDataFile
Output filespec and autoextend clause for tablespaces
******************************************************************** -->
<xsl:if test="position()>1">
<xsl:text>,</xsl:text>
</xsl:if>
<xsl:if test="$PRETTY=1">
<xsl:text>
 </xsl:text>
</xsl:if>
<!-- IS_OMF is not necessarily in the document -->
<xsl:choose>
<xsl:when test="IS_OMF!=0"/>
<xsl:otherwise>
<xsl:text>'</xsl:text>
<xsl:value-of select="FNAME"/>
<xsl:text>' </xsl:text>
</xsl:otherwise>
</xsl:choose>
<xsl:text>SIZE </xsl:text>
<xsl:choose>
<xsl:when test="IS_OMF!=0 and (FSIZE != RESIZE) and RESIZE !=0">
<xsl:value-of select="RESIZE*$BlkSize"/>
</xsl:when>
<xsl:when test="string-length($PCTSPACE)!=0 and $PCTSPACE!=100">
<xsl:value-of select="round(FSIZE*$BlkSize*$PCTSPACE*0.01)"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="FSIZE*$BlkSize"/>
</xsl:otherwise>
</xsl:choose>
<!-- IS_OMF is not necessarily in the document -->
<xsl:choose>
<xsl:when test="IS_OMF!=0"/>
<xsl:when test="$REUSE!=0">
<xsl:text> REUSE </xsl:text>
</xsl:when>
</xsl:choose>
<xsl:if test="MAXEXTEND > 0">
<xsl:if test="$PRETTY=1">
<xsl:text>
 </xsl:text>
</xsl:if>
<xsl:text> AUTOEXTEND ON NEXT </xsl:text>
<xsl:choose>
<xsl:when test="IS_OMF!=0 and (FSIZE != RESIZE) and RESIZE !=0">
<xsl:value-of select="RESIZE*$BlkSize"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="INC * $BlkSize"/>
</xsl:otherwise>
</xsl:choose>
<xsl:text> MAXSIZE </xsl:text>
<xsl:choose>
<xsl:when test="(MAXEXTEND * $BlkSize) > 2147483647">
<xsl:value-of select="floor((MAXEXTEND * $BlkSize) div 1048576)"/>
<xsl:text>M</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="MAXEXTEND * $BlkSize"/>
</xsl:otherwise>
</xsl:choose>
</xsl:if>
</xsl:template>
<xsl:template name="ExtentManagement">
<!-- *******************************************************************
Template: ExtentManagement
Template for "Extent Management Clause"
******************************************************************** -->
<xsl:param name="BlkSize"/>
<xsl:param name="Undo">0</xsl:param>
<xsl:variable name="IMCclause">
<!-- inmemory columnar - compress, priority, duplicate, distribute flags
ts$.flags in rdbms/src/server/space/if/ktt3.h
#define KTT_IMC_ENABLED ((ub8)0x1 00000000) /* IMC enabled or not */
#define KTT_IMC_MIRRORMAP ((ub8)0x2 00000000) /* IMC mirror or map */
#define KTT_IMC_LEVEL1 ((ub8)0x4 00000000) /* IMC comp level flag 1 */
#define KTT_IMC_PRELOAD ((ub8)0x8 00000000) /* IMC ondemand or preload */
#define KTT_IMC_MAPBY1 ((ub8)0x10 00000000) /* IMC map by flag 1 */
#define KTT_IMC_MAPBY2 ((ub8)0x20 00000000) /* IMC map by flag 2 */
#define KTT_IMC_LEVEL2 ((ub8)0x40 00000000) /* IMC comp level flag 2 */
#define KTT_IMC_LEVEL3 ((ub8)0x80 00000000) /* IMC comp level flag 3 */
#define KTT_IMC_LEVEL4 ((ub8)0x100 00000000) /* IMC comp level flag 4 */
#define KTT_IMC_NOTENABLED ((ub8)0x200 00000000) /* IMC explicitly disabled*/
#define KTT_IMC_DUPLICATE1 ((ub8)0x400 00000000) /* IMC duplicate */
#define KTT_IMC_DUPLICATE2 ((ub8)0x800 00000000) /* IMC duplicate */
#define KTT_IMC_PL_LOW ((ub8)0x1000 00000000) /* PriLevel:LOW */
#define KTT_IMC_PL_MEDIUM ((ub8)0x2000 00000000) /* PriLevel:MED */
#define KTT_IMC_PL_HIGH ((ub8)0x3000 00000000) /* PriLevel:HIGH */
#define KTT_IMC_PL_CRITICAL ((ub8)0x4000 00000000) /* PriLevel:CRITICAL */
#define KTT_IMC_FORSVC ((ub8)0x1000000000000000) /* IMC FOR SERVICE */
Note: in version 12.2 we now fetch the upper FLAGS word separately (i.e.,into
FLAGS2 which includes all of the IMC bits). For compatibility with existing
older dumpfiles we only use FLAGS2 when present.
-->
<xsl:variable name="IMCsegflag">
<xsl:choose>
<xsl:when test="$VERSION>=1202000000 and FLAGS2">
<xsl:value-of select="FLAGS2"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="floor(FLAGS div 4294967296)"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name="Priority" select="floor($IMCsegflag div 4096) mod 8"/>
<xsl:variable name="Enabled" select="($IMCsegflag) mod 2"/>
<xsl:variable name="MirrorMap" select="floor($IMCsegflag div 2) mod 2"/>
<xsl:variable name="Level1" select="floor($IMCsegflag div 4) mod 2"/>
<xsl:variable name="Preload" select="floor($IMCsegflag div 8) mod 2"/>
<xsl:variable name="MapBy12" select="floor($IMCsegflag div 16) mod 4"/>
<xsl:variable name="Level234" select="floor($IMCsegflag div 64) mod 8"/>
<xsl:variable name="Disabled" select="floor($IMCsegflag div 512) mod 2"/>
<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:otherwise>
<xsl:text>0</xsl:text>
</xsl:otherwise>
</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($IMCsegflag div 1024) mod 4"/>
<xsl:with-param name="ServiceName">
<xsl:if test="FLAGS2 and (FLAGS2 mod (268435456*2))>=268435456">
<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:otherwise>DEFAULT</xsl:otherwise>
</xsl:choose>
</xsl:if>
</xsl:with-param>
</xsl:call-template>
</xsl:variable>
<xsl:if test="$PRETTY=1">
<xsl:text>
 </xsl:text>
</xsl:if>
<xsl:text> EXTENT MANAGEMENT</xsl:text>
<xsl:choose>
<xsl:when test="BITMAPPED = 0">
<xsl:text> DICTIONARY</xsl:text>
<xsl:choose>
<xsl:when test="$SEGMENT_ATTRIBUTES=1">
<xsl:call-template name="DoEncryption"/>
<xsl:text> DEFAULT </xsl:text>
<xsl:value-of select="$IMCclause"/>
<xsl:call-template name="DoCompress"/>
<xsl:call-template name="NamedStorage">
<xsl:with-param name="BlkSize" select="$BlkSize"/>
<xsl:with-param name="ObjType" select="'TABLESPACE'"/>
<xsl:with-param name="Node" select="."/>
</xsl:call-template>
</xsl:when>
<xsl:when test="string-length($IMCclause)!=0">
<xsl:text> DEFAULT </xsl:text>
<xsl:value-of select="$IMCclause"/>
</xsl:when>
</xsl:choose>
</xsl:when>
<xsl:otherwise>
<xsl:text> LOCAL</xsl:text>
<xsl:choose>
<xsl:when test="(FLAGS mod 2) = 1">
<xsl:text> AUTOALLOCATE</xsl:text>
<xsl:choose>
<!-- Use old encryption syntax for version less than 12.2 -->
<xsl:when test="$SEGMENT_ATTRIBUTES=1 and $VERSION>=1100000000 and
$Undo=0 and $VERSION<1202000000">
<xsl:call-template name="DoEncryption"/>
<xsl:text> DEFAULT </xsl:text>
<xsl:value-of select="$IMCclause"/>
<xsl:call-template name="DoCompress"/>
<xsl:call-template name="DoStorageEncrypt"/>
</xsl:when>
<!-- Use new syntax for 12.2 and higher versions -->
<xsl:when test="$SEGMENT_ATTRIBUTES=1 and $VERSION>=1202000000">
<xsl:call-template name="DoEncryption"/>
<xsl:if test="$Undo=0">
<xsl:text> DEFAULT </xsl:text>
<xsl:value-of select="$IMCclause"/>
<xsl:call-template name="DoCompress"/>
<xsl:call-template name="DoCellMemory"/>
</xsl:if>
</xsl:when>
<xsl:when test="$SEGMENT_ATTRIBUTES=0 and string-length($IMCclause)!=0">
<xsl:text> DEFAULT </xsl:text>
<xsl:value-of select="$IMCclause"/>
</xsl:when>
</xsl:choose>
</xsl:when>
<xsl:when test="(FLAGS mod 4) = 0">
<xsl:choose>
<xsl:when test="$SEGMENT_ATTRIBUTES=1">
<xsl:text> USER</xsl:text>
<xsl:text> DEFAULT </xsl:text>
<xsl:value-of select="$IMCclause"/>
<xsl:call-template name="DoCompress"/>
<xsl:call-template name="DoCellMemory"/>
<xsl:call-template name="NamedStorage">
<xsl:with-param name="BlkSize" select="$BlkSize"/>
<xsl:with-param name="ObjType" select="'TABLESPACE'"/>
<xsl:with-param name="Node" select="."/>
</xsl:call-template>
<xsl:text> MINIMUM EXTENT </xsl:text>
<xsl:choose>
<xsl:when test="string-length($PCTSPACE)!=0 and $PCTSPACE!=100">
<xsl:value-of select="round(DFLMINLEN * $BlkSize*$PCTSPACE*0.01)"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="DFLMINLEN * $BlkSize"/>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:when test="$SEGMENT_ATTRIBUTES=0 and string-length($IMCclause)!=0">
<xsl:text> DEFAULT </xsl:text>
<xsl:value-of select="$IMCclause"/>
</xsl:when>
</xsl:choose>
</xsl:when>
<xsl:when test="(FLAGS mod 4) = 2">
<xsl:text> UNIFORM SIZE </xsl:text>
<xsl:choose>
<xsl:when test="string-length($PCTSPACE)!=0 and $PCTSPACE!=100">
<xsl:value-of select="round(DFLINIT * $BlkSize*$PCTSPACE*0.01)"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="DFLINIT * $BlkSize"/>
</xsl:otherwise>
</xsl:choose>
<xsl:call-template name="DoEncryption"/>
<xsl:text> DEFAULT </xsl:text>
<xsl:value-of select="$IMCclause"/>
<xsl:call-template name="DoCompress"/>
<xsl:call-template name="DoCellMemory"/>
<xsl:if test="$VERSION<1202000000">
<xsl:call-template name="DoStorageEncrypt"/>
</xsl:if>
</xsl:when>
</xsl:choose>
<xsl:if test="$Undo=0">
<xsl:call-template name="SegmentSpaceManagement"/>
</xsl:if>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template name="DoCompress">
<!-- *******************************************************************
Template: DoCompress: utility template to call DoTSCompress with
the correct parameter value
******************************************************************** -->
<xsl:call-template name="DoTSCompress">
<xsl:with-param name="Compress" select="FLAGS"/>
<xsl:with-param name="Compress2" select="FLAGS2"/>
</xsl:call-template>
</xsl:template>
<xsl:template name="DoCellMemory">
<!-- *******************************************************************
Template: DoCellMemory: Template to generate CELLMEMORY
******************************************************************** -->
<xsl:if test="$VERSION>=1202000000">
<xsl:variable name="flagNoCMemory">16777216</xsl:variable>
<xsl:variable name="flagCMemory">33554432</xsl:variable>
<xsl:variable name="flagCMCompressQuery">67108864</xsl:variable>
<xsl:variable name="flagCMCompressCapacity">134217728</xsl:variable>
<xsl:call-template name="DoCMemoryCompressSyntax">
<xsl:with-param name="isNoCMemory" select="(FLAGS2 mod ($flagNoCMemory*2)>=$flagNoCMemory)"/>
<xsl:with-param name="isCMemory" select="(FLAGS2 mod ($flagCMemory*2)>=$flagCMemory)"/>
<xsl:with-param name="isCMCompressQuery" select="(FLAGS2 mod ($flagCMCompressQuery*2)>=$flagCMCompressQuery)"/>
<xsl:with-param name="isCMCompressCapacity" select="(FLAGS2 mod ($flagCMCompressCapacity*2)>=$flagCMCompressCapacity)"/>
</xsl:call-template>
</xsl:if>
</xsl:template>
<xsl:template name="SegmentSpaceManagement">
<!-- *******************************************************************
Template: SegmentSpaceManagement
Template for "Segment Space Management clause"
******************************************************************** -->
<xsl:text> SEGMENT SPACE MANAGEMENT</xsl:text>
<xsl:choose>
<xsl:when test="((FLAGS mod 64) >= 32)">
<xsl:text> AUTO</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:text> MANUAL</xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template name="DoEncryption">
<!-- *******************************************************************
Template: DoEncryption
Template for "Encryption clause"
******************************************************************** -->
<xsl:if test="(FLAGS mod 32768) >= 16384">
<xsl:if test="$PRETTY=1">
<xsl:text>
 </xsl:text>
</xsl:if>
<xsl:text> ENCRYPTION</xsl:text>
<xsl:if test="ENCRYPTIONALG">
<xsl:text> USING </xsl:text>
<xsl:call-template name="SingleQuotedName">
<xsl:with-param name="NameNode" select="ENCRYPTIONALG"/>
</xsl:call-template>
</xsl:if>
<xsl:if test="$VERSION>=1202000000">
<xsl:text> ENCRYPT</xsl:text>
</xsl:if>
</xsl:if>
</xsl:template>
<xsl:template name="DoStorageEncrypt">
<!-- *******************************************************************
Template: DoStorageEncrypt
Template for "Storage Encrypt clause"
******************************************************************** -->
<xsl:if test="(FLAGS mod 65536) >= 32768">
<xsl:text>STORAGE(ENCRYPT)</xsl:text>
</xsl:if>
</xsl:template>
</xsl:stylesheet>
OHA YOOOO