I think you need to make sure it is available in your current resource plan
For example:
SQL> show parameter resource_manager_plan
NAME TYPE VALUE
------------------------------------ ----------- ---------------------
resource_manager_plan string DEFAULT_PLAN
Lets see what groups are in that plan
SQL> select group_or_subplan from DBA_RSRC_PLAN_DIRECTIVES
2 where plan = 'DEFAULT_PLAN'
3 /
GROUP_OR_SUBPLAN
----------------------------------------------------------
OTHER_GROUPS
SYS_GROUP
ORA$AUTOTASK
Now my current session has:
SQL> select RESOURCE_CONSUMER_GROUP
2 from v$session
3 where sid = 1102;
RESOURCE_CONSUMER_GROUP
--------------------------------
OTHER_GROUPS
If I try switch into a fictional group, I get an error as I would expect:
SQL> exec DBMS_RESOURCE_MANAGER.SWITCH_CONSUMER_GROUP_FOR_SESS(session_id => 1102, session_serial => 39069, consumer_group => 'BLAH') ;
BEGIN DBMS_RESOURCE_MANAGER.SWITCH_CONSUMER_GROUP_FOR_SESS(session_id => 1102, session_serial => 39069, consumer_group => 'BLAH') ; END;
*
ERROR at line 1:
ORA-29368: consumer group BLAH does not exist
ORA-06512: at "SYS.DBMS_RMIN_SYS", line 4529
ORA-06512: at "SYS.DBMS_RMIN_SYS", line 4552
ORA-06512: at "SYS.DBMS_RESOURCE_MANAGER", line 763
ORA-06512: at line 1
But lets see what consumers are floating around (not necessarily attached to DEFAULT_PLAN)
SQL> select CONSUMER_GROUP from
2 DBA_RSRC_CONSUMER_GROUPS;
CONSUMER_GROUP
---------------------------------
BATCH_GROUP
ORA$AUTOTASK
INTERACTIVE_GROUP
OTHER_GROUPS
DEFAULT_CONSUMER_GROUP
SYS_GROUP
LOW_GROUP
ETL_GROUP
DSS_GROUP
DSS_CRITICAL_GROUP
ORA$APPQOS_0
ORA$APPQOS_1
ORA$APPQOS_2
ORA$APPQOS_3
ORA$APPQOS_4
ORA$APPQOS_5
ORA$APPQOS_6
ORA$APPQOS_7
If I switch into one of those...
SQL> exec DBMS_RESOURCE_MANAGER.SWITCH_CONSUMER_GROUP_FOR_SESS(session_id => 1102, session_serial => 39069, consumer_group => 'LOW_GROUP') ;
PL/SQL procedure successfully completed.
I do NOT get an error, but LOW_GROUP isn't part of DEFAULT_PLAN ... so what happened?
SQL> select RESOURCE_CONSUMER_GROUP
2 from v$session
3 where sid = 1102;
RESOURCE_CONSUMER_GROUP
--------------------------------
OTHER_GROUPS
I went back to my default. If I nominate a group that IS in the plan
SQL> exec DBMS_RESOURCE_MANAGER.SWITCH_CONSUMER_GROUP_FOR_SESS(session_id => 1102, session_serial => 39069, consumer_group => 'SYS_GROUP') ;
PL/SQL procedure successfully completed.
SQL> select RESOURCE_CONSUMER_GROUP
2 from v$session
3 where sid = 1102;
RESOURCE_CONSUMER_GROUP
--------------------------------
SYS_GROUP
So I suspect the plan you are using does not have a cancel_sql entry