Cannot perform a backup or restore operation within a transaction.BACKUP DATABASE is terminating abnormally.
You are trying to take a Database Backup and you might end up with below error:
"Msg 3021, Level 16, State 0, Line 1
Cannot perform a backup or restore operation within a transaction.
Msg 3013, Level 16, State 1, Line 1
BACKUP DATABASE is terminating abnormally."
The error clearly says you are running Backup operation under a transaction, sample code below
BEGIN TRAN GO USE master GO BACKUP DATABASE [TEST] TO DISK = 'C:\Test.bak' GO
Sample Error Screenshot:
This is because backup command is a Serialized operation and you cannot run under this a transaction. Just run the backup command outside transaction as shown below and issue Rollback command to make sure the transaction is no longer valid.
USE master GO BACKUP DATABASE [TEST] TO DISK = 'C:\temp\Test.bak' GO
Sample Success Screenshot: