How do I write a T-SQL backup database command to specify a file containing spaces? Here is what I have:
BACKUP DATABASE AMDMetrics TO DISK = 'C:\Documents and Settings\daultrd\My Documents\DatabaseBackups\AMD_METRICS.DAT'
And this is the error I get:
Msg 3201, Level 16, State 1, Line 1 Cannot open backup device 'C:\Documents and Settings\daultrd\My Documents\DatabaseBackups\AMD_METRICS.DAT'. Operating system error 3(The system cannot find the path specified.). Msg 3013, Level 16, State 1, Line 1 BACKUP DATABASE is terminating abnormally.
To shrink a file in SQL Server, we always use DBCC SHRINKFILE() command. This DBCC SHRINKFILE() command will release the free space for the input parameter. The file will be shrunk by either file name or file id using the command above.
Right-click the SQL Server instance and select Properties. Select the Database Settings section. At the bottom of this window, you should see the Backup default location. Browse to the new Backup location and then close.
Try sharing your intended destination folder and using a UNC path to backup from the server to your local machine.
BACKUP DATABASE AMDMetrics
TO DISK = '\\YourMachineName\SharedFolderName\AMD_METRICS.DAT'
This works for me, are you sure that the directory is correct?
backup database master to disk = 'c:\Test Me\master.bak'
Processed 41728 pages for database 'master', file 'master' on file 1.
Processed 5 pages for database 'master', file 'mastlog' on file 1.
BACKUP DATABASE successfully processed 41733 pages
in 22.911 seconds (14.230 MB/sec).
copy and paste this into explorer and see if you can get there C:\Documents and Settings\daultrd\My Documents\DatabaseBackups
This of course has to be the same machine, otherwise you need to map a drive to the location or use UNC paths
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With