Wednesday, March 3, 2010

Rotate oracle Database listener log file.

Problem
-------

On 64 bit box, listener log file stops logging when size reaches 4.1 gb.

There could be some internal limitation from oracle side because of which it is not able to update log file.

Solution
--------
We can rotate log file, below are the steps.


1. take a back up of listener log file, check available disk space before going this. If you want to preserve time stamp use cp -p

cp -p log file name log file name_bkp

2. truncate listener log file

cat "" > log file name

3.
lsnrctl
set current_listener
set log_status off
set log_status on


4. check if listener log file is getting updated.


Additional command that could help.

fuser : will give pid of the listener, check is listener is running with same pid.


You can write small script to rotate listener log file and schedule cronjob to be executed every one month or so. Instead of using "log file_bkp" use "log_file_`date`"

Regards

Monday, March 1, 2010

sql to check archive's generated per hour for last 7 days

//sql to check archive's generated per hour for last 7 days

set linesize 140

SELECT to_date(first_time) DAY,
to_char(sum(decode(to_char(first_time,'HH24'),'00',1,0)),'999') "00",
to_char(sum(decode(to_char(first_time,'HH24'),'01',1,0)),'999') "01",
to_char(sum(decode(to_char(first_time,'HH24'),'02',1,0)),'999') "02",
to_char(sum(decode(to_char(first_time,'HH24'),'03',1,0)),'999') "03",
to_char(sum(decode(to_char(first_time,'HH24'),'04',1,0)),'999') "04",
to_char(sum(decode(to_char(first_time,'HH24'),'05',1,0)),'999') "05",
to_char(sum(decode(to_char(first_time,'HH24'),'06',1,0)),'999') "06",
to_char(sum(decode(to_char(first_time,'HH24'),'07',1,0)),'999') "07",
to_char(sum(decode(to_char(first_time,'HH24'),'08',1,0)),'999') "08",
to_char(sum(decode(to_char(first_time,'HH24'),'09',1,0)),'999') "09",
to_char(sum(decode(to_char(first_time,'HH24'),'10',1,0)),'999') "10",
to_char(sum(decode(to_char(first_time,'HH24'),'11',1,0)),'999') "11",
to_char(sum(decode(to_char(first_time,'HH24'),'12',1,0)),'999') "12",
to_char(sum(decode(to_char(first_time,'HH24'),'13',1,0)),'999') "13",
to_char(sum(decode(to_char(first_time,'HH24'),'14',1,0)),'999') "14",
to_char(sum(decode(to_char(first_time,'HH24'),'15',1,0)),'999') "15",
to_char(sum(decode(to_char(first_time,'HH24'),'16',1,0)),'999') "16",
to_char(sum(decode(to_char(first_time,'HH24'),'17',1,0)),'999') "17",
to_char(sum(decode(to_char(first_time,'HH24'),'18',1,0)),'999') "18",
to_char(sum(decode(to_char(first_time,'HH24'),'19',1,0)),'999') "19",
to_char(sum(decode(to_char(first_time,'HH24'),'20',1,0)),'999') "20",
to_char(sum(decode(to_char(first_time,'HH24'),'21',1,0)),'999') "21",
to_char(sum(decode(to_char(first_time,'HH24'),'22',1,0)),'999') "22",
to_char(sum(decode(to_char(first_time,'HH24'),'23',1,0)),'999') "23"
from
v$log_history
where to_date(first_time) > sysdate -20
GROUP by
to_char(first_time,'YYYY-MON-DD'), to_date(first_time)
order by to_date(first_time);

Oracle E-business suite logs clean up

 Oracle E-business suite logs clean up #!/bin/bash cd $EBS_DOMAIN_HOME find $EBS_DOMAIN_HOME -type f -path "*/logs/*.log?*" -mtime...