Solved

Shrinking SQL Log File

Posted on 2012-03-22
2
489 Views
Last Modified: 2012-03-22
I need to shrink a SQL log file, but the log file is named exactly the same as the DB (with the exception of the ".ldf" extension and it's on a different drive.   I'm scared that if I call

DBCC SHRINKFILE(N'CRMDB', 1)

it will try to shrink the database, not the log.   How do I ensure the logfile will be what is shrunk?  My code is below.

USE CRMDB
GO
ALTER DATABASE CRMDB
SET RECOVERY SIMPLE
DBCC SHRINKFILE(N'CRMDB', 1)
ALTER DATABASE CRMDB
SET RECOVERY FULL
GO
0
Comment
Question by:saturation
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
2 Comments
 
LVL 16

Assisted Solution

by:The_Kirschi
The_Kirschi earned 500 total points
ID: 37753660
Why don't you specify the filename as CRMDB.ldf?

You could also use the Management Studio like this:
      

Right click on the database name.

Select Tasks -> Shrink -> Database
0
 
LVL 16

Accepted Solution

by:
The_Kirschi earned 500 total points
ID: 37753673
Try to get the logical file name of the transaction log like specified here and use that one:

http://stackoverflow.com/questions/1435935/how-to-get-the-logical-name-of-the-transaction-log-in-sql-server-2005
0

Featured Post

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

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

INTRODUCTION: While tying your database objects into builds and your enterprise source control system takes a third-party product (like Visual Studio Database Edition or Red-Gate's SQL Source Control), you can achieve some protection using a sing…
Data architecture is an important aspect in Software as a Service (SaaS) delivery model. This article is a study on the database of a single-tenant application that could be extended to support multiple tenants. The application is web-based develope…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.

724 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