Purpose
The ALTER SYSTEM TRIGGER/SUSPEND/RESUME/CANCEL TTL statement is used to manually trigger, suspend, resume, or cancel a tenant-level Time-To-Live (TTL) task.
Privilege requirements
To execute the ALTER SYSTEM TRIGGER/SUSPEND/RESUME/CANCEL TTL statement, the current user must have the ALTER SYSTEM privilege. For more information about OceanBase Database privileges, see Privilege classification in MySQL mode and Privilege classification in Oracle mode.
Syntax
ALTER SYSTEM {TRIGGER | SUSPEND | RESUME | CANCEL} TTL [TENANT [=] all | all_user | tenant_list];
tenant_list:
tenant_name[,tenant_name ...]
Parameters
| Parameter | Description |
|---|---|
| TENANT | Specifies the user tenant to trigger, suspend, resume, or cancel a TTL task. When executed under the sys tenant, you must specify a user tenant. You can specify multiple tenants at a time. Separate the tenant names with commas (,).
NoticeOnly the sys tenant needs to specify the |
Examples
The sys tenant triggers a TTL task for the user tenant
tenant1.Enable the TTL feature for the tenant
tenant1.obclient(root@sys)[(none)]> ALTER SYSTEM SET enable_ttl = True TENANT = tenant1;Manually trigger a TTL task for the user tenant
tenant1.obclient(root@sys)[(none)]> ALTER SYSTEM TRIGGER TTL TENANT = tenant1;
A user tenant triggers a TTL task for itself.
Enable the TTL feature.
obclient(root@mysql001)[(none)]> ALTER SYSTEM SET enable_ttl = True;Manually trigger a TTL task.
obclient(root@mysql001)[(none)]> ALTER SYSTEM TRIGGER TTL;
References
- For detailed operations and information about TTL tasks in SQL scenarios, see Use the TTL feature.
