473,396 Members | 2,068 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Creating Tablespaces : Best Practices

Hi,

I am trying to create around 70 tablespaces for around 100 tables..
Am using DB2 UDB 8.2 in Linux environment...

This is one i generated through Control centre....

CREATE REGULAR TABLESPACE SNCI001 IN DATABASE PARTITION GROUP
IBMDEFAULTGROUP PAGESIZE 4096 MANAGED BY SYSTEM
USING ('/db2home/db2inst1/dnci1d/user_tblspace')
EXTENTSIZE 8 PREFETCHSIZE 16 BUFFERPOOL GBP01 OVERHEAD 12.670000
TRANSFERRATE 0.180000;

Now, to create the remaining using command prompt how should i proceed
in specyfying the directories ...USING
('/db2home/db2inst1/dnci1d/user_tblspace') ??

1.) Do I have to create around 70 directories for each container using
MKDIR first and then proceed with the command ...??

2.) Can I nest the 70 containers under one directory ? Am getting
SQL0298N Bad container path. SQLSTATE=428B2

What is the best practice ??

3.) I have a table with 3 fields having Varchar(4000) and am getting
sqlcode -286
A default tablespace could not be found with a page size atleast 16384.
How should I size the Tablespace and bufferpool for this purticular
table ??

Sep 1 '06 #1
10 13365
While stranded on information super highway rAinDeEr wrote:
Hi,

I am trying to create around 70 tablespaces for around 100 tables..
Am using DB2 UDB 8.2 in Linux environment...

This is one i generated through Control centre....

CREATE REGULAR TABLESPACE SNCI001 IN DATABASE PARTITION GROUP
IBMDEFAULTGROUP PAGESIZE 4096 MANAGED BY SYSTEM
USING ('/db2home/db2inst1/dnci1d/user_tblspace')
EXTENTSIZE 8 PREFETCHSIZE 16 BUFFERPOOL GBP01 OVERHEAD 12.670000
TRANSFERRATE 0.180000;

Now, to create the remaining using command prompt how should i proceed
in specyfying the directories ...USING
('/db2home/db2inst1/dnci1d/user_tblspace') ??

1.) Do I have to create around 70 directories for each container using
MKDIR first and then proceed with the command ...??
Yes.
>
2.) Can I nest the 70 containers under one directory ? Am getting
SQL0298N Bad container path. SQLSTATE=428B2
I don't think so.
>
What is the best practice ??
It depends on how you are using the database. In high volume environment
the best practice would be to use DMS table spave and have one table
per disk (unless you are using SAN) and have one ioserver per disk in
use. In low volume you can probably get by using SMS table space.

>
3.) I have a table with 3 fields having Varchar(4000) and am getting
sqlcode -286
A default tablespace could not be found with a page size atleast 16384.
How should I size the Tablespace and bufferpool for this purticular
table ??
The table have 3 columns of VARCHAR 4000 which is greater than 4K (page
size of the table space), one size up for page size is 16K, you will have
to create table space with page size of 16K, which will also require to
create a buffer pool with page size 16K.

>
--
Hemant Shah /"\ ASCII ribbon campaign
E-mail: No************@xnet.com \ / ---------------------
X against HTML mail
TO REPLY, REMOVE NoJunkMail / \ and postings
FROM MY E-MAIL ADDRESS.
-----------------[DO NOT SEND UNSOLICITED BULK E-MAIL]------------------
I haven't lost my mind, Above opinions are mine only.
it's backed up on tape somewhere. Others can have their own.
Sep 1 '06 #2
Hi..

How do I start creating Tablespaces in Linux in the command prompt... ?
Control centre is really easy.....

Do i have to use MKDIR then change the ownership ?

Sep 1 '06 #3
rAinDeEr wrote:
Hi..

How do I start creating Tablespaces in Linux in the command prompt... ?
Control centre is really easy.....

Do i have to use MKDIR then change the ownership ?
Have you considered using automatic storage? It would make your life so
much easier.

Cheers
Serge
--
Serge Rielau
DB2 Solutions Development
IBM Toronto Lab

IOD Conference
http://www.ibm.com/software/data/ond...ness/conf2006/
Sep 1 '06 #4
rAinDeEr wrote:
1.) Do I have to create around 70 directories for each container using
MKDIR first and then proceed with the command ...??
Correct. Best might be to create the directories as DB2 instance owner.
Then you don't have to worry about the access.
2.) Can I nest the 70 containers under one directory ? Am getting
SQL0298N Bad container path. SQLSTATE=428B2
No. SMS containers require a directory. Thus, you can't place different
containers in the same directory. But you can use common parent
directories:

