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 > Changing an SMS table space to a DMS table space

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 01-21-09, 16:11
itsonlyme44 itsonlyme44 is offline
Registered User
 
Join Date: Dec 2007
Posts: 261
Changing an SMS table space to a DMS table space

we are running DB2 9.5 on windows. Is there anyway to Change a System Managed Tablespace to a Database Managed Tablespace?

We have one Database where whoever created the DB made the Userspace1 Tablespace System Managed. I would like to make it a DMS tablespace so that I can reclaim over 30GB in storage!!! Does anyone have any suggestions? Change be done on a restore? Is there any other way to reclaim this space??
Reply With Quote
  #2 (permalink)  
Old 01-21-09, 16:28
ARWinner ARWinner is offline
Registered User
 
Join Date: Jan 2003
Posts: 3,575
There is no way to directly change a SMS tablespace to DMS. You will have to create the DMS tablespace, then move all the objects in the SMS tablespace to the ne one.

What about doing a REORG to reclaim the space?

Andy
Reply With Quote
  #3 (permalink)  
Old 01-21-09, 22:47
Marcus_A Marcus_A is offline
Registered User
 
Join Date: May 2003
Location: USA
Posts: 5,196
Quote:
Originally Posted by itsonlyme44
I would like to make it a DMS tablespace so that I can reclaim over 30GB in storage!!!
SMS (unlike DMS) automatically reclaims storage (but like DMS you may want to do a reorg).

The advantage of DMS is not space utilization, but slightly better performance in certain situations (but do not use DMS for system temporary tablespaces).
__________________
M. A. Feldman
IBM Certified DBA on DB2 for Linux, UNIX, and Windows
IBM Certified DBA on DB2 for z/OS and OS/390
Reply With Quote
  #4 (permalink)  
Old 01-22-09, 08:15
itsonlyme44 itsonlyme44 is offline
Registered User
 
Join Date: Dec 2007
Posts: 261
Do you mean reorging all the tables in the the tablespace to reclaim the space?? The problem is that there is 32 GB allocated to this SMS tablespace and unlike a DMS, I cannot alter and pare the size down.. So is my only option to create a new DMS tablespace and move all the object to it??
Reply With Quote
  #5 (permalink)  
Old 01-22-09, 12:11
Marcus_A Marcus_A is offline
Registered User
 
Join Date: May 2003
Location: USA
Posts: 5,196
Quote:
Originally Posted by itsonlyme44
Do you mean reorging all the tables in the the tablespace to reclaim the space?? The problem is that there is 32 GB allocated to this SMS tablespace and unlike a DMS, I cannot alter and pare the size down.. So is my only option to create a new DMS tablespace and move all the object to it??
An SMS tablespace does not have specific amount of space allocated to it. It resides on a specified path (or paths) and automatically grows and shrinks as needed.

However, in for a page to be freed up, and for the tablespace size to shrink, all rows in the page must be deleted. If you reorg the table, then that will take care of the problem. Just do it.
__________________
M. A. Feldman
IBM Certified DBA on DB2 for Linux, UNIX, and Windows
IBM Certified DBA on DB2 for z/OS and OS/390
Reply With Quote
  #6 (permalink)  
Old 01-22-09, 12:41
itsonlyme44 itsonlyme44 is offline
Registered User
 
Join Date: Dec 2007
Posts: 261
Thanks! I'll give it a shot!!!
Reply With Quote
  #7 (permalink)  
Old 01-22-09, 13:19
itsonlyme44 itsonlyme44 is offline
Registered User
 
Join Date: Dec 2007
Posts: 261
I was wrong about this being an SMS tablespace:

List Tablespace
Tablespace ID = 2
Name = USERSPACE1
Type = Database managed space
Contents = All permanent data. Large table space.
State = 0x0000

I reorged all the tables in the Tablespace and I did a new snapshot. I still have 32GB allocated and only 7% utilization in the tablespace.. Still trying to figure out how to reclaim this 30GB ???
Reply With Quote
  #8 (permalink)  
