Condividi tramite


Classe Backup

The Backup object provides programmatic access to Microsoft SQL Server backup operations.

Gerarchia di ereditarietà

System.Object
  Microsoft.SqlServer.Management.Smo.BackupRestoreBase
    Microsoft.SqlServer.Management.Smo.Backup

Spazio dei nomi  Microsoft.SqlServer.Management.Smo
Assembly:  Microsoft.SqlServer.SmoExtended (in Microsoft.SqlServer.SmoExtended.dll)

Sintassi

'Dichiarazione
Public NotInheritable Class Backup _
    Inherits BackupRestoreBase
'Utilizzo
Dim instance As Backup
public sealed class Backup : BackupRestoreBase
public ref class Backup sealed : public BackupRestoreBase
[<SealedAttribute>]
type Backup =  
    class 
        inherit BackupRestoreBase 
    end
public final class Backup extends BackupRestoreBase

Nel tipo Backup sono esposti i membri seguenti.

Costruttori

  Nome Descrizione
Metodo pubblico Backup Initializes a new instance of the Backup class.

In alto

Proprietà

  Nome Descrizione
Proprietà pubblica Action Gets or sets the type of backup to be performed.
Proprietà pubblica AsyncStatus Ottiene lo stato asincrono di un processo di backup o di ripristino. Ereditato da BackupRestoreBase.
Proprietà pubblica BackupSetDescription Gets or sets a textual description for a particular backup set.
Proprietà pubblica BackupSetName Gets or sets the name used to identify a particular backup set.
Proprietà pubblica BlockSize Ottiene o imposta le dimensioni del blocco fisico del backup o del ripristino, in byte. Ereditato da BackupRestoreBase.
Proprietà pubblica BufferCount Ottiene o imposta il numero totale di buffer di I/O da utilizzare per l'operazione di backup o di ripristino. Ereditato da BackupRestoreBase.
Proprietà pubblica Checksum Ottiene o imposta un valore della proprietà Boolean che determina se durante le operazioni di backup o di ripristino viene calcolato un valore di checksum. Ereditato da BackupRestoreBase.
Proprietà pubblica CompressionOption Gets or sets the backup compression option.
Proprietà pubblica ContinueAfterError Ottiene o imposta un valore della proprietà Boolean che determina se il backup o il ripristino continua dopo che si è verificato un errore di checksum. Ereditato da BackupRestoreBase.
Proprietà pubblica CopyOnly Gets or sets a Boolean property value that specifies the backup is a copy-only backup. This does not affect the sequence of backups in the usual backup schedule.
Proprietà pubblica Database Ottiene o imposta il database in cui l'operazione di backup o di ripristino viene eseguita. Ereditato da BackupRestoreBase.
Proprietà pubblica DatabaseFileGroups Ottiene i filegroup di SQL Server di destinazione dell'operazione di backup o di ripristino. Ereditato da BackupRestoreBase.
Proprietà pubblica DatabaseFiles Ottiene i file del sistema operativo di destinazione dell'operazione di backup o di ripristino. Ereditato da BackupRestoreBase.
Proprietà pubblica Devices Ottiene i dispositivi di backup specificati per l'operazione di backup o di ripristino. Ereditato da BackupRestoreBase.
Proprietà pubblica ExpirationDate Gets or sets the date and time when the backup set expires and the backup data is no longer considered relevant.
Proprietà pubblica FormatMedia Gets or sets a Boolean property value that determines whether a tape is formatted as the first step of the backup operation.
Proprietà pubblica Incremental Gets or sets a Boolean property value that determines whether to perform a differential backup.
Proprietà pubblica Initialize Gets or sets a Boolean property value that determines whether the devices associated with a backup operation are initialized as part of the backup operation.
Proprietà pubblica LogTruncation Gets or sets the method used to truncate the database log as part of the backup operation.
Proprietà pubblica MaxTransferSize Ottiene o imposta il numero massimo di byte da trasferire tra i supporti di backup e l'istanza di SQL Server. Ereditato da BackupRestoreBase.
Proprietà pubblica MediaDescription Gets or sets a textual description of the medium that contains a backup set.
Proprietà pubblica MediaName Ottiene o imposta il nome utilizzato per identificare un particolare set di supporti. Ereditato da BackupRestoreBase.
Proprietà pubblica Mirrors Gets or sets the list of backup devices used by the mirrored backup.
Proprietà pubblica NoRecovery Ottiene o imposta un valore della proprietà Boolean che determina se viene eseguito il backup della parte finale del log e se viene ripristinato lo stato di ripristino del database. Ereditato da BackupRestoreBase.
Proprietà pubblica NoRewind Ottiene o imposta un valore della proprietà Boolean che determina se il nastro verrà tenuto aperto da Microsoft SQL Server dopo l'operazione di backup o di ripristino. Ereditato da BackupRestoreBase.
Proprietà pubblica PercentCompleteNotification Ottiene o imposta l'intervallo percentuale per le chiamate del gestore eventi PercentCompleteEventHandler. Ereditato da BackupRestoreBase.
Proprietà pubblica Restart Ottiene o imposta un valore della proprietà Boolean che determina se l'operazione di backup o di ripristino verrà riavviata in caso di interruzione. Ereditato da BackupRestoreBase.
Proprietà pubblica RetainDays Gets or sets the number of days that must elapse before a backup set can be overwritten.
Proprietà pubblica SkipTapeHeader Gets or sets Boolean property that determines whether the tape header is read.
Proprietà pubblica UndoFileName Gets or sets the name of the undo file used to store uncommitted transactions that are rolled back during recovery.
Proprietà pubblica UnloadTapeAfter Ottiene o imposta un valore della proprietà Boolean che determina se i supporti a nastro vengono riavvolti e scaricati al termine dell'operazione di backup o di ripristino. Ereditato da BackupRestoreBase.