/containers/container1/
/containers/container2/

DMS containers are different. Since those are files, you can place those
files in the same directory.
3.) I have a table with 3 fields having Varchar(4000) and am getting
sqlcode -286
A default tablespace could not be found with a page size atleast 16384.
How should I size the Tablespace and bufferpool for this purticular
table ??
3 * 4000 = 12000. So you need a tablespace with 16K or 32K page size... and
a buffer pool that goes along with it. As for the size of the
tablespace/bufferpool, it depends on the amount of data. The usual TS/BP
tuning comes into play.

p.s: Is there a particular reason why you want to place all the tables in
dedicated tablespaces? You could just dump them into a few TS and let DB2
take care of the rest. Multiple TS and containers are usually only helpful
if you want to physically separate the data and/or if you have multiple
discs and want to take advantage of parallel I/O. (Or if you need
different page sizes...)

--
Knut Stolze
DB2 Information Integration Development
IBM Germany
Sep 1 '06 #5
Am trying to partition the tables in such a way that the tables with
huge data belong to separate tablespaces and bufferpools and tables
with just a few records I have clubbed into a single tablespace for
performance.

Am i proceeding in the right way ?

Also, I have to remotely connect to the Database. I dont have a client
installed nor have i cataloged any where..Have to TELNET and do the
operations.

I am working in a m/c with no partitions..So how do I go about
Automatic Storage ?

Also deciding on the bUfferpool size is another issue..

Around 100 tables...40 of them with very high records...remaining just
a few 100 records..

Sep 1 '06 #6
rAinDeEr wrote:
Am trying to partition the tables in such a way that the tables with
huge data belong to separate tablespaces and bufferpools and tables
with just a few records I have clubbed into a single tablespace for
performance.
That makes sense. ;-)
Also, I have to remotely connect to the Database. I dont have a client
installed nor have i cataloged any where..Have to TELNET and do the
operations.
You may want to consider using a DB2 client on your own machine. Then you
can handle things a bit easier if you are not very familiar with the CLP
yet.
Also deciding on the bUfferpool size is another issue..
There I would recommend to run the Configuration Advisor (from the control
center) since it makes some suggestions regarding buffer pool sizes.

--
Knut Stolze
DB2 Information Integration Development
IBM Germany
Sep 1 '06 #7
"rAinDeEr" <ta**********@gmail.comwrote in message
news:11**********************@m79g2000cwm.googlegr oups.com...
Hi,

I am trying to create around 70 tablespaces for around 100 tables..
Am using DB2 UDB 8.2 in Linux environment...
While it is best practice in DB2 for z/OS to have a single tablespace for
each table (with some exceptions), it is bad practice to that in DB2 for
(LUW) Linux, UNIX, and Windows.

With DB2 for LUW, you want one tablespace for each page size that is needed.
If you want multiple bufferpools, then you may need multiple tablespaces
since tablespaces are assigned to bufferpools (not tables).

You might want additional tablespaces if you have some extremely large
tables (in addition to smaller tables) that will be have a lot of full table
scans (queries that read every single row of the table), and you want to use
a different prefetch or extent size than the other tablespaces.

There is no way you should have 70 tablespaces in DB2 for LUW.

Sep 1 '06 #8
Ian
rAinDeEr wrote:
Hi,

I am trying to create around 70 tablespaces for around 100 tables..
Am using DB2 UDB 8.2 in Linux environment...

This is one i generated through Control centre....

CREATE REGULAR TABLESPACE SNCI001 IN DATABASE PARTITION GROUP
IBMDEFAULTGROUP PAGESIZE 4096 MANAGED BY SYSTEM
USING ('/db2home/db2inst1/dnci1d/user_tblspace')
EXTENTSIZE 8 PREFETCHSIZE 16 BUFFERPOOL GBP01 OVERHEAD 12.670000
TRANSFERRATE 0.180000;

Now, to create the remaining using command prompt how should i proceed
in specyfying the directories ...USING
('/db2home/db2inst1/dnci1d/user_tblspace') ??

1.) Do I have to create around 70 directories for each container using
MKDIR first and then proceed with the command ...??
No. I'm not sure why other people think that the directory has to exist
first. DB2 will create the directory if it is able to. This applies to
both SMS and DMS (i.e. DB2 does the equivalent of 'mkdir -p').

In fact, if DB2 does create the directory, it creates a file in the
directory named .SQLCRT.FLG that signifies that DB2 created the
directory. When you drop your tablespace, DB2 will remove the
directory if the .SQLCRT.FLG exists.
2.) Can I nest the 70 containers under one directory ? Am getting
SQL0298N Bad container path. SQLSTATE=428B2
The containers can all exist in a single path. Example:

