LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   archived logs (https://www.linuxquestions.org/questions/linux-newbie-8/archived-logs-720401/)

exboy 04-20-2009 08:11 AM

archived logs
 
Hi all,

I need help on executing archived log files in the database, instead of inserting each of the logs in the execute statement below one by one is there a way i can
include all the logs at once in one single statement in a linux shell script?

EXECUTE DBMS_LOGMNR.ADD_LOGFILE(LOGFILENAME => '/u02/arch/1_50662_581101112.arc'
,OPTIONS => DBMS_LOGMNR.NEW);
EXECUTE DBMS_LOGMNR.ADD_LOGFILE(LOGFILENAME => '/u02/arch/1_50706_581101112.arc'

I need to mine over a thousand logs for a report and including them one by one is not feasible.

What i want to achieve is automation of my archived logs to populate a table in my database called v$logmnr_contents.



Kindly help out.

Regards.

TB0ne 04-20-2009 08:16 AM

Quote:

Originally Posted by exboy (Post 3515010)
Hi all,

I need help on executing archived log files in the database, instead of inserting each of the logs in the execute statement below one by one is there a way i can
include all the logs at once in one single statement in a linux shell script?

EXECUTE DBMS_LOGMNR.ADD_LOGFILE(LOGFILENAME => '/u02/arch/1_50662_581101112.arc'
,OPTIONS => DBMS_LOGMNR.NEW);
EXECUTE DBMS_LOGMNR.ADD_LOGFILE(LOGFILENAME => '/u02/arch/1_50706_581101112.arc'

I need to mine over a thousand logs for a report and including them one by one is not feasible.

What i want to achieve is automation of my archived logs to populate a table in my database called v$logmnr_contents.

Kindly help out.

Regards.

Hard to help, when you don't give details.

You need to provide samples of the logs you're trying to work with, and say something about the database, and what you're doing now.

exboy 04-20-2009 08:29 AM

Quote:

Originally Posted by TB0ne (Post 3515013)
Hard to help, when you don't give details.

You need to provide samples of the logs you're trying to work with, and say something about the database, and what you're doing now.

thanks TB0ne, what i am trying to do is to use a linux bash script to automate the logminer utility:

1.which includes a statement to pick all the archived logs at once and then populate the v$logmnr_contents with it.

I am using a oracle 10g database and below is what i have done so far and i am doing now.

#!/bin/ksh
echo " Type the STARTTIME(DD-MM-YYYY HH24:MI:SS): "
read STARTTIME

echo "Type User ENDTIME(DD-MM-YYYY HH24:MI:SS): "
read ENDTIME

echo $STARTTIME

sqlplus "/as sysdba" << EOF
EXECUTE DBMS_LOGMNR.ADD_LOGFILE(LOGFILENAME => '/u02/arch/1_50662_581101112.arc',OPTIONS => DBMS_LOGMNR.NEW);
EXECUTE DBMS_LOGMNR.ADD_LOGFILE(LOGFILENAME => '/u02/arch/1_50706_581101112.arc');


EXECUTE DBMS_LOGMNR.START_LOGMNR();


set lines 100
set pages 10
col USERNAME format a10
col SQL_REDO format a10
col SQL_UNDO format a10

select username,sql_redo,sql_undo FROM v\$logmnr_contents;

EXIT
EOF


2. how do i pick over 1000 logs, since i can add them manually?

3. how do i loop the logs from v$archived_log to populate V$logmnr_content table?


Kindly help out.

exboy 04-20-2009 08:35 AM

Quote:

Originally Posted by TB0ne (Post 3515013)
Hard to help, when you don't give details.

You need to provide samples of the logs you're trying to work with, and say something about the database, and what you're doing now.

thanks TB0ne, what i am trying to do is to use a linux bash script to automate the logminer utility:

1.which includes a statement to pick all the archived logs at once and then populate the v$logmnr_contents with it.

I am using a oracle 10g database and below is what i have done so far and i am doing now.

#!/bin/ksh
echo " Type the STARTTIME(DD-MM-YYYY HH24:MI:SS): "
read STARTTIME

echo "Type User ENDTIME(DD-MM-YYYY HH24:MI:SS): "
read ENDTIME

echo $STARTTIME

sqlplus "/as sysdba" << EOF
EXECUTE DBMS_LOGMNR.ADD_LOGFILE(LOGFILENAME => '/u02/arch/1_50662_581101112.arc',OPTIONS => DBMS_LOGMNR.NEW);
EXECUTE DBMS_LOGMNR.ADD_LOGFILE(LOGFILENAME => '/u02/arch/1_50706_581101112.arc');


EXECUTE DBMS_LOGMNR.START_LOGMNR();


set lines 100
set pages 10
col USERNAME format a10
col SQL_REDO format a10
col SQL_UNDO format a10

select username,sql_redo,sql_undo FROM v\$logmnr_contents;

EXIT
EOF


2. how do i pick over 1000 logs, since i can add them manually?

3. how do i loop the logs from v$archived_log to populate V$logmnr_content table?


Kindly help out.


All times are GMT -5. The time now is 01:29 AM.