SQL Server database restore error: specified cast is not valid. (SqlManagerUI)

前端 未结 4 797
情书的邮戳
情书的邮戳 2020-12-13 23:07

I am using SQL Server 2008 R2 Standard (version 10.50.1600.1) for my production website and SQL Server Express edition with Advanced Services (v10.50.1600.1) for my localho

4条回答
  •  悲哀的现实
    2020-12-13 23:26

    The GUI can be fickle at times. The error you got when using T-SQL is because you're trying to overwrite an existing database, but did not specify to overwrite/replace the existing database. The following might work:

    Use Master
    Go
    RESTORE DATABASE Publications
      FROM DISK = 'C:\Publications_backup_2012_10_15_010004_5648316.bak'
      WITH 
        MOVE 'Publications' TO 'C:\Program Files\Microsoft SQL Server\MSSQL10_50.SQLEXPRESS2008R2\MSSQL\DATA\Publications.mdf',--adjust path
        MOVE 'Publications_log' TO 'C:\Program Files\Microsoft SQL Server\MSSQL10_50.SQLEXPRESS2008R2\MSSQL\DATA\Publications.ldf'
    , REPLACE -- Add REPLACE to specify the existing database which should be overwritten.
    

提交回复
热议问题