Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase ««12

how to shrink logfile ? Expand / Collapse
Author
Message
Posted Monday, December 3, 2012 6:03 AM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Yesterday @ 11:55 AM
Points: 6,752, Visits: 14,397
ravi@sql (12/3/2012)
ya maxsize is given for autogrowth

What are the size details for the log currently?
Do you have any long running transactions?


-----------------------------------------------------------------------------------------------------------

"Ya can't make an omelette without breaking just a few eggs"
Post #1391888
Posted Monday, December 3, 2012 6:09 AM
SSC Journeyman

SSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC Journeyman

Group: General Forum Members
Last Login: Monday, May 26, 2014 6:02 AM
Points: 93, Visits: 195

Thank you all .

Regards,
Ravi@sql
Post #1391891
Posted Monday, December 3, 2012 6:11 AM
SSC Rookie

SSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC Rookie

Group: General Forum Members
Last Login: Thursday, July 24, 2014 11:46 PM
Points: 42, Visits: 290
ravi@sql (12/3/2012)
ok cant i point my log file path any other drive ? if yes how can i do that ? pls share the query ?

Thanks
Ravi@sql


If you want to move the existing t-log file to different location then, follow the below steps:
1. Run ALTER DATABASE command and change location of ldf file
2. Take database offline
3. Move the physical file from old location to new location.
3. Bring database online

You can also try to add second log file to your database


USE [master]
GO
ALTER DATABASE [DB_NAME] ADD LOG FILE ( NAME = N'second_log_file', FILENAME = N'D:\LOG_FILES\second_log_file.ldf' , SIZE = 1024KB , FILEGROWTH = 10%)
GO
Post #1391896
Posted Tuesday, December 4, 2012 6:57 AM


Old Hand

Old HandOld HandOld HandOld HandOld HandOld HandOld HandOld Hand

Group: General Forum Members
Last Login: Friday, November 21, 2014 8:48 AM
Points: 323, Visits: 986
arunyadav007 (12/3/2012)


USE MASTER
GO
DBCC FREESESSIONCACHE WITH NO_INFOMSGS
GO
DBCC FREESYSTEMCACHE 'ALL'
GO


and how does it will help to manage the log space ?

you are just adding trouble to existing issues


-----------------------------------------------------------------------------
संकेत कोकणे
Post #1392456
Posted Tuesday, December 4, 2012 7:00 AM


Old Hand

Old HandOld HandOld HandOld HandOld HandOld HandOld HandOld Hand

Group: General Forum Members
Last Login: Friday, November 21, 2014 8:48 AM
Points: 323, Visits: 986
@OP ,please do check Gail's post for managing log file

http://www.sqlservercentral.com/articles/Administration/64582/


-----------------------------------------------------------------------------
संकेत कोकणे
Post #1392461
Posted Tuesday, December 4, 2012 7:10 AM


SSC-Forever

SSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-Forever

Group: General Forum Members
Last Login: Yesterday @ 8:36 AM
Points: 40,615, Visits: 37,080
arunyadav007 (12/3/2012)
If not, you can try this

USE MASTER
GO
DBCC FREESESSIONCACHE WITH NO_INFOMSGS
GO
DBCC FREESYSTEMCACHE 'ALL'
GO
USE (YOURDBNAME)
GO
DBCC SHRINKFILE (N'LOGFILENAME', 0, TRUNCATEONLY)
GO
DBCC SHRINKFILE (N'LOGFILENAME' , 1024)
GO



Well, I suppose that you can try that, but since none of those will help in the slightest with a full transaction log and may in fact make the scenario worse, I personally would recommend that you don't try any of those commands.



Gail Shaw
Microsoft Certified Master: SQL Server 2008, MVP
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

We walk in the dark places no others will enter
We stand on the bridge and no one may pass

Post #1392468
« Prev Topic | Next Topic »

Add to briefcase ««12

Permissions Expand / Collapse