Link to home
Start Free TrialLog in
Avatar of detox1978
detox1978Flag 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.

User generated image

Many thanks
SOLUTION
Avatar of Kyle Abrahams, PMP
Kyle Abrahams, PMP
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of 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)?
The recovery mode is set to FULL
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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.
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 ...;
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?
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.
Running the following reduced the size.

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

Many thanks
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...

User generated image
Any ideas what I've done wrong / differently?

I've opened a new question for it here

Many thanks
D