Solved

Compacting MS SQL Server 2000 database

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

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
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 process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

785 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