Restore.SqlRestoreAsync(Server) Restore.SqlRestoreAsync(Server) Restore.SqlRestoreAsync(Server) Method

정의

비동기식으로 복원 작업을 수행합니다. Performs a restore operation asynchronously.

public:
 void SqlRestoreAsync(Microsoft::SqlServer::Management::Smo::Server ^ srv);
public void SqlRestoreAsync (Microsoft.SqlServer.Management.Smo.Server srv);
Public Sub SqlRestoreAsync (srv As Server)
매개 변수
srv
Server Server Server

A Server 복원 작업의 대상 SQL Server의 인스턴스를 나타내는 개체입니다. A Server object that represents the instance of SQL Server that is targeted by the restore operation.

예제

다음 코드 예제를 백업 하 고 비동기적으로 데이터베이스를 복원 하는 방법을 보여 줍니다.The following code example demonstrates how to back up and restore a database asynchronously.

VBVB

Dim srv As Server = New Server("(local)")  
Dim res As Restore = New Restore()  
Dim backup As Backup = New Backup()  

backup.Devices.AddDevice("C:\AdventureWorks2012Backup.bak", DeviceType.File)  
backup.Database = "AdventureWorks2012"  
backup.Action = BackupActionType.Database  
backup.Initialize = true  
backup.SqlBackup(srv)  
srv.Databases("AdventureWorks2012").Drop()  

res.Devices.AddDevice("C:\AdventureWorks2012Backup.bak", DeviceType.File)  
res.Database = "AdventureWorks2012"  
res.NoRecovery = true  
res.SqlRestoreAsync(srv)  

PowershellPowershell

$srv = new-object Microsoft.SqlServer.Management.Smo.Server("(local)")  
$res = new-object Microsoft.SqlServer.Management.Smo.Restore  
$backup = new-object Microsoft.SqlServer.Management.Smo.Backup  

$backup.Devices.AddDevice("C:\AdventureWorks2012Backup.bak", [Microsoft.SqlServer.Management.Smo.DeviceType]::File)  
$backup.Database = "AdventureWorks2012"  
$backup.Action = [Microsoft.SqlServer.Management.Smo.BackupActionType]::Database  
$backup.Initialize = $TRUE  
$backup.SqlBackup($srv)  
$srv.Databases["AdventureWorks2012"].Drop()  

$res.Devices.AddDevice("C:\AdventureWorks2012Backup.bak", [Microsoft.SqlServer.Management.Smo.DeviceType]::File)  
$res.Database = "AdventureWorks2012"  
$res.NoRecovery = $TRUE  
$res.SqlRestoreAsync($srv)  

적용 대상