重新启动SQL Server,然后进入master数据执行操作

解决方案 »

  1.   

    Database Restore
    Database backup examples illustrate restore operations performed by using SQL-DMO.Examples
    A. Restoring a Database
    This example illustrates a full database restore.Full database restore is the first step in restoring a Microsoft® SQL Server™ database lost due to hardware failure or other extreme condition.Database restore is constrained by the type of backup performed. This example illustrates a restore of a database backed up by using full database backup and no transaction log backup. When a transaction log backup maintenance strategy is used to create a chain of backup sets capturing point in time images, the initial full restore must indicate that the backup is the first in the series. For more information, see the Restoring a Database and Transaction Log Chain example later.' Create a Restore object and set action and target database properties.
    Dim oRestore As New SQLDMO.Restore
    oRestore.Action = SQLDMORestore_Database
    oRestore.Database = "Northwind"' Example illustrates restore from a striped backup. Two source devices
    ' are specified. The full database backup is indicated as the first
    ' backup set by using the FileNumber property. Note: Device creation is
    ' not illustrated in this example.
    oRestore.Devices = "[NorthDev1],[NorthDev2]"
    oRestore.FileNumber = 1' Optional. ReplaceDatabase property ensures that any existing copy
    ' of the database is overwritten.
    oRestore.ReplaceDatabase = True' Call SQLRestore method to perform the restore. In a production
    ' environment, consider wrapping the method call with a wait pointer
    ' or use Restore object events to provide feedback to the user.
    '
    ' Note: Create and connect of SQLServer object used is not
    ' illustrated in this example.
    oRestore.SQLRestore oSQLServer
    这是我再sqldmo找到的 sample, 谢谢回复, 呵呵 很不错的帮助文档