Old 01-22-09, 13:42
n_i n_i is offline
:-)
 
Join Date: Jun 2003
Location: Toronto, Canada
Posts: 4,449
You need to resize the tablespace container(s), obviously. You may need to run db2dart with the /lhwm switch - it will suggest the ways to lower the high watermark of data in the tablespace.

By the way, this is the reason why you don't want your temporary tablespaces to be DMS.

Last edited by n_i; 01-22-09 at 13:48.
Reply With Quote
  #9 (permalink)  
Old 01-22-09, 16:49
Marcus_A Marcus_A is offline
Registered User
 
Join Date: May 2003
Location: USA
Posts: 5,196
Quote:
Originally Posted by n_i
By the way, this is the reason why you don't want your temporary tablespaces to be DMS.
Yes, and another important reason is that when DB2 creates a table in a DMS tablespace it spend extra time looking around to find the best place to put it to have optimum performance. This works well for regular tables that are created once and used many times, but the extra time to optimize the placement is a performance issue when DB2 creates temporary tables for sorting, etc during the execution of a query.
__________________
M. A. Feldman
IBM Certified DBA on DB2 for Linux, UNIX, and Windows
IBM Certified DBA on DB2 for z/OS and OS/390
Reply With Quote
  #10 (permalink)  
Old 01-22-09, 16:53
Marcus_A Marcus_A is offline
Registered User
 
Join Date: May 2003
Location: USA
Posts: 5,196
Quote:
Originally Posted by itsonlyme44
I was wrong about this being an SMS tablespace:

List Tablespace
Tablespace ID = 2
Name = USERSPACE1
Type = Database managed space
Contents = All permanent data. Large table space.
State = 0x0000

I reorged all the tables in the Tablespace and I did a new snapshot. I still have 32GB allocated and only 7% utilization in the tablespace.. Still trying to figure out how to reclaim this 30GB ???
Do a "list tablespaces show detail" to determine the high water mark of the tablespace. You can resize the tablespace to the high water mark.
__________________
M. A. Feldman
IBM Certified DBA on DB2 for Linux, UNIX, and Windows
IBM Certified DBA on DB2 for z/OS and OS/390
Reply With Quote
  #11 (permalink)  
Old 01-22-09, 18:33
itsonlyme44 itsonlyme44 is offline
Registered User
 
Join Date: Dec 2007
Posts: 261
Please excuse my ignorance.. but how to do resize to the high water mark?? When I try and alter the tablespace via the control center... the option to change the size is not there like it is on the other DMS tablespaces....
Reply With Quote
  #12 (permalink)  
Old 01-22-09, 19:36
Marcus_A Marcus_A is offline
Registered User
 
Join Date: May 2003
Location: USA
Posts: 5,196
Check out the SQL Reference Vol 2 manual for alter tablespace. You can use InfoCenter or get the PDF manuals for free.
__________________
M. A. Feldman
IBM Certified DBA on DB2 for Linux, UNIX, and Windows
IBM Certified DBA on DB2 for z/OS and OS/390
Reply With Quote
  #13 (permalink)  
Old 01-22-09, 20:00
itsonlyme44 itsonlyme44 is offline
Registered User
 
Join Date: Dec 2007
Posts: 261
alter tablespace userspace1 resize (all 10000)

returns this:

Table space "USERSPACE1" of type "AUTOMATIC STORAGE" cannot be altered using the "RESIZE
Reply With Quote
  #14 (permalink)  
Old 01-22-09, 21:17
n_i n_i is offline
:-)
 
Join Date: Jun 2003
Location: Toronto, Canada
Posts: 4,449
Just drop it and create a new SMS tablespace.
Reply With Quote
  #15 (permalink)  
Old 01-23-09, 11:50
itsonlyme44 itsonlyme44 is offline
Registered User
 
Join Date: Dec 2007
Posts: 261
I guess you mean backup, drop then restore the tablespace?? Can I chance DMS to SMS and vice versa on a restore?
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