Restore SQL Server database in same pc with different name

前端 未结 3 992
轮回少年
轮回少年 2021-02-19 19:12

I have:

SQL Server 2008

Database Name: database1

I had taken backup from \"database1\" nearly one month ago. Now, by someway, \"database1\" is messed up

3条回答
  •  迷失自我
    2021-02-19 19:18

    Here's where using T-SQL will help you out.

    1. Execute a "restore filelistonly from disk = 'your backup file here'" This will get you a list of the logical files for the database from the backup file along with their physical paths.
    2. Based on the information obtained from above, execute "restore database database2 from disk = 'your backup file here' with move 'logical file 1' to 'physical file name 1', move 'logical file 2' to 'physical file name 2', ...". Make sure that the physical paths that you're providing here are not in use.

提交回复
热议问题