They told me (Alessandro Alpi), to don’t blog this 🙂 because there’s a lot of this stuff out there, but this my blog, and it is too cool when developing in load testing environment, and you need to backup, try load test data, and restore previous version, so forgive me about this:
sys.sp_MSforeachdb @command1 = N'BACKUP DATABASE [?] TO DISK = N''C:\_Databases\_Backup\Databases\?.bak'' WITH NOFORMAT, INIT'
Change the “C:\_Databases\_Backup\Databases\” into your default BackupDirectory found in the instance facets, to avoid security problem.
DON’T USE THIS CODE IN PRODUCTION!!
One thought on “Sql Server: Backup all the databases of the instance”
Reblogged this on Alessandro Alpi's Blog and commented:
ahahahah, thank you Michael 🙂