| Oracle FAQ | Your Portal to the Oracle Knowledge Grid | |
Home -> Community -> Usenet -> c.d.o.server -> Re: Log switching at a specific time interval
Here is a suggestion from one of the previous posts.
HTH,
Vladimir
I completely agree. Here's proof:
REM just switch during load periods
REM mon-fri between 8 am and 6 pm
CREATE OR REPLACE PROCEDURE switch_logfile IS
exec_me varchar2(255);
this_day varchar2(9);
this_hour varchar2(2);
BEGIN
select to_char(sysdate,'DAY') into this_day from dual;
select to_char(sysdate,'HH24') into this_hour from dual;
if substr(this_day,1,1) != 'S' and this_hour between 8 and 18
then
exec_me := 'ALTER SYSTEM SWITCH LOGFILE';
EXECUTE IMMEDIATE exec_me;
end if;
REM this code queues a job to switch the logfile once an hour
REM the schema under which this runs must have been granted the sys_priv
"ALTER SYSTEM"
alter session set nls_date_format='DD-MON-RRRR';
variable jobno number;
exec
dbms_job.submit(:jobno,'switch_logfile;',sysdate+(1/24),'sysdate+(1/24)');
![]() |
![]() |