#!/usr/bin/ksh # set -xv # author : B. Polarski # program : smenu_logminer.ksh # date : 22 Decembre 2005 HOST=`hostname` HOST=`echo $HOST | awk '{ printf ("%-+15.15s",$1) }'` LEN=70 ROWNUM=40 # ------------------------------------------------------------------------------------- function help { cat < lgm -s -i lgm -l -a -desc/asc -r -nc -r : Show at least rows -desc : Order output descending -asc : Order output ascending -l : List the contents of the selected archives, display with counts -tbs : Rellocate logmine to -s : Given an SCN and retrieve the SQL statement -start : Start logminer and add all the configured redo log -nc : Don't list commits in list -ist : Include rows whose operation is start -sys : Include rows generated by sys rows -i : force instance number List all rows for a archive log : lgm -l -a List all rows for an object in an archive log : lgm -o -a -u EOF exit } # ------------------------------------------------------------------------------------- function do_execute { LLEN=`expr 55 + $LEN` $SETXV sqlplus -s "$CONNECT_STRING" <= first_change# and $SCN < next_change# ; EOF` echo "ret=$ret" # for cygwin we need to get rid of M$ garbage, hence the tr. name=`echo $ret | tr -d '\n'| awk '{print $1}'` echo "name=$name" SQL="execute dbms_logmnr.Add_logfile(options => dbms_logmnr.new, logfilename=>'$name'); execute DBMS_LOGMNR.START_LOGMNR(options => dbms_logmnr.dict_from_online_catalog ); set pagesize 100 SELECT sql_redo FROM V\$LOGMNR_CONTENTS where scn = $SCN ; " echo "$SQL" #+ DBMS_LOGMNR.CONTINUOUS_MINE); # ................................................. # stop logminer # ................................................. elif [ "$CHOICE" = "STOP" ];then SQL="execute DBMS_LOGMNR.END_LOGMNR( ) ;" fi if [ "$EXECUTE" = "YES" ];then do_execute else echo "$SQL" fi # -- create directory LGM_TMP_DIR as '$SBIN/tmp' ; #-- stm:='dbms_logmnr.start_logmnr(dictfilename=>''$SBIN/tmp/dico.ora'',starttime => '||ft||' , endtime =>'|| nt||')' ;