Using backup and restore script

  • How to use backup and restore script if the database name has a space

    eg: database name : A B C

    backup database A B C to disk ='D:\backup\A B C.bak' with init,stats

    restore database A B C from disk = 'D:\backup\A B C.bak'

    are both failing because of this. I don't want to use enterprise manager.

    Kindly help in fixing this.

    M&M

  • Use quotes around the file path.

    - Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
    Property of The Thread

    "Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon

  • restore database [A B C] from disk = 'D:\backup\A B C.bak'



    Shamless self promotion - read my blog http://sirsql.net

  • BACKUP DATABASE [A B C] TO DISK = N'D:\backup\A B C.bak'

    WITH NOFORMAT, NOINIT, NAME = N'A B C-Full Database Backup',

    SKIP, NOREWIND, NOUNLOAD, STATS = 10

    GO

    RESTORE DATABASE [A B C] FROM DISK = N'D:\backup\A B C.bak'

    WITH FILE = 1, NOUNLOAD, REPLACE, STATS = 10

    GO

    SQL DBA.

  • Thank you all for the details. 🙂

    M&M

Viewing 5 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply