Translate

Affichage des articles dont le libellé est Index. Afficher tous les articles
Affichage des articles dont le libellé est Index. Afficher tous les articles

vendredi 26 février 2016

Script IdcAnalyze par tranche


Étant donné le nombre de documents que je dois analyser je me suis créé un petit script qui pourrait m'aider à collecter l'information nécessaire sur l'état de mon index UCM
Le script va déplacer le fichier résultant vers un répertoire FIX afin de pouvoir conserver le résultat partiel contenu dans le fichier "IdcCommand.txt"

Serveur : Linux 64 bits
Exécution : nohup sh ./EVTA.sh &

Fichier: EVTA.sh
#!/usr/bin/ksh
#
#
################################################
cd /appl/oracle/product/Middleware/user_projects/domains/gedXXX/ucm/cs/bin/
################################################
###### Chaque 100000 documents
v_maxloop=100000   
###### Min DBId
v_minval=390031       
###### Max DBId
v_maxval=15095575   
###### Compteur
v_count=0           
###### Min Range
v_MinRangID=0       
###### Max Range
v_MaxRangID=0       
###### Nombre de loops
v_nmbloop=0           
###### Date_heure
v_date=""           
################################################
if [ -f ./FIX/Log_execution.log ]; then
  mv ./FIX/Log_execution.log ./FIX/old_execution.log
fi
if [ -f ./logs/IdcAnalyze.log ]; then
  rm ./logs/IdcAnalyze.log
fi
################################################
for ((i=$v_minval;i<=$v_maxval;i=i+$v_maxloop));
do
 #########################################
 ## A chaque boucle
 #########################################
 if [ "$v_count" -eq "$v_maxloop" ]; then
    echo "Break_A "$i  #>> ./FIX/Log_execution.log
    v_nmbloop=`expr $v_nmbloop + 1`
    v_MaxRangID=$((${v_count}*$v_nmbloop))
    v_MaxRangID=`expr $v_MaxRangID + $v_minval`
    #########################################
    ## Juste le premiere boucle
    #########################################
    if [ "$v_nmbloop" -eq "1" ]; then
      v_MinRangID=$v_minval
    fi
    v_date=`date +%Y%m%d_%k%M`
    echo "Debut : "$v_date   >> ./FIX/Log_execution.log
    echo "./IdcAnalyze -index -range $v_MinRangID:$v_MaxRangID –report" >> ./FIX/Log_execution.log
    ./IdcAnalyze -index -range $v_MinRangID:$v_MaxRangID –report
    egrep "Finished checking|Errors Found|Errors Fixed" ./logs/IdcAnalyze.log >> ./FIX/Log_execution.log
    if [ -f ./logs/IdcCommand.txt ]; then
      mv ./logs/IdcCommand.txt ./FIX/IdcCommand.txt_${v_MinRangID}_${v_MaxRangID}
    fi  
    v_date=`date +%Y%m%d_%k%M`
    echo "Fin   : "$v_date >> ./FIX/Log_execution.log
    echo "------------------------------------------------------------------" >> ./FIX/Log_execution.log
    v_count=0
 fi   
 #########################################
 ## Dernier boucle
 #########################################
 v_calcullastlopp=`expr $v_maxval - $v_minval`
 v_calcullastlopp=$((${v_calcullastlopp}/$v_maxloop))
 if [ "$v_nmbloop" -eq "$v_calcullastlopp" ]; then
    echo "Break_B "$i  #>> ./FIX/Log_execution.log
    v_MaxRangID=$v_maxval
    v_date=`date +%Y%m%d_%k%M`
    echo "Debut : "$v_date  >> ./FIX/Log_execution.log
    echo "./IdcAnalyze -index -range $v_MinRangID:$v_MaxRangID –report" >> ./FIX/Log_execution.log
    ./IdcAnalyze -index -range $v_MinRangID:$v_MaxRangID –report
    egrep "Finished checking|Errors Found|Errors Fixed" ./logs/IdcAnalyze.log >> ./FIX/Log_execution.log
    if [ -f ./logs/IdcCommand.txt ]; then
      mv ./logs/IdcCommand.txt ./FIX/IdcCommand.txt_${v_MinRangID}_${v_MaxRangID}
    fi  
    v_date=`date +%Y%m%d_%k%M`
    echo "Fin   : "$v_date  >> ./FIX/Log_execution.log
    echo "------------------------------------------------------------------" >> ./FIX/Log_execution.log
 fi
 v_MinRangID=`expr $v_MaxRangID + 1`
 v_count=`expr $v_count + $v_maxloop`
