Microsoft SQL Server database user requirements
Learn which privileges to grant the Microsoft SQL Server database user that you plan to use for ingesting into Databricks.
Databricks recommends that you create a database user that is solely used for Databricks ingestion.
Grant database privileges
The tables in this section list the privileges that the database user must have, depending on the database variation. These privileges are required whether you use change data capture (CDC) or change tracking. The tables also show the commands to grant each privilege.
Non-Azure databases
Required privileges | Where to run the commands | Commands to grant |
|---|---|---|
| Master database | Run the following T-SQL command in the master database: SQL |
Read access to the following system tables and views in the master database:
| Master database | Run the following T-SQL commands in the master database: SQL |
Execute permissions on the following system stored procedures in the master database:
| Master database | Run the following T-SQL commands in the database that you want to ingest: SQL |
| Database that you want to ingest | Run the following T-SQL command on the database that you want to ingest: SQL In SQL Server 2022 and later, you can use the more narrowly scoped SQL |
| Database that you want to ingest | Run the following T-SQL commands for each schema and table that you want to ingest: SQL |
| Database that you want to ingest | Run the following T-SQL commands in the database that you want to ingest: SQL |
Azure SQL Database
Privileges | Where to run the commands | Commands |
|---|---|---|
Membership in the following server role in the master database so the user can access master:
| Master database | Run the following T-SQL command in the master database: SQL |
Read access to the following system tables and views in the database that you want to ingest:
| Database that you want to ingest | Run the following T-SQL commands on the database that you want to ingest: SQL |
| Database that you want to ingest | Run the following T-SQL command on the database that you want to ingest: SQL In SQL Server 2022 and later, you can use the more narrowly scoped SQL |
Azure SQL Managed Instance
Privileges | Where to run the commands | Commands |
|---|---|---|
Read access to the following system tables and views in the database that you want to ingest:
| Database that you want to ingest | Run the following T-SQL commands on the database that you want to ingest: SQL |
View and read access to databases:
| Master database | Run the following T-SQL commands on the master database: SQL |
Execute permissions on the following system stored procedures:
| Master database | Run the following T-SQL commands on the master database: SQL |
| Database that you want to ingest | Run the following T-SQL command on the database that you want to ingest: SQL In SQL Server 2022 and later, you can use the more narrowly scoped SQL |
Amazon RDS for SQL Server
On Amazon RDS for SQL Server, master database grants are not required. SQL Server logins automatically receive access to the required system views and stored procedures in master through the public role. You cannot create users in the master database on Amazon RDS.
Required privileges | Where to run the commands | Commands to grant |
|---|---|---|
| Database that you want to ingest | Run the following T-SQL commands in the database that you want to ingest: SQL |
| Database that you want to ingest | Run the following T-SQL command for each schema or table that you want to ingest: SQL |
Change data capture (CDC) privilege requirements
If CDC is enabled, additional privileges are required on the DDL support objects. See Prepare SQL Server for ingestion using the utility objects script.
For CDC setup on Amazon RDS, the user running the utility setup script must be the RDS master user, or must be granted EXECUTE on msdb.dbo.rds_cdc_enable_db by the master user. You must first create the user in msdb before granting this permission:
USE msdb;
CREATE USER SETUP_USER FOR LOGIN SETUP_USER;
GRANT EXECUTE ON dbo.rds_cdc_enable_db TO SETUP_USER;
GO
This extra permission is not required for change tracking setup.
Change tracking privilege requirements
If change tracking is enabled, additional privileges are required on the DDL support objects. See Prepare SQL Server for ingestion using the utility objects script.