Wednesday, March 21, 2012

How to Reduce or Delete the Log file... Log file size creating problem

I am using Replication with two of my SQL Server Databases , One Db is Publisher and other one is Subscriber , and data is continously replicating after every 5 mins . Now Publisher Database Log File increased upto 2541 MB and its creating problem while having any transaction or having any operation with DB . It also turned Replication utility Off.

I tried to delete log file by turning SQL Server off , but it makes DB mode SUSPECT and UNACCESSBLE.

Plz help me out to delete or reduce the log file size by maintaining the state of data.

Also let me know wht is the method so that log file can automatically delete its contents when reach to certain limit.

Regards
Imran MalikWhy are risking by deleting the SQL system files.

Use DBCC SHRINKFILE to reduce the Tlog file size, refer to books online for more information.|||You haven't mentioned about the version of SQL used.

If its version 7 then enable 'trunc.log at chkpt.' on the database.
If its version 2K then use SIMPLE RECOVERY model.

For more information again refer BOL.:)|||By changing to the simple recovery model, your only backup mechanism is the full or differential backup, you can no longer perform transaction log backups. If you need to shrink the file, however, and maintain the ability to perform transaction log backups, there is a Stored Procedure I found at SQLServerCentral.com. It's called sp_force_shrink_log and I find it quite useful. You can find it at http://www.sqlservercentral.com/scripts/contributions/26.asp after you register with them.|||Thank You very much Satya and loach for telling me the way to reduce the size , I am using SQL Server 2K .

DBCC SHRINKFILE and sp_force_shrink_log are helpful for reducing file size but for log deletion wht I have done is just deattach the database , remove log file and and attach db again , it refreshed and made DB log again with 1 MB. (I tested this with dummy Dbs.)

and my Databases are also connected through replication utility , so it restricts me to deattach db using in replication , so I have to turned replication off to deattach and attach db . currently I am looking into procedure or way so that without disabling replication make log refresh coz it will take long process to disable and then again follow through steps for having last settings to turn replication ON between 2 databases.

Thanks u All

Regards
Imran|||How about the backups schedule interval for LOG?

No comments:

Post a Comment