Finding SQL Server recovery execution from inside C #

I know that this is most likely a simple question, but when you restore the database from inside the SQL management studio, you can set the update interval with statistics

RESTORE DATABASE [test] FROM  DISK = N'C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Backup\test.bak' WITH  FILE = 1,  NOUNLOAD,  STATS = 10

If I wanted to execute this line of code from within C #, how would I be able to make progress? Currently, I just use System.Data.SqlClient.SqlCommand.ExecuteNonQuery(), but I can’t figure out how to make progress.

Also, if it is faster, using the Microsoft.SQLServer namespace is acceptable.

+3
source share
2 answers

:

SELECT @@SPID;

. sys.dm_exec_requests percent_complete , restore:

:

  • ALTER INDEX REORGANIZE
  • AUTO_SHRINK ALTER DATABASE
  • CREATE INDEX
  • DBCC CHECKDB
  • DBCC CHECKFILEGROUP
  • DBCC
  • DBCC INDEXDEFRAG
  • DBCC SHRINKDATABASE
  • DBCC SHRINKFILE
  • KILL (Transact-SQL)
  • .
+4

Source: https://habr.com/ru/post/1736142/


All Articles