The following command in the cmd window
sqlcmd -S. -Usa -Ppass -dmaster -Q "RESTORE DATABASE [MYDATABASE] FROM DISK = 'D:\SQL Server\MYDATABASE.BAK' WITH FILE = 1, NOUNLOAD, REPLACE, STATS = 10"
displays the following output:
10 percent processed.
20 percent processed.
30 percent processed.
40 percent processed.
50 percent processed.
60 percent processed.
70 percent processed.
80 percent processed.
90 percent processed.
100 percent processed.
Processed 32320 pages for database 'MYDATABASE', file 'MYDATABASE' on file 1.
Processed 7 pages for database 'MYDATABASE', file 'MYDATABASE_log' on file 1.
But it turns out that the result is shown only after the entire recovery, which makes the statistics useless.
Any tips?
Here is the sqlcmd utility version:
Microsoft (R) SQL Server Command Line Tool
Version 12.0.2000.8 NT
Copyright (c) 2014 Microsoft. All rights reserved.
Update to 2016:
By simply including the comment, the Microsoft Connect link added in the comment:
SQLCMD was rewritten in SQL 2012 to use ODBC. Here is a small regression error that seems to have sneaked in.
The same effect was specified when invoked RAISERROR('Hello', 0, 1) WITH NOWAIT
by script.
source
share