How do I copy SQL Server 2012 database to localdb instance?

后端 未结 9 1899
你的背包
你的背包 2021-02-04 00:49

I\'m looking to copy a SQL Server 2012 Standard database to my localdb instance. I\'ve tried the wizard which complains that localdb isn\'t a SQL Server 2005 or later expres

9条回答
  •  遇见更好的自我
    2021-02-04 01:02

    RESTORE FILELISTONLY
    FROM DISK = 'D:\SQLBackups\yourdatabase.BAK'
    
    
    ALTER DATABASE yourdatabasename
    SET SINGLE_USER WITH
    ROLLBACK IMMEDIATE
    
    RESTORE DATABASE yourdatabasename
    FROM DISK = 'D:\SQLBackups\yourdatabase.BAK'
    with replace,
    move 'logical name from file stream' to
    'C:\yourdatabase.mdf',
    move 'logical name from file stream' to 'C:\Yourdatabase.ldf'
    ALTER DATABASE Qatar_DB SET MULTI_USER
    

提交回复
热议问题