Opening a SQL Server .bak file (Not restoring!)

前端 未结 5 1314
粉色の甜心
粉色の甜心 2021-01-30 13:18

I have been reading a LOT of google posts and StackOverflow questions about how to restore a database in SQL Server from a .bak file.

But none of them states how to just

5条回答
  •  梦毁少年i
    2021-01-30 13:42

    Just to add my TSQL-scripted solution:

    First of all; add a new database named backup_lookup. Then just run this script, inserting your own databases' root path and backup filepath

    USE [master]
    GO
    RESTORE DATABASE backup_lookup
     FROM DISK = 'C:\backup.bak'
    WITH REPLACE,
     MOVE 'Old Database Name' TO 'C:\Program Files\Microsoft SQL Server\MSSQL10_50.MSSQLSERVER\MSSQL\DATA\backup_lookup.mdf',
     MOVE 'Old Database Name_log' TO 'C:\Program Files\Microsoft SQL Server\MSSQL10_50.MSSQLSERVER\MSSQL\DATA\backup_lookup_log.ldf'
    GO
    

提交回复
热议问题