forked from geekcomputers/Oracle-SQL
-
Notifications
You must be signed in to change notification settings - Fork 1
/
tp_stats.sql
31 lines (27 loc) · 848 Bytes
/
tp_stats.sql
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
REM Script Name : tp_stats.sql
REM Author : Craig Richards
REM Created : 17 January 2013
REM Last Modified :
REM Version : 1.0
REM
REM Modifications :
REM
REM Description :
REM Procedure to gather the statistics, this will be called via the DBMS_SCHEDULER
CREATE OR REPLACE PROCEDURE GATHER_RIMS_STALE_STATISTICS
AS
BEGIN
dbms_stats.gather_schema_stats(ownname=>'RIMS',estimate_percent=>NULL,options=>'GATHER STALE',cascade=>TRUE);
END;
/
REM DBMS_SCHEDULER job to call the procedure
BEGIN
dbms_scheduler.create_job
(job_name=>'GATHER_STALE_RIMS_STATISTICS',
repeat_interval => 'FREQ=DAILY; BYDAY=MON,TUE,WED,THU,FRI; BYHOUR=4; BYMINUTE=00',
job_type=>'stored_procedure',
job_action=>'sys.GATHER_RIMS_STALE_STATISTICS',
enabled=>TRUE,
comments=>'GATHER_RIMS_STALE_STATISTICS');
END;
/