Minn Fong
06/15/2026, 4:08 PMRocky
06/15/2026, 4:08 PMroot user, provided the user running the job has the necessary privileges. Since you have already created the repository (which does require ADMIN privileges), you can use a less-privileged user for the recurring backup jobs.
The required privileges for the BACKUP command depend on your StarRocks version:
StarRocks v3.0 and later
You can create a dedicated backup user and grant it the following privileges:
1. REPOSITORY privilege on the SYSTEM level.
2. EXPORT privilege on the specific tables or databases you are backing up.
Example for a specific database:
sql
-- 1. Create a role for backup
CREATE ROLE backup_role;
-- 2. Grant system-level repository access
GRANT REPOSITORY ON SYSTEM TO ROLE backup_role;
-- 3. Grant export access to the target database
GRANT EXPORT ON ALL TABLES IN DATABASE <your_db_name> TO ROLE backup_role;
-- 4. Assign role to your cron user
GRANT backup_role TO USER 'your_cron_user'@'%';
StarRocks versions earlier than v3.0
In older versions, the user must have the admin_priv privilege. While the root user has this by default, you can grant it to any other user:
sql
GRANT ADMIN ON SYSTEM TO USER 'your_cron_user'@'%';
Important Notes
* Restore Privileges: If your cron job also handles RESTORE operations, that user will need additional privileges such as CREATE DATABASE, CREATE TABLE, and INSERT to recreate the data in the target environment.
* Job Limits: Only one BACKUP or RESTORE job can run at a time per database. If you have multiple databases, you must schedule them or wait for the previous one to finish.
References
• sql-reference/sql-statements/backup_restore/CREATE_REPOSITORY.md
• administration/cluster_snapshot.md
• sql-reference/sql-statements/backup_restore/BACKUP.md
• administration/user_privs/authorization/User_privilege.md
• administration/user_privs/authorization/privilege_item.md
• administration/management/Backup_and_restore.md