sql 2005 and logshipping

  • hi,

    I have a basic question since years ago now, I did not find any solution.

    One database on one server name SQL1.

    I active the logshipping on this database, witch forced me to pass the recovery model simple to full. (logshipping wont be active if I didnt made this change).

    The secondary server witch will receive my logshipping database name SQL2.

    All work perfectly, my logshipping is set up with no problem, and work very well.

    But i have now a hudge problem... space disk probleme, because the .LDF of by database are now very big.

    And all the option in SQL to stop the file grow break the logshipping, if I use it. Like "shrink or anything else".

    Is there a solution to fixe that ? or it's a normal issu when we active the logshipping?

    thanks for your help

  • The transaction log will be kept in check by a regular full backup schedule. If you're using a full recovery model, you should be prepared for a greater transaction log space requirement. Consider speaking to your SAN admin / person responsible for storage to get more disk space allocated to the LUN housing the transaction logs. Monitor your transaction log sizes before and after backups.

    ---

    Note to developers:
    CAST(SUBSTRING(CAST(FLOOR(NULLIF(ISNULL(COALESCE(1,NULL),NULL),NULL)) AS CHAR(1)),1,1) AS INT) == 1
    So why complicate your code AND MAKE MY JOB HARDER??!:crazy:

    Want to get the best help? Click here https://www.sqlservercentral.com/articles/forum-etiquette-how-to-post-datacode-on-a-forum-to-get-the-best-help (Jeff Moden)
    My blog: http://uksqldba.blogspot.com
    Visit http://www.DerekColley.co.uk to find out more about me.

  • This is standard behavour, the log will become larger than what you are used to as it is not marking the log as re-usable until a log backup occurs.

    How often have you set logshipping up to backup the log?

    Also check this link out on managing the transaction log http://www.sqlservercentral.com/articles/Administration/64582/

  • Hi Derek,

    thanks for your reply.

    But, every night we did a full backup this should free the transaction log space isnt it ? But unfortunatly in my case it wont... but maybe the full backup didnot free the transaction log and my knowless are wrong ?

    We also once by week make a reorg index task.

    no other solution to make more space? what happends in few years? For a little database 5 giga, I have 20giga of transation log... And what about in one years? 40 ? It's not for me a normal issu isnt' ?

  • Full backups do not do anything to the transaction log. Only a transaction log backup can mark the log as re-usable.

    How often is the log backup taking place?

  • anthony.green (8/6/2012)


    This is standard behavour, the log will become larger than what you are used to as it is not marking the log as re-usable until a log backup occurs.

    How often have you set logshipping up to backup the log?

    Also check this link out on managing the transaction log http://www.sqlservercentral.com/articles/Administration/64582/

    thanks Anthony for your reply.

    I'm not sure about the question of the backup log ? When I set up the logshipping It ask me When I want to delete the older filer (in my case we keep it 6hours)

    And the 3 ls job (backup, copy and restore) are schedule every 30mn.

    I know that the backup log are the best way to free the space, but it's not compatible with the logshipping. If I did a backup log with a tsql, the lsrestore will be break, with an error message like this : "Message

    2012-06-21 16:50:26.66 *** Error: Could not apply log backup file 'E:\TRNSECONDAIRE\db_20120621144913.trn' to secondary database 'db_bis'.(Microsoft.SqlServer.Management.LogShipping) ***

    2012-06-21 16:50:26.66 *** Error: This log cannot be restored because a gap in the log chain was created. Use more recent data backups to bridge the gap.

    RESTORE LOG is terminating abnormally.(.Net SqlClient Data Provider) ***

    "

    I tried so many thing... every one break my logshipping...

  • If you have such a big log after 30 minutes, then change it to 15 minutes.

    You can shrink the log in full recovery, but you will have to wait until the log reuse description is set to nothing, which in full recovery you have to be pretty quick.

    select log_reuse_wait_desc from sys.databases where name = ''

    You can also take a manual backup of the log in Logshipping, the ONLY[/i] caviat, is that the TRN file must go into the same directory which is used in logshipping so that it can be copied and restored as normal.

  • anthony.green (8/6/2012)


    If you have such a big log after 30 minutes, then change it to 15 minutes.

    You can shrink the log in full recovery, but you will have to wait until the log reuse description is set to nothing, which in full recovery you have to be pretty quick.

    select log_reuse_wait_desc from sys.databases where name = ''

    You can also take a manual backup of the log in Logshipping, the ONLY[/i] caviat, is that the TRN file must go into the same directory which is used in logshipping so that it can be copied and restored as normal.

    "If you have such a big log after 30 minutes, then change it to 15 minutes."

    I dont understand what you mean.

    My ldf file are big, and I think it take bigger maybe everyweek, perhaps month ? It's no every 30mn when my logshipping running.

    The shrink option have every time we tried with a lot of option "truncate, truncate only etc etc" break the logshipping sequence.

    "You can also take a manual backup of the log in Logshipping, the ONLY[/i] caviat, is that the TRN file must go into the same directory which is used in logshipping so that it can be copied and restored as normal"

    I tried also to made a manual backup of the log, and then it's the error message 2 post away. But I will tried to set up into the logshipping folder... maybe it's the issu!

    I run to test it, and I come back here.

  • So on my sql test server,

    I create a quick logshipping, with a data base witch have already a hudge LDF file.

    I made a tsql backup log like that :

    "BACKUP LOG database

    TO DISK = 'E:\TRNLOCAL\test.trn'

    GO"

    Work fine, BUT the LDF file are still hudge. What shall I do now to down the file? Shrink it ? (pretty sure it's will break my logshipping ... ?)

  • Shrink the file, but dont use truncate only.

    You will need to ensure that the reuse desc is set to nothing to shrink it down as low as possible, otherwise it will only shrink to the last active part of the log.

    Remember, a backup be it a full / diff / log will not shrink a file, shrinking is an expensive process and causes lots of issues especially around index fragmentation in the MDF. The file has grown to that size as it needs to be that size to handle all the transactions you have within the 30 minute backup window.

    If you set the log backups to 15 minutes, you will potentially end up with a smaller log, but all depends how big the file needs to be to handle 15 minutes of transactions.

    Read the article on managing the transaction log, and size your log accordingly.

  • anthony.green (8/6/2012)


    Shrink the file, but dont use truncate only.

    You will need to ensure that the reuse desc is set to nothing to shrink it down as low as possible, otherwise it will only shrink to the last active part of the log.

    So somethink like that ? But miss the "desc is set to nothing" what is the sequence and where shall I put it ?

    USE database;

    GO

    DBCC SHRINKFILE;

    GO

  • anthony.green (8/6/2012)


    Shrink the file, but dont use truncate only.

    Read the article on managing the transaction log, and size your log accordingly.

    I will

    thanks

  • didi77 (8/6/2012)


    anthony.green (8/6/2012)


    Shrink the file, but dont use truncate only.

    You will need to ensure that the reuse desc is set to nothing to shrink it down as low as possible, otherwise it will only shrink to the last active part of the log.

    So somethink like that ? But miss the "desc is set to nothing" what is the sequence and where shall I put it ?

    USE database;

    GO

    DBCC SHRINKFILE;

    GO

    You will need to query sys.databases and when it returns 'nothing' then you can shrink.

  • anthony.green (8/6/2012)


    didi77 (8/6/2012)


    anthony.green (8/6/2012)


    Shrink the file, but dont use truncate only.

    You will need to ensure that the reuse desc is set to nothing to shrink it down as low as possible, otherwise it will only shrink to the last active part of the log.

    So somethink like that ? But miss the "desc is set to nothing" what is the sequence and where shall I put it ?

    USE database;

    GO

    DBCC SHRINKFILE;

    GO

    You will need to query sys.databases and when it returns 'nothing' then you can shrink.

    very strange, on my test server, I know that there is no activity, so a Shrink the LDF file... it's works... and seems to did not have break my logshipping.

    Why? just because I made a backup log since two hours ago now ?

    I'm very confuse...

  • No, when you run a shrink with Truncate Only you reset the LSN's.

    If you just run DBCC SHRINKFILE you dont reset the LSN's

Viewing 15 posts - 1 through 15 (of 39 total)

You must be logged in to reply to this topic. Login to reply