Solved

How to shrink SQL 2005 transaction log of a database that is Primary DB in Log Shipping set up

Posted on 2009-05-12
9
804 Views
Last Modified: 2012-06-21
According to BOL, when using Log Shipping, backing up the transaction log independantly of the log ship process will disrupt thel restore process on the secondary server. (which makes sense).

As a transaction log back up followed by a file shrink - is the method used to shrink bloated transaction files. How does one shrink the tranaction log  goal if log shipping process is running?

Thanks
0
Comment
Question by:DavidHannen
  • 5
  • 3
9 Comments
 
LVL 31

Expert Comment

by:RiteshShah
ID: 24363787
0
 
LVL 6

Expert Comment

by:bull_rider
ID: 24363791
You can get your answer in this thread where I have given the commannds as to how to shrink it.

http://www.experts-exchange.com/Microsoft/Development/MS-SQL-Server/Q_24398614.html

Hope this helps.
0
 

Author Comment

by:DavidHannen
ID: 24363929
Thanks both for the posts:

My question is NOT 'How to shrink the transaction log' I have that covered. My issue is that I may need to shrink the log of a database that is primary DB in a Log Ship Set up. The documentation says Do Not  back up the log in this instance as it will interupt the chain of logs in the restore on the secondary server.

How do I get around this scenario.

Thanks
0
 
LVL 6

Expert Comment

by:bull_rider
ID: 24364045
You can set your secondary database's Recovery Model to SIMPLE which does not break\effect the log chain, at least I haven't seen a side effect of this setting for the secondary database. (I assume you do not back up your transaction logs on the secondary database, because you can not do this when
your database's RM is SIMPLE.)

I hope this helps. Let me know if you have any more questions.
0
What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

 
LVL 6

Expert Comment

by:bull_rider
ID: 24364058
And can you reduce the time for the log shipping so that it happens frequently and does not over grow the log file? This is a preventive measure. :)
0
 

Author Comment

by:DavidHannen
ID: 24364193
Bull Rider,

Am I right in saying that when a transaction log is backed up (in full recovery model) , the log is automatically truncated to the point of the last record being sucessfully applied to the database file.

If I am right with this, does that mean that shrinkfile could be used straight after the transaction log ship as there will be space in the file. Am I anywhere near correct here?

Thanks
0
 
LVL 6

Expert Comment

by:bull_rider
ID: 24364268
A transaction log backup backs up all transactions since either the previous transaction log backup, or the complete database backup if there have been no transaction log backups performed for the database in the past. This backup may then be used to apply the backed-up changes, in case disaster recovery is required. Transaction log backups may only be applied to a database in an unrecovered state. A database may be in an unrecovered state if it is being restored from a set of backups as part of a disaster recovery procedure, or if it is configured as a standby database on a warm backup server. A transaction log backup also truncates the inactive portion of the transaction log, unless the database is configured as a Publisher in transactional replication and there are transactions pending propagation to Subscribers.

Shrinkfile might interrupt the chain of logs as you said and I have seen many instances of that and it really creates a havoc. Please follow what I said in the previous comment.
0
 
LVL 6

Accepted Solution

by:
bull_rider earned 500 total points
ID: 24367736
Did it solve the issue?
0
 

Author Closing Comment

by:DavidHannen
ID: 31580498
Thanks very much for your input - much appreciated. I'm still learning and trying to assimilate best practice in all these different scenarios.
0

Featured Post

Zoho SalesIQ

Hassle-free live chat software re-imagined for business growth. 2 users, always free.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Let's review the features of new SQL Server 2012 (Denali CTP3). It listed as below: PERCENT_RANK(): PERCENT_RANK() function will returns the percentage value of rank of the values among its group. PERCENT_RANK() function value always in be…
JSON is being used more and more, besides XML, and you surely wanted to parse the data out into SQL instead of doing it in some Javascript. The below function in SQL Server can do the job for you, returning a quick table with the parsed data.
Using examples as well as descriptions, and references to Books Online, show the documentation available for date manipulation functions and by using a select few of these functions, show how date based data can be manipulated with these functions.
Using examples as well as descriptions, and references to Books Online, show the different Recovery Models available in SQL Server and explain, as well as show how full, differential and transaction log backups are performed

863 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

24 Experts available now in Live!

Get 1:1 Help Now