For a user to take database backups in SQL Server a user must be a member of DBCREATOR Server Role and DB_OWNER Database Role. Else you will receive the below mentioned error while performing backups.
This is Part 7 of 16 Part SQL Server Database Backup Tutorial. Click here to read it from the beginning….
Error Message
Msg 262, Level 14, State 1, Line 1
BACKUP DATABASE permission denied in database 'DatabaseName'.
Msg 3013, Level 16, State 1, Line 1
BACKUP DATABASE is terminating abnormally.
Sample TSQL Script to Create Login with DBCREATOR Server Role and DB_OWNER Database Role
CREATE LOGIN BackupRestoreAdmin WITH PASSWORD='$tr0ngP@$$w0rd'
GO
CREATE USER BackupRestoreAdmin FOR LOGIN BackupRestoreAdmin
GO
EXEC sp_addsrvrolemember 'BackupRestoreAdmin', 'dbcreator'
GO
EXEC sp_addrolemember 'db_owner','BackupRestoreAdmin'
GO
Clicking Next Page button to continue reading the topics and click on the Previous Page button to revisit the previous topic.
Related Articles
- SQL Server WHERE Clause T-SQL Tutorial with Examples
- SQL Server ORDER BY Clause T-SQL Tutorial with Examples
- SQL Server SELECT TOP Clause T-SQL Tutorial with Examples
- SQL SELECT | SQL QUERY | SQL SELECT Statement T-SQL Tutorial with Examples
- SERVERPROPERTY Function T-SQL Enhancement in SQL Server 2016
- FORMATMESSAGE Statement T-SQL Enhancement in SQL Server 2016
- STRING_SPLIT Function and STRING_ESCAPE Function in SQL Server 2016
- COMPRESS and DECOMPRESS T-SQL Enhancement in SQL Server 2016
- ALTER DATABASE SET AUTOGROW_ALL_FILES T-SQL Enhancement in SQL Server 2016