Updated on 2025-12-26 GMT+08:00

Granting Permissions of Database-Level db_owner Role

Scenarios

You can use a stored procedure to grant the db_owner role permissions of a database to a specified user.

Precautions

  • The stored procedure can only be executed by the rdsuser user or the database login account. The login account has all the permissions of the rdsuser user on instances. For details about the stored procedure for creating a database login account, see Creating a Database Account.
  • The database you will grant the permissions for cannot be any of the following system databases: msdb, master, model, tempdb, rdsadmin, and resource.
  • Permissions of the db_owner role can be granted to rdsuser.

Prerequisites

An RDS for SQL Server DB instance has been connected. Connect to the target DB instance using the SQL Server client. For details, see Connecting to a DB Instance.

Procedure

Run the following command to grant permissions of the db_owner role to a specified user:

EXEC master.dbo.rds_add_db_owner @dbname, @user;

  • @dbname: name of the database
  • @user: name of the user

Example

Grant the db_owner role permissions of the database testdb to testuser:

EXEC master.dbo.rds_add_db_owner @dbname='testdb',@user='testuser';