Read logfile with vb.net (in admin mode)

  • When ever we create database from sql server, it's create two file. I want to see what's available inside the .ldf file. Through program (with visula basic .net ). PLease guid me ...

  • The ldf is the transaction log, a record of changes made to the database.

    Why do you want to read it? It's not intended to be human-readable, it's for the database, to guarantee consistency and durability.

    If you really want, you can use this undocumented feature from Management studio

    SELECT * FROM fn_dblog(null, null)

    Is this just curiosity? Or is there something specific that you're looking for?

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • GilaMonster (4/28/2010)


    The ldf is the transaction log, a record of changes made to the database.

    Why do you want to read it? It's not intended to be human-readable, it's for the database, to guarantee consistency and durability.

    If you really want, you can use this undocumented feature from Management studio

    SELECT * FROM fn_dblog(null, null)

    Is this just curiosity? Or is there something specific that you're looking for?

    No, it's not curiosity, i looking for store procedure about this problem. do you know a procedure about it??

    tanks

  • gilproject (4/29/2010)


    No, it's not curiosity, i looking for store procedure about this problem. do you know a procedure about it??

    What problem? There's no documented way to read the transaction log, the query I gave you is an undocumented way, you can use that.

    That said, what are you trying to do? Why do you want to read the transaction log? What's the purpose behind this request?

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • i want to see footprint of change on the database.

  • Since you're using SQL 2008, have you looked at Change data capture or Change tracking? Other than those, triggers on the tables you're interested in or SQL trace.

    The transaction log is not intended as an audit log.

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • i'm engineer student and "Read Log file" is my DB Class exercise. i'm not bad guys and i dont want it for bad purpose. is it clearly???ok??

    it,s only for learning purpose.

    tanks for help;-)

  • if it's a class exercise, I'm sure if you read the instructions for the exercise, or maybe read the chapter in your study materials for the course, it will cover this in more detail than you'd get from a forum. All the classes I've ever take gave me the tools to do the exercise if i put the effort in to do them myself.

    Can you show us what you've tried so far?

    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!

  • Indeed. And reading SQL's transaction log is a really odd thing to ask in a class exercise. If the exercise just asks you to track data changes, it's pretty unlikely that reading the transaction log is the answer that the teacher wants.

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass

Viewing 9 posts - 1 through 9 (of 9 total)

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