虽然IM使用使用dbms_system不精通的基础上,可用于dbms_system
包info,我想在会话级使用add_parameter_value
,并结束了以下错误:
SQL> set serveroutput on
DECLARE
sid_value VARCHAR2(10);
BEGIN
dbms_system.get_env('ORACLE_SID', sid_value);
dbms_output.put_line(sid_value);
dbms_system.add_parameter_value('cursor_sharing', 'EXACT', 'MEMORY', sid_value, 4);
END;
/
show errorsSQL> 2 3 4 5 6 7 8 mydb
DECLARE
*
ERROR at line 1:
ORA-20004: cursor_sharing is not a list parameter
SQL>
所以,尝试下面的触发该方法仅为用户SCOTT
设置cursor_sharing
至force
,您可以根据自己的要求进行更改。
SQL> create or replace trigger csf
after logon
on database
begin
if user='SCOTT' then
execute immediate 'alter session set cursor_sharing=force';
else
execute immediate 'alter session set cursor_sharing=exact';
end if;
end;
/2 3 4 5 6 7 8 9 10 11
Trigger created.
SQL>
SQL>
SQL> conn scott/tiger
Connected.
SQL> show parameter cursor_sharing
NAME TYPE VALUE
--------------------- --------- ---------------
cursor_sharing string FORCE
SQL>
SQL> conn system/manager
Connected.
SQL> show parameter cursor_sharing
NAME TYPE VALUE
--------------------- --------- ---------------
cursor_sharing string EXACT
SQL>
希望这可以帮助您避免将值设置回原始值。