Solved

Compacting MS SQL Server 2000 database

Posted on 2004-09-21
5
200 Views
Last Modified: 2013-12-25
Hi experts,
How to compact a MS SQL Server 2000 database from within VB6 using SQLDMO?
Thanks in advance,
Ganaa
0
Comment
Question by:Ganaa
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
5 Comments
 
LVL 70

Expert Comment

by:Éric Moreau
ID: 12121329
There is no such thing. It is not like Access. SQL re-use its lost space itself.
0
 
LVL 7

Accepted Solution

by:
kmorris1186 earned 50 total points
ID: 12126374
This is the closest you going to get to the "compact" feater of Access..

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/tsqlref/ts_dbcc_3pd1.asp

also preforms the same function as "Shrink" from Enterprise Manager.
0
 

Expert Comment

by:XgenX
ID: 12147078
The proper way to do this is to set up a database maintenance plan in the SQL Enterprise Manager. This is where you will set up a backup plan for the database. I find that it works best if you set up a database backup and a log file backup seperately. Depending on the strain on your database you could do something like backup the full database twice a day, and backup the log file every 20 minutes. In the database properties set the autoshrink property to true. The database files will be trimmed when the database is backed up but the log files are trimmed when the log is backed up. This is why you may see an enourmous log file and you may have to go into query analyzer and type 'backup log <databasename> with truncate_only'. There are other settings in the backup that will redo the indexes and allow you to set the freespace size to something like 20% or so so that it won't have to resize the database as soon as someone writes to it.
0
 

Expert Comment

by:XgenX
ID: 12147087
By the way, if you want, you may be able to set up that maintenance plan in SQLDMO.
0

Featured Post

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

729 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question