Log file shrinking

hi every one
i m very happy getting reply from u all
here my doubt regarding log file shrink.in our environment all high avaliabilities are using (log shippimg,mirroring,replication) now my doubt is if i shrink log file of a database which is these H A what will be the reaction?does i ve to reconfigure or
not?
can i make snapshot database  for restoring database?
waiting for replies with anxiety
thanks&regards
chetan.tk

Hi chetan.kt,
What is the purpose of shrinking log file? It is recommend that backup the log file frequently as a period of some minutes if the log file is large. In case of more space is required for operation in SQL Server, you may consider to increase the disk space.
Befor shrinking, you should insight into the reason which leads to the log file grows unexpectedly: A transaction log grows unexpectedly or becomes full on a computer that is running SQL
Server.
For log shipping and database mirroring, you can shrink the log file on primary server with non-truncate, and the shrink operation will be log shipped to the secondary servers.
As for replicated database, you cannot be able to shrink the log file if replication is not completed. You may have a try to mark all replicated transactions as completed by stopping log reader agent and restart after shrinking. For more information:
Unable to shrink transaction log on replicated database - SQL 2008
It is not a good idea to shrink the log file. You may have a look at Tibor’s blog about the problem of shrinking log file:
Why you want to be restrictive with shrink of database files
Best Regards,
Stephanie Lv
Forum Support
Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact [email protected]

