συμβάν
31 Μαρ, 11 μ.μ. - 2 Απρ, 11 μ.μ.
Το μεγαλύτερο συμβάν εκμάθησης SQL, Fabric και Power BI. 31 Μαρτίου – 2 Απριλίου. Χρησιμοποιήστε τον κωδικό FABINSIDER για να εξοικονομήσετε 400 $.
Εγγραφείτε σήμεραΑυτό το πρόγραμμα περιήγησης δεν υποστηρίζεται πλέον.
Κάντε αναβάθμιση σε Microsoft Edge για να επωφεληθείτε από τις τελευταίες δυνατότητες, τις ενημερώσεις ασφαλείας και την τεχνική υποστήριξη.
Applies to:
SQL Server
This topic describes how to specify whether a backup or restore operation continues or stops after encountering an error in SQL Server by using SQL Server Management Studio or Transact-SQL.
In This Topic
Before you begin:
To specify whether a backup or restore operation continues after encountering an error, using:
BACKUP
BACKUP DATABASE and BACKUP LOG permissions default to members of the sysadmin fixed server role and the db_owner and db_backupoperator fixed database roles.
Ownership and permission problems on the backup device's physical file can interfere with a backup operation. SQL Server must be able to read and write to the device; the account under which the SQL Server service runs must have write permissions. However, sp_addumpdevice, which adds an entry for a backup device in the system tables, does not check file access permissions. Such problems on the backup device's physical file may not appear until the physical resource is accessed when the backup or restore is attempted.
RESTORE
If the database being restored does not exist, the user must have CREATE DATABASE permissions to be able to execute RESTORE. If the database exists, RESTORE permissions default to members of the sysadmin and dbcreator fixed server roles and the owner (dbo) of the database (for the FROM DATABASE_SNAPSHOT option, the database always exists).
RESTORE permissions are given to roles in which membership information is always readily available to the server. Because fixed database role membership can be checked only when the database is accessible and undamaged, which is not always the case when RESTORE is executed, members of the db_owner fixed database role do not have RESTORE permissions.
Follow the steps to create a database backup.
On the Options page, in the Reliability section, click Perform checksum before writing to media and Continue on error.
Connect to the Database Engine.
From the Standard bar, click New Query.
In the BACKUP statement, specify the CONTINUE_AFTER ERROR option to continue or the STOP_ON_ERROR option to stop. The default behavior is to stop after encountering an error. This example instructs the backup operation to continue despite encountering an error.
BACKUP DATABASE AdventureWorks2022
TO DISK = 'Z:\SQLServerBackups\AdvWorksData.bak'
WITH CHECKSUM, CONTINUE_AFTER_ERROR;
GO
Connect to the Database Engine.
From the Standard bar, click New Query.
In the RESTORE statement, specify the CONTINUE_AFTER ERROR option to continue or the STOP_ON_ERROR option to stop. The default behavior is to stop after encountering an error. This example instructs the restore operation to continue despite encountering an error.
RESTORE DATABASE AdventureWorks2022
FROM DISK = 'Z:\SQLServerBackups\AdvWorksData.bak'
WITH CHECKSUM, CONTINUE_AFTER_ERROR;
GO
RESTORE FILELISTONLY (Transact-SQL)
RESTORE HEADERONLY (Transact-SQL)
RESTORE LABELONLY (Transact-SQL)
RESTORE VERIFYONLY (Transact-SQL)
BACKUP (Transact-SQL)
backupset (Transact-SQL)
RESTORE Arguments (Transact-SQL)
Possible Media Errors During Backup and Restore (SQL Server)
Enable or Disable Backup Checksums During Backup or Restore (SQL Server)
συμβάν
31 Μαρ, 11 μ.μ. - 2 Απρ, 11 μ.μ.
Το μεγαλύτερο συμβάν εκμάθησης SQL, Fabric και Power BI. 31 Μαρτίου – 2 Απριλίου. Χρησιμοποιήστε τον κωδικό FABINSIDER για να εξοικονομήσετε 400 $.
Εγγραφείτε σήμεραΕκπαίδευση
Λειτουργική μονάδα
Implement error handling with Transact-SQL - Training
Implement error handling with Transact-SQL
Πιστοποίηση
Microsoft Certified: Azure Database Administrator Associate - Certifications
Administer an SQL Server database infrastructure for cloud, on-premises and hybrid relational databases using the Microsoft PaaS relational database offerings.
Τεκμηρίωση
Restore and Recovery Overview (SQL Server) - SQL Server
Learn about the operations involved in recovering a SQL Server database from a failure by restoring a set of SQL Server backups in sequence.
Media errors: Backup and Restore - SQL Server
In SQL Server 2019, you can recover database despite detected errors. Use RESTORE and RESTORE VERIFYONLY with a backup checksum to check for errors.
Restore a Transaction Log Backup (SQL Server) - SQL Server
This article describes how to restore a transaction log backup in SQL Server by using SQL Server Management Studio or Transact-SQL.