done



Un exemple partiel du résultat :







J'espère que cela vous sera utile.

jeudi 25 février 2016

Oracle WebCenter - UCM - IdcAnalyzer - Too many errors encountered XXXX. Maximum errors allowed is set to XXXX

Bonjour

     Si jamais vous rencontrez ce message d'erreur au moment de lancer le IdcAnalyzer pour valider la structure de vos indexes...


"IdcAnalyzer - Too many errors encountered 5001. Maximum errors allowed is set to 5000."


Exemple : 

./IdcAnalyze -index -range 390000:400000 -report

...
Revision entry for dID = 394750 is not found in the search index.
Revision entry for dID = 395030 is not found in the search index.
Revision entry for dID = 394749 is not found in the search index.
Revision entry for dID = 394748 is not found in the search index.
Revision entry for dID = 394747 is not found in the search index.
Revision entry for dID = 395425 is not found in the search index.
Finished checking 5,001 entries.
Errors Found: 5001
Errors Fixed: 0
Too many errors encountered 5001. Maximum errors allowed is set to 5000.
Please address these errors and restart the test. There are 4969 out of 9970 items remaining to be checked.


Pour modifier cette limitation il faut modifier le fichier "intradoc.cfg" avec la valeur souhaitée. Vous n'avez pas besoin de rien repartir pour que la modification soit prise en considération.


Exemple : 

MaxErrors=6000

Pour tester, on relance la commande : 

./IdcAnalyze -index -range 390000:400000 -report

...
Revision entry for dID = 394750 is not found in the search index.
Revision entry for dID = 395030 is not found in the search index.
Revision entry for dID = 394749 is not found in the search index.
Revision entry for dID = 394748 is not found in the search index.
Revision entry for dID = 394747 is not found in the search index.
Revision entry for dID = 395425 is not found in the search index.
Finished checking 6,001 entries.
Errors Found: 6001
Errors Fixed: 0
Too many errors encountered 6001. Maximum errors allowed is set to 6000.
Please address these errors and restart the test. There are 3969 out
of 9970 items remaining to be checked.


Et voilà, la limitation a changé de 5000 à 6000 erreurs.

Comme dans mon cas ma bases de données a plus de 15 millions de documents et je veux m'éviter de problèmes de "out of memory" je vais le configurer à 100000 juste pour tester.

Comme à chaque exécution un fichier qui contiendra la résultant sera créé dans le répertoire "logs", donc il faut le déplacer avant de chaque exécution pour ne pas le perdre.


Exemple : 

mv ./logs/IdcCommand.txt ./FIX/IdcCommand.txt_400000_600000


[ucmxxx@server FIX]$ ll
-rw-rw-r-- 1 ucmxxx prod  1196400 Feb 25 15:58 IdcCommand.txt_390031_400000
-rw-rw-r-- 1 ucmxxx prod 12000120 Feb 25 16:10 IdcCommand.txt_400000_600000




lundi 6 avril 2015

FK sans Indexes


Des fois lorsque vous faites des vérifications il est important de vérifier si les FK ont une indexe de renforcement créé afin d'éviter des problèmes de performance, voici un script qui peut vous être utile.

Bien sûr, après cette première vérification il faudrait valider si les colonnes ne font pas partie d'un autre index ou s'il y a d'autres raisons qui pourraient "justifier" un manque d'indexe.

