Поделиться через


Метод Restore.ReadSuspectPageTable

Returns the suspect page table for the targeted instance of SQL Server.

Пространство имен:  Microsoft.SqlServer.Management.Smo
Сборка:  Microsoft.SqlServer.SmoExtended (в Microsoft.SqlServer.SmoExtended.dll)

Синтаксис

'Декларация
Public Function ReadSuspectPageTable ( _
    server As Server _
) As DataTable
'Применение
Dim instance As Restore 
Dim server As Server 
Dim returnValue As DataTable 

returnValue = instance.ReadSuspectPageTable(server)
public DataTable ReadSuspectPageTable(
    Server server
)
public:
DataTable^ ReadSuspectPageTable(
    Server^ server
)
member ReadSuspectPageTable : 
        server:Server -> DataTable
public function ReadSuspectPageTable(
    server : Server
) : DataTable

Параметры

Возвращаемое значение

Тип: System.Data.DataTable
A DataTable object that specifies the suspect page table data.

Примеры

The following code example demonstrates how to display data from the suspect page table

VB

Dim srv As Server = New Server()
Dim res As Restore = New Restore()
Dim backup As Backup = New Backup()
Dim dt As DataTable

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

res.Devices.AddDevice("C:\AdventureWorks2012Backup.BAK", DeviceType.File)
dt = res.ReadSuspectPageTable(srv)

If dt.Rows.Count = 0 Then
   Console.WriteLine("There are no entries on the suspect page list")
Else
   For Each r As DataRow In dt.Rows
      For Each c As DataColumn In dt.Columns
         Console.WriteLine(c.ToString + " = " + r(c).ToString())
      Next
   Next
End If

PowerShell

$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)

$res.Devices.AddDevice("C:\AdventureWorks2012Backup.bak", [Microsoft.SqlServer.Management.Smo.DeviceType]::File)
$dt = $res.ReadSuspectPageTable($srv)

if ($dt.Rows.Count -ne 0)
{
   foreach($r in $dt.Rows)
   {
      foreach ($c in $dt.Columns)
      {
         Write-Host $c "=" $r[$c]
      }
   }
}
else 
{ 
   Write-Host "There are no entries on the suspect page list"
}

См. также

Справочник

Restore Класс

Пространство имен Microsoft.SqlServer.Management.Smo

Другие ресурсы

RESTORE (Transact-SQL)

Резервное копирование и восстановление баз данных SQL Server