Database Restoring Status

%3CLINGO-SUB%20id%3D%22lingo-sub-1656199%22%20slang%3D%22en-US%22%3EDatabase%20Restoring%20Status%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1656199%22%20slang%3D%22en-US%22%3E%3CP%3EHi%20All%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EWe%20are%20using%26nbsp%3B%3CSPAN%3EMicrosoft%20SQL%20Server%202016%20(SP2)%20(KB4052908)%20-%2013.0.5026.0%20(X64)%20in%20our%20environment%20DB01%20as%20a%20Primary%20and%20DB02%20as%20a%20restoring%20mode%20%3CEM%3ERecently%3C%2FEM%3E%26nbsp%3BI%26nbsp%3B%3CEM%3Ehave%20checked%3C%2FEM%3E%26nbsp%3Bboth%20DB%20mdf%20files%20and%20these%20mdf%20files%20are%20different%20from%20each%20other%20DB01%20mdf%20file%20size%20is%20121GB%20and%20DB02%20is%20116%20GB%20my%20query%20is%20how%20to%20check%20restoring%20mode%20is%20on%20working%20state%20or%20not%20what%20is%20the%20steps%20to%20check%20the%20status%20of%20Database%20restoring%20is%20it%20restoring%20successfully%20or%20not.%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EKindly%20response%20regarding%20this%20subject.%3C%2FP%3E%3CP%3EThanks%20in%20Advance.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EBest%20Regards%3C%2FP%3E%3CP%3EZahid%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-1656199%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3ESQL%20Server%202016%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1768984%22%20slang%3D%22en-US%22%3ERe%3A%20Database%20Restoring%20Status%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1768984%22%20slang%3D%22en-US%22%3Ehi%2C%20%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F789994%22%20target%3D%22_blank%22%3E%40Zahidhussain%3C%2FA%3E%20your%20Question%2C%20not%20clear%20enough%20could%20you%20please%20explain%20more%20to%20able%20to%20help%20you.%3CBR%20%2F%3E%3CBR%20%2F%3EThanks%2C%3C%2FLINGO-BODY%3E
Visitor

Hi All,

 

We are using Microsoft SQL Server 2016 (SP2) (KB4052908) - 13.0.5026.0 (X64) in our environment DB01 as a Primary and DB02 as a restoring mode Recently I have checked both DB mdf files and these mdf files are different from each other DB01 mdf file size is 121GB and DB02 is 116 GB my query is how to check restoring mode is on working state or not what is the steps to check the status of Database restoring is it restoring successfully or not.

 

Kindly response regarding this subject.

Thanks in Advance.

 

Best Regards

Zahid

1 Reply

hi, @Zahidhussain your Question, not clear enough could you please explain more to able to help you.

 

As I understood from above:- 

That you need to check the restoring progress for your database so I suggest using below Query that will help you to know 

 

Note:-

the user who runs below should have sysadmin privilege or VIEW SERVER STATE permission

 

Use master

SELECT session_id as SPID, command, a.text AS Query, start_time, percent_complete, dateadd(second,estimated_completion_time/1000, getdate()) as estimated_completion_time
FROM sys.dm_exec_requests r CROSS APPLY sys.dm_exec_sql_text(r.sql_handle) a
WHERE r.command in ('RESTORE DATABASE')

 


Thanks,