/db2home/db2inst1/dnci1d/user_tblspace/snci001 (for tbspace SNCI001)
/db2home/db2inst1/dnci1d/user_tblspace/snci002 (for tbspaceSNCI002)
Note, DB2 does not append the name of the tablespace to the path you
specify for SMS (which it looks like you were assuming that it did,
based on your container path).

What is the best practice ??
This depends completely on your server and the physical disks you've got
installed in the server.

Sep 1 '06 #9
Ian
Mark A wrote:
While it is best practice in DB2 for z/OS to have a single tablespace for
each table (with some exceptions), it is bad practice to that in DB2 for
(LUW) Linux, UNIX, and Windows.
I don't think it's necessarily a bad practice on LUW. But it certainly
shouldn't be done by default.

It's just that the reasons why people do it on z/OS don't apply on
LUW, right? (I'm not a z/OS guy).

Sep 1 '06 #10
"Ian" <ia*****@mobileaudio.comwrote in message
news:713Kg.4377$y61.1813@fed1read05...
I don't think it's necessarily a bad practice on LUW. But it certainly
shouldn't be done by default.

It's just that the reasons why people do it on z/OS don't apply on
LUW, right? (I'm not a z/OS guy).
It's bad practice for 2 reasons.

First, it takes a lot more admin time. The cost of ownership of the database
is increased, sometimes significantly.

Second, it either wastes huge amount of disk space, or it increases the
chance of an database outage due to a tablespace filling up (assuming we are
talking about DMS). For a given amount of disk space, having just a few
large tablespaces provides a much larger error of margin for a single table
that grows unexpectedly, compared to creating a separate tablespace for each
table.

DB2 for z/OS is different for several reasons, only some of which I will
mention here.

On DB2 z/OS with a simple tablespace, there are no table scans, there are
only tablespace scans. So if a tablespace scan occurs, it will scan all the
tables in the tablespace. This is not true for segmented tablespaces, but
there are some disadvantages to segmented tablespaces that I don't want to
get into here.

On DB2 for z/OS, tablespaces contain the specification for Percent Free and
other parameters that are at the table level in LUW.

On DB2 for z/OS, tablespaces use VSAM Linear datasets, which have a primary
and secondary quantity (size) that is set by the DBA. Once the primary space
is filled up, the tablespace will automatically use up to 127 (or something
like that) secondary extents (of the size you specify) as the table grows.
So it is much less likely to fill up a tablespace, and you don't have to
pre-allocate huge amounts of space upfront. Admittedly, automatic storage in
LUW alleviates "some" of the concerns addressed by this last point, but it
still is not the same.

Sep 2 '06 #11

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: byrocat | last post by:
I'm chasing after a documetn that was available on one of the Microsoft websites that was titled somethign like "MS SQL Server Best Practices" and detailed a nyumber of best practices about...
1
by: nathan_kent_bullock | last post by:
I have a python program that I am trying to generate documentation for. But in one of my files I have a class called "Data", when pydoc gets to this class it just barfs. Well more specifically it...
136
by: Matt Kruse | last post by:
http://www.JavascriptToolbox.com/bestpractices/ I started writing this up as a guide for some people who were looking for general tips on how to do things the 'right way' with Javascript. Their...
13
by: john doe | last post by:
A quick question, about so-called 'best practices', I'm interested in which of A/B of the two examples people would choose, and why. public enum MyEnum { Option1 = 0, Option2 = 1, Option3 =...
0
by: Anonieko Ramos | last post by:
ASP.NET Forms Authentication Best Practices Dr. Dobb's Journal February 2004 Protecting user information is critical By Douglas Reilly Douglas is the author of Designing Microsoft ASP.NET...
2
by: Amelyan | last post by:
Could anyone recommend a book (or a web site) that defines best practices in ASP.NET application development? E.g. 1) Precede your control id's with type of control btnSubmit, txtName, etc. 2)...
10
by: jojobar | last post by:
Hello, I am trying to use vs.net 2005 to migrate a project originally in vs.net 2003. I started with creation of a "web site", and then created folders for each component of the site. I read...
8
by: SStory | last post by:
When I right a class, I am wondering what are the best practices for error handling? Do I try..catch and trap the error and if so what do I do with it? Because most likely the class user will...
9
by: Phlip | last post by:
Newsgroupies: Good guidelines keep source code within a "comfort zone". Programming languages provide extraordinarily wide design spaces, much wider than hardware designs enjoy, with many tricks...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.