In alto

Metodi

  Nome Descrizione
Metodo pubblico Abort Termina un'operazione di backup o di ripristino in esecuzione. Ereditato da BackupRestoreBase.
Metodo pubblico Equals Ereditato da Object.
Metodo pubblico GetHashCode Ereditato da Object.
Metodo pubblico GetType Ereditato da Object.
Metodo pubblico Script Returns a String containing the Transact-SQL statement that can be used to execute the referenced backup.
Metodo pubblico SetMediaPassword(SecureString) Obsoleto. Imposta la password per un set di supporti. Ereditato da BackupRestoreBase.
Metodo pubblico SetMediaPassword(String) Obsoleto. Imposta la password per un set di supporti. Ereditato da BackupRestoreBase.
Metodo pubblico SetPassword(SecureString) Imposta la password per un set di backup. Ereditato da BackupRestoreBase.
Metodo pubblico SetPassword(String) Imposta la password per un set di backup. Ereditato da BackupRestoreBase.
Metodo pubblico SqlBackup Performs the database backup operation as specified by the properties of the Backup object used.
Metodo pubblico SqlBackupAsync Performs the database backup operation asynchronously as specified by the properties of the Backup object used.
Metodo pubblico ToString Ereditato da Object.
Metodo pubblico Wait Attende il completamento dell'operazione di backup o di ripristino corrente prima di passare al processo successivo. Ereditato da BackupRestoreBase.

In alto

Eventi

  Nome Descrizione
Evento pubblico Complete Si verifica al termine dell'operazione di backup o di ripristino. Ereditato da BackupRestoreBase.
Evento pubblico Information Si verifica quando da Microsoft SQL Server vengono inviati messaggi informativi che non possono essere gestiti dagli eventi Complete NextMedia o PercentComplete. Ereditato da BackupRestoreBase.
Evento pubblico NextMedia Si verifica quando l'operazione di backup o di ripristino esaurisce il supporto in un dispositivo di destinazione. Ereditato da BackupRestoreBase.
Evento pubblico PercentComplete Si verifica quando un'operazione di backup o di ripristino raggiunge un'unità di completamento. Ereditato da BackupRestoreBase.

In alto

Osservazioni

A Backup object allows you to do the following:

  • Back up a SQL Server database or database transaction log.

  • Generate a Transact-SQL BACKUP statement defining a backup.

  • Monitor a backup operation, reporting status to the user.

For SQL Server, a database delimits the largest backup unit. Although many different database backup images can be maintained on any single medium, a backup cannot span more than a single database. By default, backup operations performed with a Backup object back up a complete database.

SQL Server can write a backup to one of the following media types: disk, tape, or a proprietary medium called a backup device.

SQL Server supports backup striping. A striped backup is one directed to more than a single device. When striped, a backup is written across the devices in equal chunks. Striping is supported to a single media type only. For example, a backup can be written to two tape devices, but SQL Server cannot write part of a backup to a tape device and the rest to a disk.

At a minimum, you must supply values for a backup source and a backup target when using a Backup object. The Database property (inherited from BackupRestoreBase class) specifies the backup operation source.

To get Backup object properties, users can be a member of the public fixed server role.

To set Backup object properties, users must have BACKUP DATABASE or BACKUP LOG permissions on the database, or be a member of the db_owner and db_backupoperator fixed database role and the sysadmin fixed server role.

To run the SqlBackup method, users must have BACKUP DATABASE or BACKUP LOG permissions on the database, or be a member of the db_owner and db_backupoperator fixed database role and the sysadmin fixed server role.

Esempi

Backup e ripristino dei database e dei log delle transazioni

Protezione dei thread

I membri static (Shared in Visual Basic) pubblici di questo tipo sono affidabili. Non è invece garantita la sicurezza dei membri dell'istanza.

Vedere anche

Riferimento

Spazio dei nomi Microsoft.SqlServer.Management.Smo

Altre risorse

Backup e ripristino dei database e dei log delle transazioni

BACKUP (Transact-SQL)