DDLs to create DB2 Objects
***********************************************
************STORAGE GROUP**********************
***********************************************
CREATE STOGROUP KRASG701
VOLUMES (VOL1,VOL2,VOL3)
VCAT XKRDB2;
SELECT * FROM SYSIBM.SYSSTOGROUP WHERE NAME = 'KRASG701' ;
SELECT * FROM SYSIBM.SYSVOLUMES WHERE SGNAME = 'KRASG702' ;
CREATE STOGROUP KRASG702
VOLUMES ('*')
VCAT XKRDB2;
ALTER STOGROUP KRASG701
ADD VOLUMES ( VOL4)
REMOVE VOLUMES (VOL1);
SELECT * FROM SYSIBM.SYSSTOGROUP WHERE NAME = 'KRASG701' ;
SELECT * FROM SYSIBM.SYSVOLUMES WHERE SGNAME = 'KRASG701' ;
***********************************************
************ DATABASE **********************
***********************************************
CREATE DATABASE KRADB701
STOGROUP KRASG701
BUFFERPOOL BP1
KRAEXBP BP2;
SELECT * FROM SYSIBM.SYSDATABASE WHERE NAME = 'KRADB701';
***********************************************
************ TABLE SPACE *******************
***********************************************
CREATE TABLESPACE KRATS701
IN KRADB701
USING STOGROUP KRASG701
PRIQTY 720
SECQTY 200
PCTFREE 10
FREEPAGE 5
BUFFERPOOL BP1
CLOSE NO;
CREATE TABLESPACE KRATS702
IN KRADB701
USING STOGROUP KRASG701
PRIQTY 720
SECQTY 200
PCTFREE 10
FREEPAGE 5
BUFFERPOOL BP1
DEFINE NO
CLOSE NO;
***********************************************
************ TABLE *******************
***********************************************
CREATE TABLE KRATB702 ( EMPNO CHAR(5) NOT NULL,
EMPNAME CHAR(20) ) IN KRADB701.KRATS702;
INSERT INTO KRATB702 VALUES ( '1234', 'NARENDAR');
***********************************************
*******SEGMENTED TABLE SPACE*******************
***********************************************
CREATE TABLESPACE KRATS703
IN KRADB701
USING STOGROUP KRASG701
PRIQTY 720
SECQTY 200
SEGSIZE 32
PCTFREE 10
FREEPAGE 5
BUFFERPOOL BP1
CLOSE NO;
SELECT * FROM SYSIBM.SYSTABLESPACE WHERE NAME LIKE 'KRATS7%'
CREATE TABLESPACE KRATS704
IN KRADB701
USING STOGROUP KRASG701
PRIQTY 720
SECQTY 200
SEGSIZE 32
PCTFREE 10
FREEPAGE 5
DSSIZE 4GB
BUFFERPOOL BP1
CLOSE NO;
***********************************************
*******PARTITION TABLE SPACE*******************
***********************************************
CREATE TABLESPACE KRATS705
IN KRADB701
USING STOGROUP KRASG701
PRIQTY 4000
SECQTY 130
NUMPARTS 3
(PART 1
COMPRESS YES,
PART 2
COMPRESS YES,
PART 3
COMPRESS YES
)
LOCKSIZE PAGE
BUFFERPOOL BP1
CLOSE NO;
***********************************************
*******PARTITION TABLE *******************
***********************************************
CREATE TABLE KRATB705 ( EMPNO CHAR(5) NOT NULL,
EMPNAME CHAR(20) ) IN KRADB701.KRATS705;
INSERT INTO KRATB705 VALUES ( '1234', 'NARENDAR');
***********************************************
*******PARTITION KRAEX *******************
***********************************************
CREATE KRAEX XKR058.XKRATB705
ON XKR058.KRATB705
( EMPNO ASC )
CLUSTER (
PART 1
VALUES ('1000')
USING STOGROUP KRASG701
PRIQTY 100
SECQTY 100 ,
PART 2
VALUES ('2000')
USING STOGROUP KRASG701
PRIQTY 100
SECQTY 100 ,
PART 3
VALUES ('9999')
USING STOGROUP KRASG701
PRIQTY 100
SECQTY 100 )
BUFFERPOOL BP2
CLOSE NO ;
INSERT INTO KRATB705 VALUES ( '1234', 'NARENDAR');
SELECT * FROM KRATB705;
Subscribe to:
Posts (Atom)