none
请教:我想根据一个标准数据库复制200个数据库,要求在visual studio中完成 该如何做 RRS feed

  • 问题

  • 请教:我想根据一个标准数据库复制200个数据库,要求在visual studio中完成,本来是想先复制标准数据库,然后新建目标数据库,然后恢复标准数据库上去,可是行不通。sql语句如下:
    backup database sample to disk='d:\data\backup\sample.bak' with init
    CREATE DATABASE data1
    RESTORE   FILELISTONLY 
      from   disk='d:\data\backup\sample.bak' 
     
    restore database
    data1 from
    disk='d:\data\backup\sample.bak' with NORECOVERY,
    move 'sample' to 'C:\Program Files\Microsoft SQL Server\MSSQL\Data\data1.mdf',
    move 'sample_log' to 'C:\Program Files\Microsoft SQL Server\MSSQL\Data\data1_log.ldf'

    提示:
    Server: Msg 3234, Level 16, State 2, Line 1
    Logical file 'sample' is not part of database 'data1'. Use RESTORE FILELISTONLY to list the logical file names.
    Server: Msg 3013, Level 16, State 1, Line 1
    RESTORE DATABASE is terminating abnormally.
    2009年8月13日 3:33

答案

全部回复