25

When i go to restore my database in SQL server 2012 i can let display the script or command line action as you know. What do these additional parameters do, Nounload and stats = 10.

RESTORE DATABASE [db2] FROM  DISK = N'C:\folder\db2.bak' WITH  FILE = 1,  NOUNLOAD,  STATS = 10
GO
Promise Preston
  • 24,334
  • 12
  • 145
  • 143
RayofCommand
  • 4,054
  • 17
  • 56
  • 92
  • https://learn.microsoft.com/en-us/sql/t-sql/statements/restore-statements-arguments-transact-sql?view=sql-server-2017 – Channa Aug 18 '19 at 19:14

1 Answers1

40

Stats = 10 indicates that it will show you in the messages section of SSMS the progress of the restore in increments of 10% e.g.

  • 10% complete
  • 20% complete
  • 30% complete
  • xx% complete.........

Etc..

NOUNLOAD is a tape thing, if you are restoring from tape, specifying this will ensure that the tape is not unloaded from the drive once the restore is complete, if you're not restoring from a tape drive this option is ignored.

Documentation for RESTORE is available here:

TechNet: RESTORE

steoleary
  • 8,968
  • 2
  • 33
  • 47
  • 2
    Note that the STATS = xx value isn't always reported in exact multiples. Quoting from MSDN: "The STATS option reports the percentage complete as of the threshold for reporting the next interval. This is at approximately the specified percentage; for example, with STATS=10, the Database Engine reports at approximately that interval; for instance, instead of displaying precisely 40%, the option might display 43%. For large backup sets, this is not a problem because the percentage complete moves very slowly between completed I/O calls." – Michael Bray Apr 19 '16 at 19:12