Similar Messages

  • Sql server 2005 log file shrinking issue.

    hi,
    one of my production server database  log file size is increasing continuously,we can take log backup but no use,
    we can change the database recovery model from  full to simple we shrink the log file, log file shrink successfully but space is not released,and we are getting the alerts continuously your physical disk is 95% like that.
    here what we can do how reduced the log file size and how to control the log file size.
    please give me the answer  ASAP.
    Thanks,

    Hello,
    In SQL Server, log truncation occurs automatically as follows:
    • Under the simple recovery model, after a checkpoint.
    • Under the full recovery model or bulk-logged recovery model, after a log backup, if a checkpoint has occurred since the previous backup.
    As Dan posted earlier, when we run the above code, we will get an integer value. The log_reuse_wait_desc value tells us why the transaction log space is not reused. You can refer to the article below to check the root cause. 
    http://msdn.microsoft.com/en-us/library/ms345414.aspx
    Regards,
    Alisa Tang
    Alisa Tang
    TechNet Community Support

  • Database Log file Shrink information

    Hello Team,
    Database log file shrink information: Due to space problem
    One of my database having 600 gb,under  600 gb log file having 260 gb, in this database we take full backup daily no log backup. If we shrink the log file any impact is happen?
                   We shrink the log file internally what will happen?
    One of my database having 600 gb,log file having 260 gb, in this database we take full backup daily and every 15 min take log backup.
    This is scenario we shrink the log file what will happen.

    Hello,
    You should not try to shrink the log file regularly, because is resource intensive, it takes a lot of time and it creates fragmentation on the disk storage.
    If you don’t backup the log files of the databases (option 1) you don’t have the ability to restore to a point in time between backups full and differential. If
    you don’t want to backup files then it makes sense to change the recovery model to simple.
    Backing up the logs regularly minimize the risk of the logs getting filled and extending their size.
    Hope this helps.
    Regards,
    Alberto Morillo
    SQLCoffee.com

  • Log file shrinking in SQL server

    Hi,
    I have a log file with initial size of 80 GB in C drive.
    Now we are having space issue in C drive, so i tried to shrink the log file, but its not reducing below initial size.
    Is it the default behavior or i missed anything while shrinking ?
    I used DBCC SHRINKFILE option to shrink it.
    How can i change the initial size of the log file ?
    If it has been set as 80 GB , because of that am i not able to free space in C drive ?
    Thanks,
    Vinodh Selvaraj

    Hello,
    Please check first the log reuse wait state of the databases, may you have to run an additional log backup before you can shrink the log file
    select name, log_reuse_wait_desc
    from sys.databases
    order by name
    Olaf Helper
    [ Blog] [ Xing] [ MVP]

  • SQL Server 2012 DB log file doesn't shrink (simple recovery model)

    I've found several similar questions in this forum, but none of the answers have resolved my problem: I have a SQL Server 2012 DB using simple recovery model.  The MDF file is 12 GB and the LDF file is 10 GB.  I'm trying to shrink the size of the
    LDF file.  I've read that for simple recovery model DBs there are reasons for delaying log file shrinking, but I still can't find a solution based on these reasons.
    When I try to shrink it using this command:
    DBCC SHRINKFILE(MyDB_log, 1000000)
    I get these results, and no change of file size:
    DbId FileId CurrentSize MinimumSize UsedPages EstimatedPages8 2 1241328 128 1241328 128
    The same results running this:
    DBCC SHRINKFILE(MyDB_log, 1000000, TRUNCATEONLY)
    There doesn't appear to be any open transactions:
    DBCC OPENTRAN()No active open transactions.DBCC execution completed. If DBCC printed error messages, contact your system administrator.
    And this returns NOTHING:
    SELECT name, database_id, log_reuse_wait_desc FROM sys.databases WHERE database_id = DB_ID()name database_id log_reuse_wait_descMyDB 8 NOTHING
    I've also tried running the following, but nothing useful is returned:
    SELECT * FROM sys.dm_tran_database_transactionsSELECT * FROM sys.dm_exec_requests WHERE database_id=DB_ID()SELECT * FROM sys.dm_tran_locks WHERE resource_database_id=DB_ID()
    Any other suggestions of what I can do to shrink this log file?  Or perhaps someone can justify its enormous size?
    David Collacott

    The answer is pretty simple.
    The following code is the problem:
    DBCC SHRINKFILE(MyDB_log, 1000000)
    You are telling SQL Server that you want to "shrink" the MyDB_log file and the target size is 1TB.  Well according to you the MyDB_Log file is well below the 1TB size you are targeting, in fact it's only 10GB so SQL Server is doing precisely what you
    are telling it to do.
    See, according to the SQL Server documentation
    here, target size "Is the size for the file in megabytes, expressed as an integer."
    Now if you'd like to actually shrink the log file down to, oh say 1GB, then you should try the following command:
    DBCC SHRINKFILE(MyDB_log, 1000)
    The theory being 1000 * 1048576 (i.e. 1MB) is equal to 1GB.

  • SQL log file size is extending rapidly

    Hello All,
    We are using ECC 6.0, our database is SQL 2005 & operating system is Windows NT 4x AMD64 L.
    Our database log file size is increasing rapidly, now its size is more than the all 4 data files (near about 300gb).
    Last week I tried to shrink log file but it didn't worked.
    Now less space is remained on disk, please help me.
    Now the system is started giving dump at the time of log in, & the dump is like "START_CALL_SICK ".
    I am attaching dump error text file.
    Please help why is this happening.
    Thanks in advance
    Mahendra

    Hi,
    I have backed up log file & shrink the file but it didn't worked for me
    What is the result? It shrinks the log and release all the space (for all committed transactions).
    How can i add another log file?
    Can i delete old log file after adding new log file.
    You can add another log file by following below steps. but in your case, this is not the right solution because you have good amount of log file configuration for your database (now its size is more than the all 4 data files (near about 300gb)).
    Open SQL server management studio > Expand database > Right click on database > Select Files > Click on Add > Give the input parameters (Logical file name, path, initial size etc.) click on OK
    If system is not allowing you to shrink the log file, it means you have active transactions in system which are continuously using your log file.
    Regards,
    Nick Loy

  • Question about full backup and Transaction Log file

    I had a query will taking full backup daily won't allow my log file to grow as after taking the full backup I still see the some of the VLF in status 2. It went away when I manually took the backup of log file. I am bit confused shall I
    perform backup of transaction log and full database backup daily to avoid such things in future also until I run shrinkfile the storage space from server won't get reduced right.

    yes, full backup does not clear log file only log backup does. once the log backup is taken, it will set the inactive vlfs in the log file to 0.
    you should perform log backup as the per your business SLA in data loss.
    Go ahead and ask this to yourself:  
    If  a disaster strikes and your database server is lost and your only option is restore it from backup, 
    how much data loss can your business handle??
    the answer to this question is how frequently your log backup should be?
    if the answer is 10 mins, you should have log backups every 10 mins atleast.
    if the answer is 30 mins, you should have log backups every 30 mins atleast.
    if the answer is 90 mins, you should have log backups every 90 mins atleast.
    so, when you restore, you will restore latest fullbackup+differential(latest one taken after restored fullback)
     and all the logbackups taken since the latest(restored full or differential backup).
    there several resources on web,inculding youtube videos, that explain these concepts clearly.i advice you to look at them.
    to release the file space to OS, you should the shrink the file. log file shrink happens from the end upto the point it reaches an active vlf.
    if there are no inactive vlf's in the end,despite how many inactive vlf's the log file has in the begining, the log file is not shrinkable
    Hope it Helps!!

  • How to know the history of shrinking log files in mssql

    hello,
    In my SAP system some one shrinked the log file to 100 GB to 5 GB.How we would check when this
    was shrinked recently .
    Regards,
    ARNS.

    hi,
    Did u check the logfile in sapdirectory.There will be entry of who changed the size and the time.
    Also,
    Goto the screen where we usually change the logfile size.In that particular field press f1 and goto technical setting screen. Get the program name , table name  and field name.
    Now using se11 try to open the table and check whether the changed by value is there for that table.
    Also open the program and debug at change log file process block.use can see in which table it update the changes.
    There is a case of caution in this case.
    The size of the application server's System Log is determined by the
    following SAP profile parameters. Once the current System Log reaches
    the maximum file size, it gets moved to the old_file and and a new
    System Log file gets created. The number of past days messages in the
    System Log depends on the amount/activity of System Log messages and the
    max file size. Once messages get rolled off the current and old files,
    they are no longer retrievable.
    rslg/local/file /usr/sap/<SID>/D*/log/SLOG<SYSNO>
    rslg/local/old_file /usr/sap/<SID>/D*/log/SLOGO<SYSNO>
    rslg/max_diskspace/local 1000000
    rslg/central/file /usr/sap/<SID>/SYS/global/SLOGJ
    rslg/central/old_file /usr/sap/<SID>/SYS/global/SLOGJO
    rslg/max_diskspace/central 4000000  .

  • Shrink Log File on High Availability

    Dear support
    good day for you,
    i using SQL server 2012 and using AlwaysON High Availability (server_SQL1 = Primary & Server_SQL2=Secondary), when i try to shrink the log files he told me you must alter the database to simple recovery mode first but i cant coz using AlwaysON !
    thats mean:
    remove the DB's from AlwaysON (Server_SQL1)
    Shrink Files
    remove DB's from Server_SQL2
    add again DB's to AlwaysON
    any other solution for shrink logs without add/remove DB from AlwaysON
    Regards,

    The link that Uri has is correct, but let me expand on it for anyone else that runs across this issue:
    You don't actually need to be in the simple recovery model to shrink a file or the log. The reason why some people make the switch is because changing to the simple recovery model lets the database automatically clear the logs. This *generally* puts the
    VLF in use at the very beginning of the log. Since shrinking a log file works differently from data files (log only works from the end of the log until the first used vlf) it allows for a fast shrink and grow operation to fix up the log.
    In the full recovery model it is still possible, the difference being that you'll need to check to see which VLF the database is currently using and you may have to manually cause the log to circle around (by log backups, etc) to get a good shrink so
    that you can grow at a proper size.
    Sean Gallardy | Blog |
    Twitter

  • Shrink Log File on MS sql 2005

    Hi all,
    My DB has a huge logfile, with more than 100gb.
    The idea is to shrink it, but the good way.
    I was trying this way:
    use P01
    go
    backup log P01 TO DISK = 'D:\P01LOG1\P01LOG1.bak'
    go
    dbcc shrinkfile (P01LOG1,250) with no_infomsgs
    go
    The problem is that the backup file is getting bigger and bigger each backup.
    So, my question is, how to shrink the logfile, correctly, with backup, but that backup should not increase but stay at the same level, overwriting the backups.
    I have full dayly backup with data protector from HP, but it doesn't clean the log, and it isn't possible to shrink it.

    What you want to do with the log backups depends on how you are going to recover the database in case the system/database loss and your backup schedule.
    1. If you are not going to do point in time recovery then there is no point in taking a tran log backup to a backup file. You can change the recovery model of the database to "simple". If your recovery model is "simple" you don't have to take transaction log backups at all. The inactive transactions are flushed from the log automatically. You should still be taking full and differential backups so that you can atleast recover your database to last full backup and apply the latest differential backup.
    2. If this is a production system then you should definitly be on "full" recovery mode and should be taking regular transaction log backups and storing them in a safe place so that you can use them to recover your system to any point in time. Storing the transaction log backup on the same server kind of defeats the purpose because if you lost the server and disks you will not have the backups either.
    3. If you are in full recovery mode and lets assume that you run your transaction log backups every 30 mins then you need your log file to be of the size that can handle the transactions that happen in any given 30 to 60 mins.
    There shouldn't be a need to constantly shrink log files if you configure things right.
    Edited by: Neeraj Nagpal on Aug 20, 2010 2:48 AM

  • Cannot shrink log file 2 because the logical log file located at the end of the file is in use ?

    HI,
    I am getting this error frequently.. any recomendations :
    Executed as user: DB0\sqlservices. Processing database: dbin [SQLSTATE 01000] (Message 0) 
    Cannot shrink log file 2 (DB_log) because the logical log file located at the end of the file is in use. [SQLSTATE 01000] (Message 9008) 
    Processing database: DB_ [SQLSTATE 01000] (Message 0)  DBCC execution completed. If DBCC printed error messages, contact your system administrator. [SQLSTATE 01000] (Message 2528) 
    Cannot shrink log file 2 (DB_log) because the logical log file located at the end of the file is in use. [SQLSTATE 01000] (Message 9008) 
    Processing database: DB [SQLSTATE 01000] (Message 0) 
    DBCC execution completed. If DBCC printed error messages, contact your system administrator. [SQLSTATE 01000] (Message 2528) 
    Backup, file manipulation operations (such as ALTER DATABASE ADD FILE) and encryption changes on a database must be serialized. Reissue the statement after the current backup or file manipulation operation is completed. [SQLSTATE 42000] (Error 3023) 
    Processing database: DB_AC [SQLSTATE 01000] (Error 0)  
    [SQLSTATE 01000] (Error 0)  DBCC execution completed. If DBCC printed error messages, contact your system administrator. [SQLSTATE 01000] (Error 2528). 
    The step failed.
    Please give any receomendations to avoid this error in future :
    Yangamuni Prasad M

     
    Hi Yangamuni,
    Are there any progress?
    Please have a look on the below threads with the similar issues as yours:
    http://www.sqlservercentral.com/Forums/Topic652579-146-1.aspx
    http://social.msdn.microsoft.com/forums/en-US/sqldatabaseengine/thread/ae4db890-c15e-44de-a2af-e85c04260331
    The solution is change the recovery mode to SIMPLE, shrink log files and then change to the FULL recovery mode.
    Thanks,
    Weilin Qiao
    Please remember to mark the replies as answers if they help and unmark them if they provide no help. This can be beneficial to other community members reading the thread.

  • MS_SQL Shrinking Log Files.

    Hi Experts,
    We have checked the documentation which have been received from SAP (SBO_Customer portal), Based on the Early Watch Alert.
    AS per SAP requsition we have minimized the size of 'Test Database Log' file  through MS_SQL Management Studio.(Restricted file size 10 percent, size 10 MB)
    Initially it was 50 Percent, 1000 MB
    Doubt is:
    Is that any problem will occur in future regarding this changes of 'LOG FILES'.
    Kindly help me.
    Based on your reply ...
    i will update in live production database....
    By
    kart

    The risk to shrink log file is fairly small.  Current hardware and software has much better reliability than before.  When you shrink your log file, you just lose some history which nobody even know there is any value in it.
    On the contrary, if you keep very large log file, it may cause more troubles than doing anything good.
    Thanks,
    Gordon

  • Log file size is huge and cannot shrink.

    I have a live database that is published with merge replication and a couple of push subscriptions. I just noticed that the log file has grown to 500GB. The database is in full recovery. We do weekly full backups, daily log backups. I cannot shrink the log
    file back down to normal proportions. It should only be about 5GB. The file properties show an initial size equal to the current size, I cannot change that number and I don't know why it is so big now? How do I go about shrinking the log file. the normal DBCC
    shrink and the SSMS GUI to shrink are not doing anything and say there is 0MB space free!!

    As per your first posing log_reuse_wait_desc was LOG_BACKUP
    and in 2nd REPLICATION . i am consfused
    if
    log_reuse_wait_desc  column
    shows LOG_BACKUP then table log backup of your db, if it is REPLICATION 
    and you are sure that your replications are in sync then reset the status of replicated transactions
    You can reset this by first turning the Reader agent off ( turn the whole SQL Server Agent off), and then run that query on the database for which you want to fix the replication issue:
    EXEC sp_repldone @xactid = NULL, @xact_segno = NULL, @numtrans = 0, @time= 0, @reset = 1
    vt
    Please mark answered if I've answered your question and vote for it as helpful to help other user's find a solution quicker

  • Shrink Log file in log shipping and change the database state from Standby to No recovery mode

    Hello all,
    I have configured sql server 2008 R2 log shipping for some databases and I have two issues:
    can I shrink the log file for these databases: If I change the primary database from full to simple and shrink the log file then change it back to full recovery mode the log shipping will fail, I've seen some answers talked about using "No
    Truncate" option, but as I know this option will not affect the log file and it will shrink the data file only.
          I also can't create maintenance to reconfigure the log shipping every time I want to shrink the log file because the database size is huge and it will take time to restore in the DR site, so the reconfiguration
    is not an option :( 
    how can I change the secondary database state from Standby to No recovery mode? I tried to change it from the wizard and wait until the next restore for the transaction log backup, but the job failed and the error was: "the step failed". I need
    to do this to change the mdf and ldf file location for the secondary databases.
    can any one help?
    Thanks in advance,
    Faris ALMasri
    Database Administrator

    1. can I shrink the log file for these databases: If I change the primary database from full to simple and shrink the log file then change it back to full recovery mode the log shipping will fail, I've seen some answers talked about using "No Truncate"
    option, but as I know this option will not affect the log file and it will shrink the data file only.
          I also can't create maintenance to reconfigure the log shipping every time I want to shrink the log file because the database size is huge
    and it will take time to restore in the DR site, so the reconfiguration is not an option :( 
    2. how can I change the secondary database state from Standby to No recovery mode? I tried to change it from the wizard and wait until the next restore for the transaction log backup, but the job failed and the error was: "the step failed". I need to do
    this to change the mdf and ldf file location for the secondary databases.
    can any one help?
    Thanks in advance,
    Faris ALMasri
    Database Administrator
    1. If you change recovery model of database in logshipping to simple and back to full Logshipping will break and logs wont be resored on Secondary server as log chain will be broken.You can shrink log file of primary database but why would you need that
    what is schedule of log backup. Frequent log backup is already taking care of log files why to shrink it and create performance load on system when log file will ultimately grow and since because instant file initilaization is not for Log files it takes time
    to grow and thus slows performace.
    You said you want to shrink as Database size is huge is it huge or does it have lots of free space. dont worry about data file free space it will eventually be utilized by SQL server when more data comes
    2. You are following wrong method changing state to no recovery would not even allow you to run select queries which you can run in Standby mode. Please refer below link to move Secondary data and log files
    http://www.mssqltips.com/sqlservertip/2836/steps-to-move-sql-server-log-shipping-secondary-database-files/
    Please mark this reply as answer if it solved your issue or vote as helpful if it helped so that other forum members can benefit from it.
    My TechNet Wiki Articles

  • Shrink Transaction log file - - - SAP BPC NW

    HI friends,
    We want to shrink the transaction log files in SAP BPC NW 7.0, how can we achieve thsi
    Please can you throw some light on this
    why we thought of ghrinking the file ?
    we are getting "out of memory " error when ever we do any activity. so we thought of shrinking the file (this is not a production server - FYI)
    example of an activity where the out of memeory issueee appears
    SAP BPC excel >>> etools >>> client options >>> refresh dimension members >>> this leads to a pop-up screen stating that "out of memory"
    so we thought of shrinking the file.
    Please any suggestions
    Thank you and Kindest Regards
    Srikaanth

    HI Poonam,
    Not only the excel is throwing this kind of message (out of memory) - the SAP note is helpful, if we have error in excel alone
    But we are facing this error every where
    We have also found out that our Hard disk capacity as run out of space.
    we want to empty the log files and make some space for us.
    our hard disk is now having only few MegaBytes now
    we want to clear our all test data, log files, and other stuffs
    Please can you recommed us some way
    Thank you and Kindest regards
    Srikaanth

Maybe you are looking for

  • Macbook Pro - 2 Hard Drives - Dual Boot OS OSX + Windows

    Hello guys, I've been facing an issue here I bought an SSD 2 years ago and changed the original MBP HD. I did a fresh install of OSX while still having my optical drive. Everything is fine with the OSX installation. Recently I bought an enclosure and

  • Get multiple files with jftp

    Hello, I want to create a job definition of type perl for ftp using the jftp binary supplied with each platform agent because it delivers error codes in case of problems. The command "get" works fine with one file. But I like to get multiple files by

  • 9500 Mark II Printer and Photoshop (Mac) Quality and Media Grayed Out

    I have a PIXMA 9500 Mark II.  I am using the printer on an iMac.  In Photoshop, when I choose Quality and Media, the area to choose paper type and tray are grayed out.  It work fine in Safari. I have spoken to Canon, Apple and Adobe and no one seems

  • How to Deactivate callable object/Action in GP

    Hi Friends I want to know that once we activate one particular action or callable object or process GP(Guided Procedure).How can i deactivate it? Regards Sunny Shah.

  • MRP Exception Message 64

    Requirement Date of my FGs PIR is June 2nd, after executing MRP Run..Requirement date proposed by MRP for the exploded SFG (dependant requirement) is 3rd June with an exception message of 64 "Production finish after order finish"..I am unable to unde