Options

Examples of the Restore command

rand201rand201 Posts: 9
edited September 2, 2008 8:59AM in SQL Backup Previous Versions
Does some on have an example of how to use the RESTORE DATABASE commad with a MOVE TO.

Thanks
Thanks

Art

Comments

  • Options
    peteypetey Posts: 2,358 New member
    The syntax is similar to that for regular T-SQL restores e.g.
    EXEC master..sqlbackup '-sql "RESTORE DATABASE AdventureWorks FROM DISK = [g:\backups\AdventureWorks.sqb] WITH MOVE [AdventureWorks_Data] TO [h:\sqldata\AdventureWorks_Data.mdf], MOVE [AdventureWorks_Log] TO [l:\sqllogs\AdventureWorks_Log.ldf]" '
    
    Peter Yeoh
    SQL Backup Consultant Developer
    Associate, Yohz Software
    Beyond compression - SQL Backup goodies under the hood, updated for version 8
  • Options
    I need to use a REPLACE it says.
    Thanks

    Art
  • Options
    peteypetey Posts: 2,358 New member
    That's the standard SQL Server message you're seeing, if you are restoring over an existing database whose transaction log contains data that has not been backed up.

    If you don't need the data in the transaction log, then run the restore command with the REPLACE option e.g.
    EXEC master..sqlbackup '-sql "RESTORE DATABASE AdventureWorks FROM DISK = [g:\backups\AdventureWorks.sqb] WITH MOVE [AdventureWorks_Data] TO [h:\sqldata\AdventureWorks_Data.mdf], MOVE [AdventureWorks_Log] TO [l:\sqllogs\AdventureWorks_Log.ldf], REPLACE" '
    

    Otherwise, back up the transaction log before running the restore.
    Peter Yeoh
    SQL Backup Consultant Developer
    Associate, Yohz Software
    Beyond compression - SQL Backup goodies under the hood, updated for version 8
  • Options
    Can you tell me RedGate SQL Backup is cluster aware?
    Thanks

    Art
  • Options
    peteypetey Posts: 2,358 New member
    When you install SQL Backup on a cluster, does it recognise that the selected instance is a cluster resource, and provide an option to install on all cluster nodes, and install SQL Backup as a cluster resource? Yes.

    When you upgrade SQL Backup, does it also upgrade all cluster nodes, if the account running the upgrade has adequate rights? Yes.

    When you uninstall SQL Backup, does it also uninstall from all cluster nodes, if the account running the upgrade has adequate rights? Yes.

    When SQL Backup is installed on a cluster, does it know how to use the SQL Server cluster name instead of the machine name? Yes.

    All the above applies only to clusters running Microsoft Clustering Services. If your clustering uses technology from another vendor, we will need to address it separately.

    Does the above address your 'cluster aware' question?
    Peter Yeoh
    SQL Backup Consultant Developer
    Associate, Yohz Software
    Beyond compression - SQL Backup goodies under the hood, updated for version 8
  • Options
    That does answer all my questions. Thanks.
    Thanks

    Art
Sign In or Register to comment.