DBA Data[Home] [Help]

PROCEDURE: SYS.DBMS_FEATURE_DMU

Source


1 PROCEDURE DBMS_FEATURE_DMU
2      ( feature_boolean  OUT  NUMBER,
3        aux_count        OUT  NUMBER,
4        feature_info     OUT  CLOB)
5 AS
6   v_usage_value   varchar2(4000);
7   v_last_used     date;
8   v_last_sampled  date;
9 BEGIN
10   --
11   -- start with 'DMU usage not detected'
12   -- we do not utilize aux_count.
13   --
14   feature_boolean := 0;
15   feature_info := to_clob('DMU usage not detected');
16   aux_count := 0;
17   --
18   -- test if DMU was used since last sampled date
19   --
20   begin
21     --
22     -- get the date DMU was used last time
23     --
24     select value$ into v_usage_value
25       from sys.props$
26      where name = 'NLS_DMU_USAGE';
27     v_last_used := to_date(substr(v_usage_value,1,instr(v_usage_value,',')-1),
28                            'YYYYMMDDHH24MISS');
29     --
30     -- get the date sampled last time
31     --
32     select nvl(max(last_sample_date), sysdate-7)
33       into v_last_sampled
34       from wri$_dbu_usage_sample;
35     --
36     -- DMU usage is detected
37     --
38     if v_last_sampled < v_last_used then
39       feature_boolean := 1;
40       feature_info := to_clob(v_usage_value);
41     end if;
42   exception
43     --
44     -- DMU usage is not detected if any exception is thrown including:
45     --  * NLS_DMU_USAGE not found in sys.props$
46     --  * the value is not in the format of 'YYYYMMDDHH24MISS'
47     --
48     when others then
49       null;
50   end;
51 END DBMS_FEATURE_DMU;