<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://sqlblog.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Tibor Karaszi : Transaction log</title><link>http://sqlblog.com/blogs/tibor_karaszi/archive/tags/Transaction+log/default.aspx</link><description>Tags: Transaction log</description><dc:language>en</dc:language><generator>CommunityServer 2.1 SP2 (Build: 61129.1)</generator><item><title>Point-in-time restore of database backup?</title><link>http://sqlblog.com/blogs/tibor_karaszi/archive/2010/12/28/point-in-time-restore-of-database-backup.aspx</link><pubDate>Tue, 28 Dec 2010 16:42:00 GMT</pubDate><guid isPermaLink="false">21093a07-8b3d-42db-8cbf-3350fcbf5496:32051</guid><dc:creator>TiborKaraszi</dc:creator><slash:comments>2</slash:comments><comments>http://sqlblog.com/blogs/tibor_karaszi/comments/32051.aspx</comments><wfw:commentRss>http://sqlblog.com/blogs/tibor_karaszi/commentrss.aspx?PostID=32051</wfw:commentRss><description>SQL Server 2005 added the STOPAT option for the RESTORE DATABASE command. This sounds great - we can stop at some point in time during the database backup process was running! Or? No, we can't. Here follows some tech stuff why not, and then what the option...(&lt;a href="http://sqlblog.com/blogs/tibor_karaszi/archive/2010/12/28/point-in-time-restore-of-database-backup.aspx"&gt;read more&lt;/a&gt;)&lt;img src="http://sqlblog.com/aggbug.aspx?PostID=32051" width="1" height="1"&gt;</description><category domain="http://sqlblog.com/blogs/tibor_karaszi/archive/tags/Backup/default.aspx">Backup</category><category domain="http://sqlblog.com/blogs/tibor_karaszi/archive/tags/Transaction+log/default.aspx">Transaction log</category></item><item><title>Why we never want to trick SQL Server into rebuilding a log file</title><link>http://sqlblog.com/blogs/tibor_karaszi/archive/2010/10/14/why-we-never-want-to-trick-sql-server-into-rebuilding-a-log-file.aspx</link><pubDate>Thu, 14 Oct 2010 17:04:00 GMT</pubDate><guid isPermaLink="false">21093a07-8b3d-42db-8cbf-3350fcbf5496:29398</guid><dc:creator>TiborKaraszi</dc:creator><slash:comments>4</slash:comments><comments>http://sqlblog.com/blogs/tibor_karaszi/comments/29398.aspx</comments><wfw:commentRss>http://sqlblog.com/blogs/tibor_karaszi/commentrss.aspx?PostID=29398</wfw:commentRss><description>"Never" is a strong word, so let me say that we really really want to avoid it, if at all humanly possible. In short, we will have a (potentially) broken database, both at the physical level and at the logical level. Read on. Just to be clear, when I...(&lt;a href="http://sqlblog.com/blogs/tibor_karaszi/archive/2010/10/14/why-we-never-want-to-trick-sql-server-into-rebuilding-a-log-file.aspx"&gt;read more&lt;/a&gt;)&lt;img src="http://sqlblog.com/aggbug.aspx?PostID=29398" width="1" height="1"&gt;</description><category domain="http://sqlblog.com/blogs/tibor_karaszi/archive/tags/Backup/default.aspx">Backup</category><category domain="http://sqlblog.com/blogs/tibor_karaszi/archive/tags/Maintenance/default.aspx">Maintenance</category><category domain="http://sqlblog.com/blogs/tibor_karaszi/archive/tags/Troubleshooting/default.aspx">Troubleshooting</category><category domain="http://sqlblog.com/blogs/tibor_karaszi/archive/tags/Transaction+log/default.aspx">Transaction log</category><category domain="http://sqlblog.com/blogs/tibor_karaszi/archive/tags/Availability/default.aspx">Availability</category></item><item><title>Restore database to the point of disaster</title><link>http://sqlblog.com/blogs/tibor_karaszi/archive/2010/03/27/restore-database-to-the-point-of-disaster.aspx</link><pubDate>Sat, 27 Mar 2010 09:50:00 GMT</pubDate><guid isPermaLink="false">21093a07-8b3d-42db-8cbf-3350fcbf5496:23796</guid><dc:creator>TiborKaraszi</dc:creator><slash:comments>14</slash:comments><comments>http://sqlblog.com/blogs/tibor_karaszi/comments/23796.aspx</comments><wfw:commentRss>http://sqlblog.com/blogs/tibor_karaszi/commentrss.aspx?PostID=23796</wfw:commentRss><description>This is really basic, but so often overlooked and misunderstood. Basically, we have a database, and something goes south. Can we restore all the way up to that point? I.e., even if the last backup (db or log) is earlier than the disaster? Yes, of course...(&lt;a href="http://sqlblog.com/blogs/tibor_karaszi/archive/2010/03/27/restore-database-to-the-point-of-disaster.aspx"&gt;read more&lt;/a&gt;)&lt;img src="http://sqlblog.com/aggbug.aspx?PostID=23796" width="1" height="1"&gt;</description><category domain="http://sqlblog.com/blogs/tibor_karaszi/archive/tags/Backup/default.aspx">Backup</category><category domain="http://sqlblog.com/blogs/tibor_karaszi/archive/tags/Transaction+log/default.aspx">Transaction log</category></item><item><title>Are log records removed from ldf file for rollbacks?</title><link>http://sqlblog.com/blogs/tibor_karaszi/archive/2010/03/22/are-log-records-removed-from-ldf-file-for-rollbacks.aspx</link><pubDate>Mon, 22 Mar 2010 09:34:00 GMT</pubDate><guid isPermaLink="false">21093a07-8b3d-42db-8cbf-3350fcbf5496:23627</guid><dc:creator>TiborKaraszi</dc:creator><slash:comments>2</slash:comments><comments>http://sqlblog.com/blogs/tibor_karaszi/comments/23627.aspx</comments><wfw:commentRss>http://sqlblog.com/blogs/tibor_karaszi/commentrss.aspx?PostID=23627</wfw:commentRss><description>Seems like a simple enough question, right? This question (but more targeted, read on) was raised in an MCT forum. While the discussion was on-going and and I tried to come up with answers, I realized that this question are really several questions. First,...(&lt;a href="http://sqlblog.com/blogs/tibor_karaszi/archive/2010/03/22/are-log-records-removed-from-ldf-file-for-rollbacks.aspx"&gt;read more&lt;/a&gt;)&lt;img src="http://sqlblog.com/aggbug.aspx?PostID=23627" width="1" height="1"&gt;</description><category domain="http://sqlblog.com/blogs/tibor_karaszi/archive/tags/Backup/default.aspx">Backup</category><category domain="http://sqlblog.com/blogs/tibor_karaszi/archive/tags/Transaction+log/default.aspx">Transaction log</category></item><item><title>Do you perform log backup for the model database?</title><link>http://sqlblog.com/blogs/tibor_karaszi/archive/2009/11/18/do-you-perform-log-backup-for-the-model-database.aspx</link><pubDate>Wed, 18 Nov 2009 12:05:00 GMT</pubDate><guid isPermaLink="false">21093a07-8b3d-42db-8cbf-3350fcbf5496:18930</guid><dc:creator>TiborKaraszi</dc:creator><slash:comments>14</slash:comments><comments>http://sqlblog.com/blogs/tibor_karaszi/comments/18930.aspx</comments><wfw:commentRss>http://sqlblog.com/blogs/tibor_karaszi/commentrss.aspx?PostID=18930</wfw:commentRss><description>Are you stupid, you might think... But stop and think for a while. Model is no different from other databases. And by default it is in full recovery model. So as soon as you do your first database backup (you do backup your system databases, right?) the...(&lt;a href="http://sqlblog.com/blogs/tibor_karaszi/archive/2009/11/18/do-you-perform-log-backup-for-the-model-database.aspx"&gt;read more&lt;/a&gt;)&lt;img src="http://sqlblog.com/aggbug.aspx?PostID=18930" width="1" height="1"&gt;</description><category domain="http://sqlblog.com/blogs/tibor_karaszi/archive/tags/Backup/default.aspx">Backup</category><category domain="http://sqlblog.com/blogs/tibor_karaszi/archive/tags/Maintenance/default.aspx">Maintenance</category><category domain="http://sqlblog.com/blogs/tibor_karaszi/archive/tags/Transaction+log/default.aspx">Transaction log</category></item><item><title>Will EMPTYFILE on primary ldf "doom" it somehow?</title><link>http://sqlblog.com/blogs/tibor_karaszi/archive/2009/09/29/will-emptyfile-on-primary-ldf-doom-it-somehow.aspx</link><pubDate>Tue, 29 Sep 2009 15:48:00 GMT</pubDate><guid isPermaLink="false">21093a07-8b3d-42db-8cbf-3350fcbf5496:17055</guid><dc:creator>TiborKaraszi</dc:creator><slash:comments>3</slash:comments><comments>http://sqlblog.com/blogs/tibor_karaszi/comments/17055.aspx</comments><wfw:commentRss>http://sqlblog.com/blogs/tibor_karaszi/commentrss.aspx?PostID=17055</wfw:commentRss><description>I just read a newgroup question whether doing SHRINKFILE with the EMPTYFILE option for the primary log file somehow cause ill effects. Shrinkfile for the ldf will not move any data (log records) or so. For an ldf file it is basically a preparation to...(&lt;a href="http://sqlblog.com/blogs/tibor_karaszi/archive/2009/09/29/will-emptyfile-on-primary-ldf-doom-it-somehow.aspx"&gt;read more&lt;/a&gt;)&lt;img src="http://sqlblog.com/aggbug.aspx?PostID=17055" width="1" height="1"&gt;</description><category domain="http://sqlblog.com/blogs/tibor_karaszi/archive/tags/Transaction+log/default.aspx">Transaction log</category></item><item><title>Table restore and filegroups</title><link>http://sqlblog.com/blogs/tibor_karaszi/archive/2009/06/25/table-restore-and-filegroups.aspx</link><pubDate>Thu, 25 Jun 2009 10:49:00 GMT</pubDate><guid isPermaLink="false">21093a07-8b3d-42db-8cbf-3350fcbf5496:14909</guid><dc:creator>TiborKaraszi</dc:creator><slash:comments>20</slash:comments><comments>http://sqlblog.com/blogs/tibor_karaszi/comments/14909.aspx</comments><wfw:commentRss>http://sqlblog.com/blogs/tibor_karaszi/commentrss.aspx?PostID=14909</wfw:commentRss><description>The story usually goes something like: Q - How can I restore only this table? A - Put it on its own filegroup and you can do filegroup level backup and restore. The problem with above answer is that it most likely misses the point. We need to ask ourselves:...(&lt;a href="http://sqlblog.com/blogs/tibor_karaszi/archive/2009/06/25/table-restore-and-filegroups.aspx"&gt;read more&lt;/a&gt;)&lt;img src="http://sqlblog.com/aggbug.aspx?PostID=14909" width="1" height="1"&gt;</description><category domain="http://sqlblog.com/blogs/tibor_karaszi/archive/tags/Backup/default.aspx">Backup</category><category domain="http://sqlblog.com/blogs/tibor_karaszi/archive/tags/Transaction+log/default.aspx">Transaction log</category></item><item><title>Remove transaction log files</title><link>http://sqlblog.com/blogs/tibor_karaszi/archive/2009/06/17/remove-transaction-log-files.aspx</link><pubDate>Wed, 17 Jun 2009 05:47:00 GMT</pubDate><guid isPermaLink="false">21093a07-8b3d-42db-8cbf-3350fcbf5496:14718</guid><dc:creator>TiborKaraszi</dc:creator><slash:comments>6</slash:comments><comments>http://sqlblog.com/blogs/tibor_karaszi/comments/14718.aspx</comments><wfw:commentRss>http://sqlblog.com/blogs/tibor_karaszi/commentrss.aspx?PostID=14718</wfw:commentRss><description>&lt;P&gt;Say you happened to get too many transaction log (ldf)&amp;nbsp;files. Can you remove log files from the database? Yes, but only if a file isn't in use, and you cannot remove the first ("primary") log file. &lt;/P&gt;
&lt;P&gt;So, be prepared to investigate the virtual file layout, using DBCC LOGINFO, to see if a log file is in use or not. You can find information about how to investigate the virtual log file layout in my &lt;A title="shrink article" href="http://www.karaszi.com/SQLServer/info_dont_shrink.asp"&gt;shrink article&lt;/A&gt;. The basic steps are a bit similar to shrinking a log file: Investigate virtual log file layout, backup log, possibly shrink file, try removing it. Do this again as many times as it takes (repeat, rinse and lather).&lt;/P&gt;
&lt;P&gt;Below is a script that, if you take the time to study it and play with it, will prepare you to remove transaction log files from a database. As always, don't execute it if you don't understand what it does!&lt;/P&gt;&lt;CODE style="FONT-SIZE:12px;"&gt;&lt;SPAN style="COLOR:blue;"&gt;USE&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:black;"&gt;master &lt;BR&gt;&lt;/SPAN&gt;&lt;SPAN style="COLOR:blue;"&gt;IF&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:magenta;"&gt;DB_ID&lt;/SPAN&gt;&lt;SPAN style="COLOR:gray;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="COLOR:red;"&gt;'rDb'&lt;/SPAN&gt;&lt;SPAN style="COLOR:gray;"&gt;)&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:blue;"&gt;IS&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:gray;"&gt;NOT&amp;nbsp;NULL&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:blue;"&gt;DROP&amp;nbsp;DATABASE&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:black;"&gt;rDb &lt;BR&gt;GO &lt;BR&gt;&lt;BR&gt;&lt;/SPAN&gt;&lt;SPAN style="COLOR:blue;"&gt;CREATE&amp;nbsp;DATABASE&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:black;"&gt;rDb &lt;BR&gt;&lt;/SPAN&gt;&lt;SPAN style="COLOR:blue;"&gt;ON&amp;nbsp; &lt;BR&gt;PRIMARY&amp;nbsp; &lt;BR&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:gray;"&gt;(&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:black;"&gt;NAME&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:blue;"&gt;=&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:red;"&gt;N'rDb'&lt;/SPAN&gt;&lt;SPAN style="COLOR:gray;"&gt;,&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:black;"&gt;FILENAME&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:blue;"&gt;=&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:red;"&gt;N'C:\rDb.mdf'&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:gray;"&gt;,&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:black;"&gt;SIZE&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:blue;"&gt;=&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:black;"&gt;50MB&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:gray;"&gt;,&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:black;"&gt;FILEGROWTH&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:blue;"&gt;=&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:black;"&gt;1024KB&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:gray;"&gt;) &lt;BR&gt;&lt;/SPAN&gt;&lt;SPAN style="COLOR:magenta;"&gt;LOG&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:blue;"&gt;ON&amp;nbsp; &lt;BR&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:gray;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="COLOR:black;"&gt;NAME&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:blue;"&gt;=&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:red;"&gt;N'rDb_log2'&lt;/SPAN&gt;&lt;SPAN style="COLOR:gray;"&gt;,&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:black;"&gt;FILENAME&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:blue;"&gt;=&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:red;"&gt;N'C:\rDb_log2.ldf'&lt;/SPAN&gt;&lt;SPAN style="COLOR:gray;"&gt;,&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:black;"&gt;SIZE&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:blue;"&gt;=&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:black;"&gt;3MB&lt;/SPAN&gt;&lt;SPAN style="COLOR:gray;"&gt;,&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:black;"&gt;FILEGROWTH&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:blue;"&gt;=&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:black;"&gt;2MB&lt;/SPAN&gt;&lt;SPAN style="COLOR:gray;"&gt;) &lt;BR&gt;,(&lt;/SPAN&gt;&lt;SPAN style="COLOR:black;"&gt;NAME&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:blue;"&gt;=&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:red;"&gt;N'rDb_log3'&lt;/SPAN&gt;&lt;SPAN style="COLOR:gray;"&gt;,&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:black;"&gt;FILENAME&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:blue;"&gt;=&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:red;"&gt;N'C:\rDb_log3.ldf'&lt;/SPAN&gt;&lt;SPAN style="COLOR:gray;"&gt;,&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:black;"&gt;SIZE&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:blue;"&gt;=&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:black;"&gt;3MB&lt;/SPAN&gt;&lt;SPAN style="COLOR:gray;"&gt;,&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:black;"&gt;FILEGROWTH&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:blue;"&gt;=&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:black;"&gt;2MB&lt;/SPAN&gt;&lt;SPAN style="COLOR:gray;"&gt;) &lt;BR&gt;,(&lt;/SPAN&gt;&lt;SPAN style="COLOR:black;"&gt;NAME&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:blue;"&gt;=&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:red;"&gt;N'rDb_log4'&lt;/SPAN&gt;&lt;SPAN style="COLOR:gray;"&gt;,&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:black;"&gt;FILENAME&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:blue;"&gt;=&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:red;"&gt;N'C:\rDb_log4.ldf'&lt;/SPAN&gt;&lt;SPAN style="COLOR:gray;"&gt;,&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:black;"&gt;SIZE&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:blue;"&gt;=&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:black;"&gt;3MB&lt;/SPAN&gt;&lt;SPAN style="COLOR:gray;"&gt;,&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:black;"&gt;FILEGROWTH&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:blue;"&gt;=&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:black;"&gt;2MB&lt;/SPAN&gt;&lt;SPAN style="COLOR:gray;"&gt;) &lt;BR&gt;&lt;/SPAN&gt;&lt;SPAN style="COLOR:black;"&gt;GO &lt;BR&gt;&lt;BR&gt;&lt;/SPAN&gt;&lt;SPAN style="COLOR:blue;"&gt;ALTER&amp;nbsp;DATABASE&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:black;"&gt;rDb&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:blue;"&gt;SET&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:black;"&gt;RECOVERY&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:blue;"&gt;FULL &lt;BR&gt;BACKUP&amp;nbsp;DATABASE&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:black;"&gt;rDb&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:blue;"&gt;TO&amp;nbsp;DISK&amp;nbsp;=&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:red;"&gt;'C:\rDb.bak'&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:blue;"&gt;WITH&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:black;"&gt;INIT &lt;BR&gt;&lt;/SPAN&gt;&lt;SPAN style="COLOR:blue;"&gt;CREATE&amp;nbsp;TABLE&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:black;"&gt;rDb..t&lt;/SPAN&gt;&lt;SPAN style="COLOR:gray;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="COLOR:black;"&gt;c1&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:blue;"&gt;INT&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:#434343;"&gt;IDENTITY&lt;/SPAN&gt;&lt;SPAN style="COLOR:gray;"&gt;,&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:black;"&gt;c2&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:blue;"&gt;CHAR&lt;/SPAN&gt;&lt;SPAN style="COLOR:gray;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="COLOR:black;"&gt;100&lt;/SPAN&gt;&lt;SPAN style="COLOR:gray;"&gt;)) &lt;BR&gt;&lt;BR&gt;&lt;/SPAN&gt;&lt;SPAN style="COLOR:blue;"&gt;INSERT&amp;nbsp;INTO&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:black;"&gt;rDb..t &lt;BR&gt;&lt;/SPAN&gt;&lt;SPAN style="COLOR:blue;"&gt;SELECT&amp;nbsp;TOP&lt;/SPAN&gt;&lt;SPAN style="COLOR:gray;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="COLOR:black;"&gt;15000&lt;/SPAN&gt;&lt;SPAN style="COLOR:gray;"&gt;)&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:red;"&gt;'hello' &lt;BR&gt;&lt;/SPAN&gt;&lt;SPAN style="COLOR:blue;"&gt;FROM&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:black;"&gt;syscolumns&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:blue;"&gt;AS&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:black;"&gt;a &lt;BR&gt;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:gray;"&gt;CROSS&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:blue;"&gt;JOIN&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:black;"&gt;syscolumns&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:blue;"&gt;AS&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:black;"&gt;b &lt;BR&gt;&lt;BR&gt;&lt;/SPAN&gt;&lt;SPAN style="COLOR:green;"&gt;--Log&amp;nbsp;is&amp;nbsp;now&amp;nbsp;about&amp;nbsp;46%&amp;nbsp;full &lt;BR&gt;&lt;/SPAN&gt;&lt;SPAN style="COLOR:blue;"&gt;DBCC&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:black;"&gt;SQLPERF&lt;/SPAN&gt;&lt;SPAN style="COLOR:gray;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="COLOR:black;"&gt;logspace&lt;/SPAN&gt;&lt;SPAN style="COLOR:gray;"&gt;) &lt;BR&gt;&lt;BR&gt;&lt;/SPAN&gt;&lt;SPAN style="COLOR:green;"&gt;--Check&amp;nbsp;virtual&amp;nbsp;log&amp;nbsp;file&amp;nbsp;layout &lt;BR&gt;&lt;/SPAN&gt;&lt;SPAN style="COLOR:blue;"&gt;DBCC&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:black;"&gt;LOGINFO&lt;/SPAN&gt;&lt;SPAN style="COLOR:gray;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="COLOR:black;"&gt;rDb&lt;/SPAN&gt;&lt;SPAN style="COLOR:gray;"&gt;) &lt;BR&gt;&lt;/SPAN&gt;&lt;SPAN style="COLOR:green;"&gt;--See&amp;nbsp;that&amp;nbsp;file&amp;nbsp;4&amp;nbsp;isn't&amp;nbsp;used&amp;nbsp;at&amp;nbsp;all&amp;nbsp;(Status&amp;nbsp;=&amp;nbsp;0&amp;nbsp;for&amp;nbsp;all&amp;nbsp;4's&amp;nbsp;rows) &lt;BR&gt;&lt;BR&gt;--We&amp;nbsp;can&amp;nbsp;remove&amp;nbsp;file&amp;nbsp;4,&amp;nbsp;it&amp;nbsp;isn't&amp;nbsp;used &lt;BR&gt;&lt;/SPAN&gt;&lt;SPAN style="COLOR:blue;"&gt;ALTER&amp;nbsp;DATABASE&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:black;"&gt;rDb&amp;nbsp;REMOVE&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:blue;"&gt;FILE&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:black;"&gt;rDb_log4 &lt;BR&gt;&lt;BR&gt;&lt;/SPAN&gt;&lt;SPAN style="COLOR:green;"&gt;--Check&amp;nbsp;virtual&amp;nbsp;log&amp;nbsp;file&amp;nbsp;layout &lt;BR&gt;&lt;/SPAN&gt;&lt;SPAN style="COLOR:blue;"&gt;DBCC&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:black;"&gt;LOGINFO&lt;/SPAN&gt;&lt;SPAN style="COLOR:gray;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="COLOR:black;"&gt;rDb&lt;/SPAN&gt;&lt;SPAN style="COLOR:gray;"&gt;) &lt;BR&gt;&lt;BR&gt;&lt;/SPAN&gt;&lt;SPAN style="COLOR:green;"&gt;--Can't&amp;nbsp;remove&amp;nbsp;3&amp;nbsp;since&amp;nbsp;it&amp;nbsp;is&amp;nbsp;in&amp;nbsp;use &lt;BR&gt;&lt;/SPAN&gt;&lt;SPAN style="COLOR:blue;"&gt;ALTER&amp;nbsp;DATABASE&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:black;"&gt;rDb&amp;nbsp;REMOVE&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:blue;"&gt;FILE&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:black;"&gt;rDb_log3 &lt;BR&gt;&lt;BR&gt;&lt;/SPAN&gt;&lt;SPAN style="COLOR:green;"&gt;--What&amp;nbsp;if&amp;nbsp;we&amp;nbsp;backup&amp;nbsp;log? &lt;BR&gt;&lt;/SPAN&gt;&lt;SPAN style="COLOR:blue;"&gt;BACKUP&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:magenta;"&gt;LOG&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:black;"&gt;rDb&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:blue;"&gt;TO&amp;nbsp;DISK&amp;nbsp;=&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:red;"&gt;'C:\rDb.bak' &lt;BR&gt;&lt;BR&gt;&lt;/SPAN&gt;&lt;SPAN style="COLOR:green;"&gt;--Check&amp;nbsp;virtual&amp;nbsp;log&amp;nbsp;file&amp;nbsp;layout &lt;BR&gt;&lt;/SPAN&gt;&lt;SPAN style="COLOR:blue;"&gt;DBCC&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:black;"&gt;LOGINFO&lt;/SPAN&gt;&lt;SPAN style="COLOR:gray;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="COLOR:black;"&gt;rDb&lt;/SPAN&gt;&lt;SPAN style="COLOR:gray;"&gt;) &lt;BR&gt;&lt;/SPAN&gt;&lt;SPAN style="COLOR:green;"&gt;--3&amp;nbsp;is&amp;nbsp;still&amp;nbsp;in&amp;nbsp;use&amp;nbsp;(status&amp;nbsp;=&amp;nbsp;2) &lt;BR&gt;&lt;BR&gt;--Can't&amp;nbsp;remove&amp;nbsp;3&amp;nbsp;since&amp;nbsp;it&amp;nbsp;is&amp;nbsp;in&amp;nbsp;use &lt;BR&gt;&lt;/SPAN&gt;&lt;SPAN style="COLOR:blue;"&gt;ALTER&amp;nbsp;DATABASE&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:black;"&gt;rDb&amp;nbsp;REMOVE&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:blue;"&gt;FILE&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:black;"&gt;rDb_log3 &lt;BR&gt;&lt;BR&gt;&lt;/SPAN&gt;&lt;SPAN style="COLOR:green;"&gt;--Shrink&amp;nbsp;3 &lt;BR&gt;&lt;/SPAN&gt;&lt;SPAN style="COLOR:blue;"&gt;USE&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:black;"&gt;rDb &lt;BR&gt;&lt;/SPAN&gt;&lt;SPAN style="COLOR:blue;"&gt;DBCC&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:black;"&gt;SHRINKFILE&lt;/SPAN&gt;&lt;SPAN style="COLOR:gray;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="COLOR:black;"&gt;rDb_log3&lt;/SPAN&gt;&lt;SPAN style="COLOR:gray;"&gt;) &lt;BR&gt;&lt;/SPAN&gt;&lt;SPAN style="COLOR:blue;"&gt;USE&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:black;"&gt;master &lt;BR&gt;&lt;BR&gt;&lt;/SPAN&gt;&lt;SPAN style="COLOR:green;"&gt;--...&amp;nbsp;and&amp;nbsp;backup&amp;nbsp;log? &lt;BR&gt;&lt;/SPAN&gt;&lt;SPAN style="COLOR:blue;"&gt;BACKUP&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:magenta;"&gt;LOG&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:black;"&gt;rDb&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:blue;"&gt;TO&amp;nbsp;DISK&amp;nbsp;=&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:red;"&gt;'C:\rDb.bak' &lt;BR&gt;&lt;BR&gt;&lt;/SPAN&gt;&lt;SPAN style="COLOR:green;"&gt;--Check&amp;nbsp;virtual&amp;nbsp;log&amp;nbsp;file&amp;nbsp;layout &lt;BR&gt;&lt;/SPAN&gt;&lt;SPAN style="COLOR:blue;"&gt;DBCC&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:black;"&gt;LOGINFO&lt;/SPAN&gt;&lt;SPAN style="COLOR:gray;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="COLOR:black;"&gt;rDb&lt;/SPAN&gt;&lt;SPAN style="COLOR:gray;"&gt;) &lt;BR&gt;&lt;/SPAN&gt;&lt;SPAN style="COLOR:green;"&gt;--3&amp;nbsp;is&amp;nbsp;no&amp;nbsp;longer&amp;nbsp;in&amp;nbsp;use &lt;BR&gt;&lt;BR&gt;--Can&amp;nbsp;now&amp;nbsp;remove&amp;nbsp;3&amp;nbsp;since&amp;nbsp;it&amp;nbsp;is&amp;nbsp;not&amp;nbsp;in&amp;nbsp;use &lt;BR&gt;&lt;/SPAN&gt;&lt;SPAN style="COLOR:blue;"&gt;ALTER&amp;nbsp;DATABASE&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:black;"&gt;rDb&amp;nbsp;REMOVE&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:blue;"&gt;FILE&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:black;"&gt;rDb_log3 &lt;BR&gt;&lt;BR&gt;&lt;/SPAN&gt;&lt;SPAN style="COLOR:green;"&gt;--Check&amp;nbsp;explorer,&amp;nbsp;we're&amp;nbsp;down&amp;nbsp;to&amp;nbsp;1&amp;nbsp;log&amp;nbsp;file &lt;BR&gt;&lt;BR&gt;--See&amp;nbsp;what&amp;nbsp;sys.database_files&amp;nbsp;say? &lt;BR&gt;&lt;/SPAN&gt;&lt;SPAN style="COLOR:blue;"&gt;SELECT&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:gray;"&gt;*&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:blue;"&gt;FROM&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:black;"&gt;rDb.sys.database_files &lt;BR&gt;&lt;/SPAN&gt;&lt;SPAN style="COLOR:green;"&gt;--Seems&amp;nbsp;physical&amp;nbsp;file&amp;nbsp;is&amp;nbsp;gone,&amp;nbsp;but&amp;nbsp;SQL&amp;nbsp;Server&amp;nbsp;consider&amp;nbsp;the&amp;nbsp;file&amp;nbsp;offline &lt;BR&gt;&lt;BR&gt;--Backup&amp;nbsp;log&amp;nbsp;does&amp;nbsp;it: &lt;BR&gt;&lt;/SPAN&gt;&lt;SPAN style="COLOR:blue;"&gt;BACKUP&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:magenta;"&gt;LOG&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:black;"&gt;rDb&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:blue;"&gt;TO&amp;nbsp;DISK&amp;nbsp;=&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:red;"&gt;'C:\rDb.bak' &lt;BR&gt;&lt;/SPAN&gt;&lt;SPAN style="COLOR:blue;"&gt;SELECT&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:gray;"&gt;*&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:blue;"&gt;FROM&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:black;"&gt;rDb.sys.database_files &lt;BR&gt;&lt;BR&gt;&lt;/SPAN&gt;&lt;SPAN style="COLOR:green;"&gt;--Can&amp;nbsp;never&amp;nbsp;remove&amp;nbsp;the&amp;nbsp;first&amp;nbsp;("primary")&amp;nbsp;log&amp;nbsp;file &lt;BR&gt;&lt;/SPAN&gt;&lt;SPAN style="COLOR:blue;"&gt;ALTER&amp;nbsp;DATABASE&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:black;"&gt;rDb&amp;nbsp;REMOVE&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:blue;"&gt;FILE&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:black;"&gt;rDb_log2 &lt;BR&gt;&lt;/SPAN&gt;&lt;SPAN style="COLOR:green;"&gt;--Note&amp;nbsp;error&amp;nbsp;message&amp;nbsp;from&amp;nbsp;above&lt;/SPAN&gt;&lt;/CODE&gt;&lt;img src="http://sqlblog.com/aggbug.aspx?PostID=14718" width="1" height="1"&gt;</description><category domain="http://sqlblog.com/blogs/tibor_karaszi/archive/tags/Transaction+log/default.aspx">Transaction log</category></item></channel></rss>