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.
Assembly: Microsoft.SqlServer.SmoExtended (in Microsoft.SqlServer.SmoExtended.dll)
A copy-only backup does not affect your overall backup and restore procedures for the database.
Copy-only backups were introduced in SQL Server 2005 for use in situations in which a backup is taken for a special purpose, such as backing up the log before an online file restore. Typically, a copy-only log backup is used one time and then deleted.
'Connect to the local, default instance of SQL Server. Dim srv As Server srv = New Server 'Reference the AdventureWorks2008R2 database. Dim db As Database db = srv.Databases("AdventureWorks2008R2") Dim bk As New Backup bk.Action = BackupActionType.Database bk.Database = "AdventureWorks2008R2" bk.CopyOnly = true
$srv = new-Object Microsoft.SqlServer.Management.Smo.Server("(local)") $db = New-Object Microsoft.SqlServer.Management.Smo.Database $db = $srv.Databases.Item("AdventureWorks2008R2") $bk = new-object Microsoft.SqlServer.Management.Smo.Backup $bk.Action = [Microsoft.SqlServer.Management.Smo.BackupActionType]::Database $bk.Database = "AdventureWorks2008R2" $bk.CopyOnly = $TRUE