Backup\ Restore completion Status.

  • SQL_Hunt

    SSC-Dedicated

    Points: 33450

    Comments posted to this topic are about the item Backup\ Restore completion Status.

    Thanks.

  • vk-kirov

    SSCertifiable

    Points: 7686

    Nice question.

    I answered wrong even after reading BOL. I definitely need to learn more about that dynamic views because they contain a lot of useful stuff.

    Maybe the word "job" is a little bit confusing in the context of the QOTD because in SQL Server it means "specified series of operations performed sequentially by SQL Server Agent".

  • Carlo Romagnano

    SSC-Insane

    Points: 22008

    vk-kirov (5/18/2010)


    Maybe the word "job" is a little bit confusing in the context of the QOTD because in SQL Server it means "specified series of operations performed sequentially by SQL Server Agent".

    I agree, the right word is BATCH.

  • Atif-ullah Sheikh

    SSChampion

    Points: 12495

    confused...

    ----------------------------------------------------------------------------------------------------------------------------------------------------------------------
    Sometimes, winning is not an issue but trying.
    You can check my BLOG
    [font="Arial Black"]here[/font][/url][/right]

  • dgabele

    SSCarpal Tunnel

    Points: 4975

    Once a job completes (100%), it no longer appears in the dmv right? Am I correct in understanding that the DMV only shows currently executing requests?

    Thanks

  • gary.mazzone

    SSCarpal Tunnel

    Points: 4271

    I got it right but since when is a Dynamic Management View a table?

  • WayneS

    SSC Guru

    Points: 95392

    gary.mazzone (5/18/2010)


    I got it right but since when is a Dynamic Management View a table?

    I agree with you Gary... it's a view (albeit into a system table).

    And with Carlo also... it's a "batch", not a job.

    Wayne
    Microsoft Certified Master: SQL Server 2008
    Author - SQL Server T-SQL Recipes


    If you can't explain to another person how the code that you're copying from the internet works, then DON'T USE IT on a production system! After all, you will be the one supporting it!
    Links:
    For better assistance in answering your questions
    Performance Problems
    Common date/time routines
    Understanding and Using APPLY Part 1 & Part 2

  • sjimmo

    SSChampion

    Points: 11139

    Which table helps to find the completion status of the job(e.g, backup, restore etc..) in SQL Server 2005?

    :discuss:Unfortunately I believe that none of the answers are correct for this question. The answers refer to batches, and use DMV's. The answer to your question would be to read the message field in the sysjobhistory table in msdb in order to get the status of the job. Also, these batch statuses are not in the tables used by the DMV for long making it difficult to get the completion status, unless the absence of an entry equals the completion but that does not tell you if the completion is a success or failure. But you can get the percentage of completion.

    Steve Jimmo
    Sr DBA
    “If we ever forget that we are One Nation Under God, then we will be a Nation gone under." - Ronald Reagan

  • Steve Jones - SSC Editor

    SSC Guru

    Points: 720887

    Changed it to a DMV from a table. We generically seem to use "table" for system tables, views, and DMVs, which isn't correct.

    The question has been edited to say "batch" as well.

  • Oleg Netchaev

    SSCertifiable

    Points: 5272

    This is a very good question, thank you. I answered it correctly, but only because I knew that neither option 1 nor 3 is correct. This only left option 2 as a single available choice. It is good to start the day by learning something new from the QotD.

    Oleg

  • Trey Staker

    SSCarpal Tunnel

    Points: 4736

    Thanks Steve for changing the original question. I use this all the time to figure out how far along a backup or restore is.

    ---------------------------------------------------------------------
    Use Full Links:
    KB Article from Microsoft on how to ask a question on a Forum

  • Cliff Jones

    SSChampion

    Points: 10517

    dgabele (5/18/2010)


    Once a job completes (100%), it no longer appears in the dmv right? Am I correct in understanding that the DMV only shows currently executing requests?

    Thanks

    I think had the same confusion. I read the question as to check the completion status of the backup after it had completed. Not as an ongoing monitoring of the progress of the task.

  • Kari Suresh

    Hall of Fame

    Points: 3712

    Yes, it is good question but where and how we can use this? Anybody can explain with an example?

    KSB
    -----------------------------
    Thousands of candles can be lit from a single candle, and the life of the candle will not be shortened. Knowledge and happiness never decreases by being shared.” - Buddha

  • vk-kirov

    SSCertifiable

    Points: 7686

    Kari Suresh (5/19/2010)


    where and how we can use this? Anybody can explain with an example?

    For example, it may be very useful when a big transaction rolls back and you want to know the progress status of the rollback.

    Here is a simple example. First of all, let's create a table and fill it with the data (it took 5 minutes on my local machine, and 1800 MB on the hard drive (800 MB for the data file and 1000 MB for the log file)).

    SET NOCOUNT ON

    GO

    CREATE TABLE RollbackTest (a CHAR(8000))

    GO

    BEGIN TRANSACTION

    GO

    INSERT RollbackTest VALUES ('test')

    GO 100000

    Here we have a huge uncommitted transaction. Let's roll it back (it took 6 minutes on my local machine):

    ROLLBACK TRANSACTION

    We can monitor the rollback progress in another window:

    SELECT percent_complete, *

    FROM sys.dm_exec_requests

    WHERE session_id = <spid of the rollback process>

    Also we can monitor the progress of backups/restores/etc.

    Of course, we can't see the execution progress of queries (such as SELECT/INSERT/UPDATE/etc).

  • deepak.a

    SSCertifiable

    Points: 5330

    Good Question 🙂

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

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