Voici le script :

SELECT QRY.OWNER, QRY.TABLE_NAME, QRY.CONSTRAINT_NAME, QRY.INDEX_NAME, QRY.CONSCOLUMNS, QRY.INDCOLUMNS
  FROM (
    SELECT LIST_CONST.OWNER, LIST_CONST.TABLE_NAME, LIST_CONST.CONSTRAINT_NAME, LIST_IND.INDEX_NAME,
           LIST_CONST.CONSCOLUMNS, LIST_IND.INDCOLUMNS 
     FROM (SELECT BB.OWNER, BB.TABLE_NAME, BB.CONSTRAINT_NAME, 
                  LTRIM(MAX(SYS_CONNECT_BY_PATH(BB.COLUMN_NAME,',')) KEEP (DENSE_RANK LAST ORDER BY curr),',') AS CONSCOLUMNS 
            FROM (SELECT B.OWNER, B.TABLE_NAME, B.CONSTRAINT_NAME, C.COLUMN_NAME, C.POSITION, 
                         ROW_NUMBER() OVER (PARTITION BY B.CONSTRAINT_NAME ORDER BY C.POSITION)   AS CURR, 
                         ROW_NUMBER() OVER (PARTITION BY B.CONSTRAINT_NAME ORDER BY C.POSITION)-1 AS PREV 
                    FROM DBA_CONSTRAINTS B, DBA_CONS_COLUMNS C 
                   WHERE B.OWNER           = C.OWNER            AND 
                         B.CONSTRAINT_NAME = C.CONSTRAINT_NAME  AND 
                         B.CONSTRAINT_TYPE = 'R' 
                 ) BB 
            GROUP BY BB.OWNER, BB.TABLE_NAME, BB.CONSTRAINT_NAME 
            CONNECT BY PREV = PRIOR CURR AND BB.CONSTRAINT_NAME = PRIOR BB.CONSTRAINT_NAME 
            START WITH CURR = 1
           ) LIST_CONST, 
          (SELECT AA.TABLE_OWNER, AA.TABLE_NAME, AA.INDEX_NAME, 
                  LTRIM(MAX(SYS_CONNECT_BY_PATH(AA.COLUMN_NAME,',')) KEEP (DENSE_RANK LAST ORDER BY curr),',') AS INDCOLUMNS 
            FROM (SELECT A.TABLE_OWNER, A.TABLE_NAME, A.INDEX_NAME, A.COLUMN_NAME, A.COLUMN_POSITION, 
                         ROW_NUMBER() OVER (PARTITION BY A.INDEX_NAME ORDER BY A.COLUMN_POSITION)   AS CURR,
                         ROW_NUMBER() OVER (PARTITION BY A.INDEX_NAME ORDER BY A.COLUMN_POSITION)-1 AS PREV
                    FROM DBA_IND_COLUMNS A, DBA_INDEXES AA 
                   WHERE A.INDEX_OWNER = AA.OWNER        AND 
                         A.INDEX_NAME  = AA.INDEX_NAME 
                 ) AA 
            GROUP BY AA.TABLE_OWNER, AA.TABLE_NAME, AA.INDEX_NAME 
            CONNECT BY PREV = PRIOR CURR AND AA.INDEX_NAME = PRIOR AA.INDEX_NAME 
            START WITH CURR = 1 
           ) LIST_IND 
     WHERE LIST_IND.TABLE_OWNER (+)  = LIST_CONST.OWNER         AND 
           LIST_IND.TABLE_NAME  (+)  = LIST_CONST.TABLE_NAME    AND 
           LIST_IND.INDCOLUMNS  (+)  LIKE LIST_CONST.CONSCOLUMNS || '%' 
      ) QRY 
WHERE QRY.INDEX_NAME IS NULL 
ORDER BY QRY.OWNER, QRY.TABLE_NAME ;