SQL: Truncating a SQL Database Log

Thanks to John McBride for helping me with this.

1. In SQL Management Studio, make sure you are connected to ‘master’ in the available databases drop-down box.

2. Click ‘New Query’ to open a query window.

3. Get the logfile name by:

     a. Right-click the database

     b. Select Properties

     c. Click Files

     d. Note the name of the log file.

4. Type the following in the query window:

          Use <YOUR_DB_NAME>
          Go
          backup log <YOUR_DB_NAME> with truncate_only
          go
          dbcc shrinkfile(<YOUR_DB_LOGFILE_NAME,1)
          go

5. Click the Execute button.

Advertisements
Explore posts in the same categories: Uncategorized

Tags: , , ,

You can comment below, or link to this permanent URL from your own site.

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: