Home / Data Platform / Warehouses

Data PlatformRunbookAdvanced

Sev1: a Snowflake role was dropped and pipelines, tasks and dashboards fail with insufficient privileges

A production role was dropped. Users and service accounts lose access, owned objects move to the dropping role and tasks pause. Recreate the role, rebuild grants from ACCOUNT_USAGE and give ownership back.

Deepak Bhardwaj6 min read

Applies toSnowflake (all editions); SNOWFLAKE.ACCOUNT_USAGE views; roles managed by SQL, Terraform or another IaC tool

Symptoms

  • ETL jobs, dbt runs and BI tools fail with Insufficient privileges to operate on ... or Object does not exist or not authorized.
  • Service users fail to connect or start a session because their DEFAULT_ROLE no longer exists.
  • Tasks that were owned by the role are suspended and have stopped running.
  • SHOW ROLES LIKE 'TRANSFORMER' returns nothing.

When you run DROP ROLE, Snowflake revokes every grant to and from the role, and the role that executed the drop takes ownership of every object the dropped role owned. Tasks owned by the role are paused when their ownership moves. There is no UNDROP ROLE. You recreate the role and rebuild its grants.

Warning

Do not drop and recreate more roles to "reset" access during the incident. Each drop revokes another set of grants. Fix the one that was dropped.

1. Confirm scope and impact

Find the drop and who ran it:

SELECT start_time, user_name, role_name, query_text
FROM snowflake.account_usage.query_history
WHERE query_text ILIKE 'drop role%'
  AND start_time > DATEADD('day', -2, CURRENT_TIMESTAMP())
ORDER BY start_time DESC;

ACCOUNT_USAGE views have latency (up to a few hours, depending on the view). If the drop happened minutes ago, also check TABLE(INFORMATION_SCHEMA.QUERY_HISTORY()) or Query History in Snowsight.

Write down three things: the dropped role name, the exact drop time and the role_name that executed it. That last role now owns the objects.

2. Rebuild the grant list from ACCOUNT_USAGE

Revoked grants stay in GRANTS_TO_ROLES and GRANTS_TO_USERS with DELETED_ON set. Pull the grants that were active right before the drop:

-- Privileges the dropped role held, and objects it owned
SELECT privilege, granted_on, table_catalog, table_schema, name, grant_option
FROM snowflake.account_usage.grants_to_roles
WHERE grantee_name = 'TRANSFORMER'
  AND granted_to = 'ROLE'
  AND deleted_on >= '2026-11-13 09:40:00'::timestamp_ltz
ORDER BY granted_on, table_catalog, table_schema, name;

-- Roles granted TO the dropped role (its parents in the hierarchy)
-- and roles it was granted to
SELECT name AS role_granted, grantee_name, deleted_on
FROM snowflake.account_usage.grants_to_roles
WHERE granted_on = 'ROLE'
  AND (name = 'TRANSFORMER' OR grantee_name = 'TRANSFORMER')
  AND deleted_on >= '2026-11-13 09:40:00'::timestamp_ltz;

-- Users who had the role
SELECT grantee_name AS user_name
FROM snowflake.account_usage.grants_to_users
WHERE role = 'TRANSFORMER'
  AND deleted_on >= '2026-11-13 09:40:00'::timestamp_ltz;

Use a timestamp slightly before the drop. If these return nothing yet, the view has not caught up. Wait, or rebuild from your IaC repo in the meantime.

Tip

Future grants (GRANT ... ON FUTURE TABLES IN SCHEMA ...) are not reconstructed by these queries. Take them from your Terraform or grant scripts. Without them, tables created after the incident will be invisible to the role.

3. The fix

Run as SECURITYADMIN (or USERADMIN for the role itself). Use ACCOUNTADMIN only where ownership needs it.

Recreate the role and its place in the hierarchy

USE ROLE USERADMIN;
CREATE ROLE TRANSFORMER COMMENT = 'Recreated after incident INC-1234';

USE ROLE SECURITYADMIN;
GRANT ROLE TRANSFORMER TO ROLE SYSADMIN;          -- parent(s) from step 2
GRANT ROLE ANALYTICS_READ TO ROLE TRANSFORMER;    -- child roles from step 2
GRANT ROLE TRANSFORMER TO USER SVC_DBT;           -- users from step 2

The fastest way back for service users is to run the IaC apply if the role is managed in code. Use the SQL above only for what the code does not cover.

Re-grant privileges

Generate statements from the step 2 result instead of typing them:

SELECT 'GRANT ' || privilege || ' ON ' || granted_on || ' '
       || IFF(table_catalog IS NULL, '', table_catalog || '.')
       || IFF(table_schema  IS NULL, '', table_schema  || '.')
       || name || ' TO ROLE TRANSFORMER'
       || IFF(grant_option = 'true', ' WITH GRANT OPTION', '') || ';' AS stmt
FROM snowflake.account_usage.grants_to_roles
WHERE grantee_name = 'TRANSFORMER' AND granted_to = 'ROLE'
  AND privilege <> 'OWNERSHIP'
  AND deleted_on >= '2026-11-13 09:40:00'::timestamp_ltz;

Review the output before you run it. Object names that need quoting (mixed case, special characters) and some granted_on values (for example INTEGRATION types) need manual edits. For broad access, schema-level bulk grants are quicker:

GRANT USAGE ON DATABASE ANALYTICS TO ROLE TRANSFORMER;
GRANT USAGE ON ALL SCHEMAS IN DATABASE ANALYTICS TO ROLE TRANSFORMER;
GRANT SELECT ON ALL TABLES IN SCHEMA ANALYTICS.STAGING TO ROLE TRANSFORMER;
GRANT SELECT ON FUTURE TABLES IN SCHEMA ANALYTICS.STAGING TO ROLE TRANSFORMER;
GRANT USAGE ON WAREHOUSE TRANSFORM_WH TO ROLE TRANSFORMER;

Give ownership back

Objects the role owned now belong to the role that ran the drop. Transfer them back and keep the other roles' grants:

GRANT OWNERSHIP ON ALL TABLES IN SCHEMA ANALYTICS.MARTS
  TO ROLE TRANSFORMER COPY CURRENT GRANTS;
GRANT OWNERSHIP ON ALL VIEWS IN SCHEMA ANALYTICS.MARTS
  TO ROLE TRANSFORMER COPY CURRENT GRANTS;
GRANT OWNERSHIP ON SCHEMA ANALYTICS.MARTS TO ROLE TRANSFORMER COPY CURRENT GRANTS;

Caution

GRANT OWNERSHIP without COPY CURRENT GRANTS revokes the existing grants on those objects, and other roles lose access too. Always include it during recovery.

Use the OWNERSHIP rows from step 2 to limit the transfer to objects the dropped role actually owned. In a shared schema, ON ALL TABLES can take ownership away from other teams.

Resume tasks and fix user defaults

SHOW TASKS IN DATABASE ANALYTICS;
GRANT OWNERSHIP ON TASK ANALYTICS.MARTS.LOAD_ORDERS TO ROLE TRANSFORMER COPY CURRENT GRANTS;
ALTER TASK ANALYTICS.MARTS.LOAD_ORDERS RESUME;

ALTER USER SVC_DBT SET DEFAULT_ROLE = TRANSFORMER;

For task graphs, resume child tasks before the root task, or use SELECT SYSTEM$TASK_DEPENDENTS_ENABLE('ANALYTICS.MARTS.ROOT_TASK'); to resume the whole graph.

4. Verify recovery

SHOW GRANTS TO ROLE TRANSFORMER;
SHOW GRANTS OF ROLE TRANSFORMER;
SHOW FUTURE GRANTS IN SCHEMA ANALYTICS.STAGING;

Compare grant counts with the step 2 output. Then run one real workload as the service user, for example dbt debug and one model, and check that each task's next run succeeds:

SELECT name, state, error_message, scheduled_time
FROM TABLE(INFORMATION_SCHEMA.TASK_HISTORY())
ORDER BY scheduled_time DESC LIMIT 20;

Communicate

Tell pipeline owners which jobs missed runs between the drop and the fix, so they can backfill. Paused tasks do not catch up on missed schedules by themselves. Tell BI owners to refresh any extracts that failed.

Prevent it next time

  • Manage roles and grants as code, and block DROP ROLE outside the pipeline with a review step.
  • Limit who can drop roles. Role ownership decides it, so keep functional roles owned by USERADMIN or a dedicated admin role, not by individuals. Check the 2026_01 behavior-change notes for changes to the privileges DROP ROLE needs.
  • Before any planned drop, transfer ownership explicitly with GRANT OWNERSHIP ... COPY CURRENT GRANTS, then run SHOW GRANTS TO ROLE to confirm nothing is left.
  • Snapshot SHOW GRANTS output daily to a table so recovery does not depend on ACCOUNT_USAGE latency.