If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > change default tablespace in db2

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 08-09-11, 02:58
blazer789 blazer789 is offline
Registered User
 
Join Date: Jun 2009
Posts: 221
change default tablespace in db2

Is there any way we can change the default tablespace for a database. If a user creates a table, that should take the default tablespace which we specify rather than taking the usertablespace.

Last edited by blazer789; 08-09-11 at 21:12.
Reply With Quote
  #2 (permalink)  
Old 08-09-11, 03:21
przytula_guy przytula_guy is offline
Registered User
 
Join Date: Apr 2006
Location: Belgium
Posts: 1,159
in db2 we don't have the setting of default tablespace as in o..
try : grant use on tablespace for this user
if this is the only use authority it will use this ts.
the best is to specify this when creating the table and not relying on some defaults... because defaults can change ..
__________________
Best Regards, Guy Przytula
Database Software Consultant
DB2 UDB LUW Certified V7-V8-V9-V9.7 DB Admin - Dprop..
Information Server Datastage Certified
http://www.infocura.be
Reply With Quote
  #3 (permalink)  
Old 08-09-11, 07:57
n_i n_i is offline
:-)
 
Join Date: Jun 2003
Location: Toronto, Canada
Posts: 4,449
Adding to what Guy said, if the tablespace is not specified, DB2 will pick the first one available to which the user has access and which has the required page size.
Reply With Quote
  #4 (permalink)  
Old 08-09-11, 22:55
db2girl db2girl is offline
∞∞∞∞∞∞
 
Join Date: Aug 2008
Location: Toronto, Canada
Posts: 1,816
Adding to what Guy and n_i said:


IN tablespace-name,…
....
If this clause is not specified, a table space for the table is determined as follows:
IF table space IBMDEFAULTGROUP (over which the user
has USE privilege) exists with sufficient page size
THEN choose it
ELSE IF a table space (over which the user has USE privilege)
exists with sufficient page size (see below when
multiple table spaces qualify)
THEN choose it
ELSE return an error (SQLSTATE 42727)

If more than one table space is identified by the ELSE IF condition, choose the table space with the smallest sufficient page size. If more than one table space qualifies, choose the table space in the following order of preference, depending on to whom the USE privilege was granted:

The authorization ID
A role to which the authorization ID is granted to
A group to which the authorization ID belongs
A role to which a group the authorization ID belongs is granted to
PUBLIC
A role to which PUBLIC is granted to
If more than one table space still qualifies, the final choice is made by the database manager.

Table space determination can change if:
Table spaces are dropped or created
USE privileges are granted or revoked

IBM DB2 9.7 for Linux, UNIX and Windows Information Center
Reply With Quote
  #5 (permalink)  
Old 08-11-11, 00:17
blazer789 blazer789 is offline
Registered User
 
Join Date: Jun 2009
Posts: 221
Thanks everybody for your inputs !
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On