What are the challenges you face when working across database platforms? Take the survey
Options

Can Backup 5 restore to new database?

mrn242mrn242 Posts: 4
edited October 15, 2010 11:28PM in SQL Backup Previous Versions
Is there a way to restore to a new - or even a different - database using SQL Backup 5?

Comments

  • Options
    peteypetey Posts: 2,358 New member
    Yes. If you want to use the same database files as the original database, omit the MOVE options e.g.
    EXEC master..sqlbackup '-sql "RESTORE DATABASE AdventureWorks_copy FROM DISK = [g:\backups\AdventureWorks.sqb]"'
    
    If you want to create new database files, use the MOVE options e.g.
    EXEC master..sqlbackup '-sql "RESTORE DATABASE AdventureWorks_copy FROM DISK = [g:\backups\AdventureWorks.sqb] WITH MOVE [AdventureWorks_dat] TO [e:\sqldata\AdventureWorks_copy.mdf], MOVE [AdventureWorks_log] to [e:\sqldata\AdventureWorks_copy.ldf]"'
    
    Peter Yeoh
    SQL Backup Consultant Developer
    Associate, Yohz Software
    Beyond compression - SQL Backup goodies under the hood, updated for version 8
Sign In or Register to comment.