Tuesday, January 6, 2009

How to reduce the size of the database in Microsoft SQL Server

On hosting server often exists database quota for MS SQL Server. Even if your database contains small amount of data, but there is goes intensive adding/modifacation of the data, in some point the size of the data could exceed quota and your account may be suspended.
This happens because of growth of the transaction log.
To clear transaction log you can execute the following command:

BACKUP LOG [databasename] WITH TRUNCATE_ONLY

After this you will need to make Shrink Database

For example. One of my databases decreased form 890MB to 12MB.

It should be noted, before the next backup your database remains unprotected (failure of equipment, etc.) as well as transaction log, we cleaned.

No comments: