SQL Restore without Percentage

Have you ever wanted to restore a database to create some documentation? In this case it usually is done outside of production environment, so it does not matter how long the restore process will take. And if you have a complete backup policy with FULL, DIFFERENTIAL and LOG backups, you will probably need to restore at least 2 or 3 files to bring your database online and do some tests on it.

In my case I wanted to capture a simple screenshot showing the “Restore sucessfull” of two separate files, but by default the restore script created by the SSMS will put the percentage of the job that is done in the output window and it will not fit on a single screen. The culprit of that is the option “STATS = 10”. Erase it and the output window will only show the final message. Example of script and output below:

RESTORE DATABASE [Your_Base] FROM
 DISK = N'C:\tmp\Your_Base_backup_full.bak'
 WITH  FILE = 1,  NORECOVERY,  NOUNLOAD,  REPLACE
GO
RESTORE DATABASE [Your_Base] FROM
 DISK = N'C:\tmp\Your_Base_backup_diferential.dif'
 WITH  FILE = 1,  RECOVERY,  NOUNLOAD,  REPLACE
GO
Processed 27576 pages for database 'Your_Base', file 'Your_Base' on file 1.
Processed 3 pages for database 'Your_Base', file 'Your_Base_log' on file 1.
RESTORE DATABASE successfully processed 27579 pages in 1.057 seconds (203.835 MB/sec).
Processed 1800 pages for database 'Your_Base', file 'Your_Base' on file 1.
Processed 1 pages for database 'Your_Base', file 'Your_Base_log' on file 1.
RESTORE DATABASE successfully processed 1801 pages in 0.191 seconds (73.656 MB/sec).

And thats it for today. I know, it is a little too modest after almost a month without posting any advanced problems or solutions. But only yesterday my desktop at home was turned on for the first time in 3 months. I hope to keep this blog more up to date from now on. Cya!

Advertisements

About mauriciorpp

Hi, I am Piccolo - but not the one from Dragon Ball. I'm from a highly competitive and fast-paced world too, the IT industry, and this space will be used to share some challenges I face daily on my career. As you will see, I don't do brawls but I need to be a fighter! Stay tuned.
This entry was posted in SQLServer and tagged , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s