Useful Stuff #2

logo-MS-SQL-Server

In Sql Server, if your scheduled  maintainance plan holds a backup of your database and its log transaction, and it fails, it will cause lots of space loss. Here’s how to arrange that quickly, but you must revisit your maintainance plan… that’s a better idea.


USE [DATABASE_NAME]
GO
CHECKPOINT
BACKUP TRANSACTION [DATABASE_NAME]WITH NO_LOG
DBCC SHRINKFILE('[DATABASE_LOG_FILE]',5000)
DBCC SHRINKDATABASE('[DATABASE_NAME]',10)

Advertisements

About Salem Ben Afia

Big Data & Java developer

Posted on January 31, 2013, in Database and tagged , , . Bookmark the permalink. Leave a comment.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: