| #system_stat_history.sh #!/bin/sh #--------------------------------------------------------- # Collect system statistics for 2 weeks on the four nodes : # * every 1hour, # * during 20minutes # * To find the right values #--------------------------------------------------------- . ~ora102/.bash_profile rep=/home/ora102/majda export TNS_ADMIN=$rep log=/home/ora102/majda/system_stat_history.log >$log exec >> $log exec 2>> $log i=1 liste_sids="tloral1 tloral2 tloral3 tloral4" for sid in $liste_sids do sql="set serveroutput on\n set verify off\n declare \n statid varchar2(30);\n noeud number; begin\n select substr(instance_name,length(instance_name),1) into noeud from v\$instance ; select 'N'||noeud||'_'||to_char(sysdate,'YYYYMMDDHH24MISS') into statid from v\$instance; \n dbms_output.put_line(statid);\n dbms_stats.GATHER_SYSTEM_STATS('interval',20,'AUX_STATS\$_HIS'||noeud,statid,'SYS');\n end;\n /" ##sql="select count(1) from sys.AUX_STATS\$_HIS$i;" echo -e $sql | sqlplus -s majda/majda@$sid ((i=$i+1)) done #--------------------------------------------------------- # system_stat_history.sql : pour lister les stats collecté # ------- #col statid for a20 #col status for a12 #col dstop for a20 #col dstart for a20 # #select partie1.statid, dstart, dstop, status, # sreadtim,mreadtim,cpuspeed,mbrc,maxthr,slavethr #FROM #(SELECT statid, n1 AS sreadtim, n2 AS mreadtim, n3 AS cpuspeed, n11 AS mbrc, # c2 as dstart, c3 as dstop, c1 as status # from aux_stats$_his1 #where c4 = 'CPU_SERIO' #) partie1, #(SELECT statid,n1 AS maxthr, n2 AS slavethr #FROM aux_stats$_his1 #WHERE c4 = 'PARIO') partie2 #where #partie1.statid= partie2.statid #order by partie1.statid #; # #--------------------------------------------------------- |