question

sunithalee143 avatar image
sunithalee143 asked

problem with backup

hi, i am taking the backup of a database with file name msd_tsp-wer-rty-123 then i am getting the error i am trying to rename the database to msd_tsp_wer_rty_123 then the database could not be exclusive ly locked to perform the opreration.when i am converting to single user mode then also its saying the same error can any one can help how to take backup now i am using the syntax Backup Database msd_tsp-wer-rty-123 to disk='c:\sts.bak' please its urgent. help me now
sql-server-2005
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Magnus Ahlkvist avatar image
Magnus Ahlkvist answered
Did you try using brackets for the database name? BACKUP DATABASE [msd_tsp-wer-rty-123] TO DISK 'c:\some\directory\filename.bak' or in your case Backup Database [msd_tsp-wer-rty-123] to disk='c:\sts.bak'
1 comment
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

sunithalee143 avatar image sunithalee143 commented ·
Thanks a lot it worked.you have helped me at right time.Thanks once again. when i talken the backup by givin braces[] it worked thanks.
0 Likes 0 ·
Tim avatar image
Tim answered
Can you post the actual syntax you are using? I typically use. BACKUP DATABASE MY_DB TO DISK = 'J:\BACKUP\FULL\MY_DB_06-30-2011.BAK'
3 comments
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

sunithalee143 avatar image sunithalee143 commented ·
yes backup database database name to disk='N:\sts.bak'
0 Likes 0 ·
Kev Riley avatar image Kev Riley ♦♦ commented ·
@sunithalee : it would better if you could post the ACTUAL code - you have a syntax error, and it is difficult to say where if you only post generic code.
0 Likes 0 ·
Tim avatar image Tim commented ·
Ah yes, it appears you have been bitten by the hyphens in the name. You have to enclose your database name in brackets. [ ]
0 Likes 0 ·
Kev Riley avatar image
Kev Riley answered
if you have '-' in your database name, you should reference it between [] delimiters e.g. BACKUP DATABASE [msd_tsp-wer-rty-123] ........
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.