0

I've created a SQL job to clear LDF file which runs once in a week.

Below is the screen shot for steps i've done.

Steps added for sql job

Also I've tried below queries

DBCC SHRINKFILE ('C:\MSSQLDATA\LOG\HDE.ldf', 1);

USE HDE;
GO
DBCC SHRINKFILE ('C:\MSSQLDATA\LOG\HDE.ldf', 1);
GO

Any one help me that how can i run my job successfully by clearing the LDF log file.

Thanks nag

nag
  • 920
  • 6
  • 27
  • 51
  • 3
    You shouldn't be *clearing* your `.ldf` file..... it's there **for a very good reason!** You need to learn proper transaction log backup procedures... – marc_s Apr 14 '15 at 07:39
  • Due to increase performance of machine we decide to do this once in a week. In future will include backup code also if needed. – nag Apr 14 '15 at 08:30
  • Now that you have shrunk your LDF file..... it needs to grow again. Growing physical files take I/O and time. – Nick.Mc Apr 14 '15 at 10:04
  • Nick - Yeah that's why i created job and scheduled weekly once to clear/shrink the data. – nag Apr 14 '15 at 13:15

1 Answers1

0

Found answer my self, below worked for me

DBCC SHRINKFILE (HDE_log, 1);

By using above command it reduced from 16GB to 127MB, but is there any better solution to shirnk upto 1MB or 0MB?

Thanks

nag
  • 920
  • 6
  • 27
  • 51