Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SQL-Server: What does NOUNLOAD and STATS mean in sql command line when restoring a DB?

Tags:

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 
like image 498
RayofCommand Avatar asked Oct 18 '13 07:10

RayofCommand


People also ask

What is Nounload in SQL Restore?

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.

What is the command to restore database in SQL Server?

Using SQL Server Management StudioRight-click the database, point to Tasks, and then click Restore. Click the type of restore operation you want (Database, Files and Filegroups, or Transaction Log). This opens the corresponding restore dialog box. On the General page, in the Restore source section, click From device.

How do you check if restore completed successfully in SQL Server?

Open SSMS, right click on a database then select Tasks > Restore. A screen similar to the below image will open. After you select all of the restore options and click OK, you can monitor the progress on the lower left side of the GUI as shown in the below image. This will give you an idea of the status of the restore.

How do I restore a SQL Server database from a BAK file?

Restore the database from a BAK fileRight-click on the database server in the left navigation pane, click Tasks, click Restore. The name of the restoring database appears in the To database list box. To create a new database, enter its name in the list box. Select 'From device'.


1 Answers

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

like image 130
steoleary Avatar answered Sep 27 '22 23:09

steoleary