Solved

Compacting MS SQL Server 2000 database

Posted on 2004-09-21
5
196 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
  • 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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Paint/Redraw window while dragging 16 85
using Access 8 83
vb6 connector to mongodb 2 138
how to Classify of email (pdf attachments) 7 49
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…
The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

685 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