Avatar of detox1978
detox1978
Flag for United Kingdom of Great Britain and Northern Ireland asked on

SQL 2000: Shrink LDF file

Hi All,

I have a Windows 2003 Server running MS SQL 2000.  One of the databases log file is 160GB.

Whats the best way to shrink it?  And ideally stop it from growing over 50GB.

Its a virtual server, so doesnt have any SQL Backups currently setup.

MS SQL 2000

Many thanks
Microsoft SQL ServerMicrosoft SQL Server 2005Microsoft SQL Server 2008

Avatar of undefined
Last Comment
detox1978

8/22/2022 - Mon
SOLUTION
Kyle Abrahams, PMP

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
ASKER CERTIFIED SOLUTION
lcohan

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
detox1978

ASKER
I guess they are not needed.

Can I switch to simple (to reduce the size) then switch it back on (ideally with circular logging at 40GB)?
detox1978

ASKER
The recovery mode is set to FULL
SOLUTION
Kyle Abrahams, PMP

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
lcohan

Sure you can if no business rule is asking for FULL recovery mode where you can take T-log backups beside FULL backup for faster recovery.
I started with Experts Exchange in 2004 and it's been a mainstay of my professional computing life since. It helped me launch a career as a programmer / Oracle data analyst
William Peck
Scott Pletcher

In SQL 2000, you don't even technically need to go to SIMPLE mode.

Just shrink the log (first), using the "BACKUP" command, then take a full backup immediately (or as soon as you reasonably can).

BACKUP LOG baandb WITH TRUNCATE_ONLY;

BACKUP DATABASE baandb TO DISK = '...' WITH ...;
detox1978

ASKER
Hi Scott,

So do I run

BACKUP LOG baandb WITH TRUNCATE_ONLY;

Open in new window


then take a backup?  It's a virtual server, would a virtual snapshot be ok?
Scott Pletcher

Yes, shrink the log, then take a full backup.  I'm not sure what specifically a virtual snapshot means on your server.  But however you normally take a full backup of your dbs.
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
detox1978

ASKER
Running the following reduced the size.

[code]USE baandb
GO
CHECKPOINT
GO
DBCC SHRINKFILE (N'baandblog' , 0, TRUNCATEONLY)
GO[/code]

Many thanks
detox1978

ASKER
Hi All,


Sorry to be a pain.  But the server is running low on space again.  So I run the code below in query analyser on the server

USE baandb
GO
CHECKPOINT
GO
DBCC SHRINKFILE ('baandblog' , 0, TRUNCATEONLY)
GO

Open in new window


..and get the following...

SQL Results
Any ideas what I've done wrong / differently?

I've opened a new question for it here

Many thanks
D