Thursday, October 11, 2012

SQL Server Management Studio (SSMS) 2005/2008/2012 Auto Recovery Files

When I started my PC today, I observed it has restarted forecefully due to windows auto update. I quickly opened Sql Server Management Studio (SSMS) wondering if my files will be recovered automatically as SSMS prompts usually. But It didn't.

I was wondering if I need to rewrite the script. but thought of sniffing temp folders to try my luck. A windows search of "*.sql" pointed me to some temp files in folder "C:\Users\\Documents\SQL Server Management Studio\Backup Files\Solution1".

That's it, SSMS keeps unsaved scripts in this folder by default. You can disable this feature if you would like.

There is no direct option to enable/disable Auto Recover settings in 2005/2008. If you are too keen you can do so by tweaking registry setting, here are the steps:

-- SSMS 2005/2008

- Open registry editor (type regedit in windows run)
- For SSMS 2005, Go to the key HKEY_CURRENT_USER\Software\Microsoft\Microsoft SQL Server\90\Tools\Shell\General\AutoRecover
- For SSMS 2008, Go to the key HKEY_CURRENT_USER\Software\Microsoft\Microsoft SQL Server\100\Tools\Shell\General\AutoRecover
- Change DWORD "AutoRecover Enabled" to 1 for Enabling and 0 for Disabling Auto Recovery

-- SSMS 2012

There is a better way to change this setting in SSMS 2012

- Open SSMS 2012 and click on Tools >> Options

- In Options dialog box click on Environment >> AutoRecover

- Check/Uncheck "Save AutoRecover information every" checkbox to enable or disable Auto Recovery
- You can modify the Auto Save interval between 1 to 60 minutes
- There is an setting for the number of days Auto Recover information can be persisted.

It is possible to modify registry setting for SSMS 2012 as well. The location of this registry key has changed to HKEY_CURRENT_USER\Software\Microsoft\SQL Server Management Studio\11.0\General\AutoRecover

5 comments:

LearningMan said...

How can we change location for auto recovery?

Unknown said...

Informative post about SQL Server managemnt.

Thanks

Server Maintenance in Bristol

elson cade said...
This comment has been removed by the author.
elson cade said...
This comment has been removed by the author.
elson cade said...

Server buddies provides Quality remote server management including troubleshooting, Server Management, Plesk Support, Server Maintenance, Server Monitoring, Server Troubleshooting and support for a large variety of customers at affordable rates. Here are option for Server Management, Server Maintenance, Server Monitoring, Server Troubleshooting, Server Optimization, Plesk Support, Linux Support, cPanel Support and Plesk Support.
.........