我在 Oracle RDS 数据库实例上有一个管理用户,理论上它具有完全的管理权限。但是,我需要终止一个会话,并且运行
ALTER SYSTEM KILL SESSION '35, 26265';
给出以下内容:
Error starting at line : 9 in command -
ALTER SYSTEM KILL SESSION '35, 26265'
Error report -
ORA-01031: insufficient privileges
01031. 00000 - "insufficient privileges"
*Cause: An attempt was made to perform a database operation without
the necessary privileges.
*Action: Ask your database administrator or designated security
administrator to grant you the necessary privileges
因此,我尝试向我的用户授予
ALTER SYSTEM
,但我没有足够的权限来这样做:
Error starting at line : 9 in command -
grant alter system to ADMINISTRATORDB
Error report -
ORA-04088: error during execution of trigger 'RDSADMIN.RDS_GRANT_TRIGGER'
ORA-00604: error occurred at recursive SQL level 1
ORA-20997: "ALTER SYSTEM" grants not allowed
ORA-06512: at "RDSADMIN.RDSADMIN_TRIGGER_UTIL", line 207
ORA-06512: at line 1
ORA-06512: at line 2
04088. 00000 - "error during execution of trigger '%s.%s'"
*Cause: A runtime error occurred during execution of a trigger.
*Action: Check the triggers which were involved in the operation.
如果无法使用 ALTER SYSTEM 命令,如何终止会话?
根据 AWS RDS 文档,您可以使用特殊过程调用终止会话(并执行许多其他管理任务):
BEGIN
rdsadmin.rdsadmin_util.kill(
sid => 35,
serial => 26265,
method => 'IMMEDIATE');
END;
/