Reading SQL Server's Transaction Log

  • Kraig Kerr

    SSC Enthusiast

    Points: 180

    Comments posted to this topic are about the item Reading SQL Server's Transaction Log

  • TRACEY-320982

    SSChampion

    Points: 13444

    With this information would you be able to replicate the data to another database. Most of the software we use does not have primary keys so SQL Replication is not an option.

    Mirroring, snapshots not an option as the reporting database needs to be up 24 /7 and not down whilst snapshots run or log transactions are built on the reporting database.

    Just curious

  • Kraig Kerr

    SSC Enthusiast

    Points: 180

    Do the tables in question have any clustered indexes? If not you'd be dealing with "Heaps" and your only recourse would be to run a whole lot of DBCC Page commands or explore using %%phyloc%%. [/url]

    Also dealing with updates is a lot more complex than dealing with inserts.

  • faboudib

    SSC Enthusiast

    Points: 128

    Nice article,

    However, would you mind specifying on which versions of Sql Server this works? If this works only on Sql Server 2000, and that is your target platform, you might want to look into RedGate's free product SQL Log Rescue (http://www.red-gate.com/products/SQL_Log_Rescue/index.htm) for similar functioanlity. Otherwise great work...

    Regards,

  • Lowell

    SSC Guru

    Points: 323346

    I believe the target schema is 2008; it worked just fine for me...the object id of my table was actually exactly the same as the article.

    in 2005 Express, i get a couple of minor syntax issues, but after i look deeper, i'm sure it'll be obvious what to tweak.

    Thanks for the great article.

    faboudib (11/22/2010)


    Nice article,

    However, would you mind specifying on which versions of Sql Server this works? If this works only on Sql Server 2000, and that is your target platform, you might want to look into RedGate's free product SQL Log Rescue (http://www.red-gate.com/products/SQL_Log_Rescue/index.htm) for similar functioanlity. Otherwise great work...

    Regards,

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!

  • Mike C

    SSC-Insane

    Points: 23224

    I'd like to stress a point the author mentioned in passing: this function is UNDOCUMENTED. What does that really mean? Well, to summarize:

    1) Microsoft does not support the function. If you run into issues in production with this function, the first solution you will probably get is to remove the dependency on this function. Apart from that you're probably pretty much on your own.

    2) It could have undesirable side effects. Blocking comes immediately to mind for this function.

    3) It may not be available/accessible in the next release. That is, it can be pulled at any time, including major release, minor release, or even service pack. Sp_makewebtask anyone?

    You mentioned Paul Randall, Kimberly Tripp and Isaac Kunen in your article, but I've never seen a recommendation from them to use this in production. Every time I've seen them use this it has been to demo one-off troubleshooting. You may want to clarify this before people start asking how they can use this to do things like create their own transaction log monitoring or home-baked custom replication systems in production environments. Nobody wants to waste money on a CSS call only to find out the code they've written using undocumented functionality is not supported.

  • Francis Apel

    SSC Eights!

    Points: 918

    Nice Article.

    Thank you for taking the time to lay this out.

    Francis
    -----------------
    SQLRanger.com

  • knoopix

    Valued Member

    Points: 67

    Very nice article ! Waiting the next one now 😉

  • Phil Brammer

    Ten Centuries

    Points: 1135

    However, if our table had been a HEAP this method works nicely because the data remains with the [Page ID] and [Slot ID] for the life of the HEAP.

    That's not quite correct. Data will move in heaps and hence change page numbers. Updates to rows that cause the row to no longer fit on the page will cause it to move. When this happens a forwarding pointer is left in the original page, pointing to the new page. ALTER TABLE ... REBUILD will also renumber your pages and allocation_unit_ids.

  • Phil Brammer

    Ten Centuries

    Points: 1135

    The link to the MGM Mirage article does not work. I'm still trying to decifer what your reasons for reading the log are. Also, what version of SQL are you using for this demo?

  • Phil Brammer

    Ten Centuries

    Points: 1135

    DBCC PAGE is undocumented as well. Use at your own risk.

  • dma-669038

    SSCrazy

    Points: 2713

    Yes that was my thought too, lot of very detailed research and very well written, but what practical use would you put this to?

  • rbaskett

    SSC Enthusiast

    Points: 168

    SRD?

  • Kraig Kerr

    SSC Enthusiast

    Points: 180

    Looks like TDWI took down that link. Here is another that points to the same article. http://findarticles.com/p/articles/mi_m0EIN/is_2000_Nov_8/ai_66696495/

    The current flavor of this works with SQL 2008, but with minor changes will work with SQL 2005. I also have a version for SQL 2000. I should have specified this in the article, thanks for the catch.

  • Kraig Kerr

    SSC Enthusiast

    Points: 180

    Systems Research & Development (SRD) founded by Jeff Jonas.

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

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