mbevilacqua
asked on
DB2 Temporary tablespace
We encountered this issue:
[DB2]A temporary table space with sufficient page size does not exist.
By default, we create a temporary tablespace defines as User temporary tablespace. We were able to fix this by adding a System temporary tablespace using WEBMBUFF.
Questions:
What is the differnce between SYSTEM and USER temporary tablespaces?
Why would creating a System versus User temporary tablespace fix this?
[DB2]A temporary table space with sufficient page size does not exist.
By default, we create a temporary tablespace defines as User temporary tablespace. We were able to fix this by adding a System temporary tablespace using WEBMBUFF.
Questions:
What is the differnce between SYSTEM and USER temporary tablespaces?
Why would creating a System versus User temporary tablespace fix this?
CREATE
PROCEDURE XYZ_TABLESPACES_TMP()
BEGIN
DECLARE V_COUNT INT DEFAULT 0;
DECLARE STATEMENT VARCHAR(1000);
SELECT COUNT(*) INTO V_COUNT FROM SYSIBM.SYSTABLESPACES
WHERE TBSPACE = 'XYZTEMP';
IF (V_COUNT = 0) THEN
SET statement = 'CREATE USER TEMPORARY TABLESPACE XYZTEMP PAGESIZE 32K MANAGED BY SYSTEM USING (''XYZTEMP'') BUFFERPOOL XYZBUFF';
EXECUTE IMMEDIATE statement;
END IF;
END
/
as
CREATE
PROCEDURE XYZ_TABLESPACES_TMP()
BEGIN
DECLARE V_COUNT INT DEFAULT 0;
DECLARE STATEMENT VARCHAR(1000);
SELECT COUNT(*) INTO V_COUNT FROM SYSIBM.SYSTABLESPACES
WHERE TBSPACE = 'XYZTEMP';
IF (V_COUNT = 0) THEN
SET statement = 'CREATE SYSTEM TEMPORARY TABLESPACE XYZTEMP PAGESIZE 32K MANAGED BY SYSTEM USING (''XYZTEMP'') BUFFERPOOL XYZBUFF';
EXECUTE IMMEDIATE statement;
END IF;
END
/
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
the best way to find out would to just try it with only the system temp tablespace
if it would work - you don't need the user tablespace
if it won't work, you do need it
if it would work - you don't need the user tablespace
if it won't work, you do need it
ASKER
Easier said then done. We produce software and ship it to hundreds of customers. We need to know at ship time is it is required. I guess we can do a complete regresion test and see if converting the create from USER to SYSTEM causes any problems, but that is a big task.
The odd thing is that we have only used USER temp space for years. This is the first time we have seen this issue and the requirement for a System temp space.
The odd thing is that we have only used USER temp space for years. This is the first time we have seen this issue and the requirement for a System temp space.
Hi mbevilacqua,
There's always SYSTEM temp space. It's just that the default amount is just fine for most installations.
Creating a user temporary table in the SYSTEM temporary space is a bad idea, particularly when you're distributing "shrink wrapped" software and have little control over the user environments. Better plans are to create another tablespace specifically for the temporary tables or just allow DB2 to manage the space.
Kent
There's always SYSTEM temp space. It's just that the default amount is just fine for most installations.
Creating a user temporary table in the SYSTEM temporary space is a bad idea, particularly when you're distributing "shrink wrapped" software and have little control over the user environments. Better plans are to create another tablespace specifically for the temporary tables or just allow DB2 to manage the space.
Kent
ASKER
We use regular table spaces with page size 32K to keep our data. So would we need to create system temporary table space with same page size or Is it enough IBM default table space 'TEMPSAPCE1' which is system temporary with page size 4k?
The system temp space should be fine with 4K pages. It doesn't typically hold user (row) data.
Kent
Kent
ASKER
SQL: select xyzcolumn from tablexyz where xyzcolumn=1 order by xyzcolumn