Avatar of parabellum
parabellum
 asked on

Too big ldf file


We have a Ms SQL database server 2005.
The problem is that the ldf file got too big. And Now the server harddisk is full.
Because of this we can't open or modify the database. 0t is offline so shrink does not work.
How can we solve this problem without damaging the actual data ?
thanks
Microsoft SQL Server

Avatar of undefined
Last Comment
parabellum

8/22/2022 - Mon
SOLUTION
James Murrell

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.
parabellum

ASKER
Thanks but we can not reach the database right now.  We have found a way.
We may delete the ldf file and then use sb_attach query to recreate the ldf file.
Our solution work for smaltrivial databases.

But the mdf file size is 30 GB and the ldf file is 140 GB.
We are kind of scary to delete the ldf file :)
Only operation we can do to the database is to detach it. Shrink or etc is not working currently, or back up...
David Todd

Hi,

have you tried
backup log myDatabaseName with truncate_only
and then shrinking the file?

You may need a couple of iterations.

First make sure you have a full-backup. after log is shrunk take full backup.

Cheers
  David
parabellum

ASKER
thanks but like i said ,
when i right click  my database , back up or shrink is inactive.
so i can not use back up right now.
Experts Exchange is like having an extremely knowledgeable team sitting and waiting for your call. Couldn't do my job half as well as I do without it!
James Murphy
James Murrell

why do it in QA
parabellum

ASKER
0 am not sure i understand that but currently we can't run any queries either.
chapmandew

Is the service running?
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
parabellum

ASKER
yes it is  currently running. There are other small databeses on the server that  are working fine.
ASKER CERTIFIED SOLUTION
chapmandew

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.
parabellum

ASKER
thanks for your article . My case is the "disk space problem."

normally i may right click then select properties and then add a new logfile.

But when i select properties  it throws an exception "data base inaccessible due to insufficient hard
disk space".   error code 945
SOLUTION
David Todd

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.
chapmandew

thanks david.

are there any other databases that you can shrink or move to free up some space first?
Experts Exchange has (a) saved my job multiple times, (b) saved me hours, days, and even weeks of work, and often (c) makes me look like a superhero! This place is MAGIC!
Walt Forbes
parabellum

ASKER

I have other  partitions that have enough disk space.
But i am so afraid of playing with the ldf file. (0f i lost the database that will be a real pain....)

But i see that only way to free up my  partition is to somehow delete the ldf file and the use sb_attach.