Home » » Prepare Query Predicate From Failed Commands In Import Logfile

Prepare Query Predicate From Failed Commands In Import Logfile

Written By Srikrishna Murthy Annam on Thursday, May 12, 2011 | 3:34 PM

This small script will be useful to prepare the list of objects that failed to create in a import process.

Usage :   prepare_list.sh   <import logfile>

Script:

[sourcecode language="bash"]
echo "Entered File is $1"
echo ""
grep -i 'CREATE INDEX' $1 | awk -F " " '{print $3}' | awk -F "." '{print $2}' | sed 's/.\(.*\)/\1/' | sed 's/\(.*\)./\1/' | sed "s/^/\'/; s/$/\'/;" > askm
echo "Failed Objects Are:"
echo "==========================="
cat askm
#j="("
for i in `cat askm`
do
j=${j},$i
done
j=`echo $j | sed 's/.\(.*\)/\1/'`
j="("${j}")"
echo ""
echo "==================================================="
echo "Use The Following Predicate In Your Where Condition"
echo "==================================================="
echo $j
unset j
[/sourcecode]

NOTE:  In the above script,i extracted failed index list, but you can change it to get your own object list.

Sample Output:

[sourcecode language="bash" highlight="1"]
[oracle@b600e6tr askm]$ ./prepare_list.sh testdb_implog.log
Entered File is testdb_implog.log

Failed Objects Are:
===========================
'PV_ENTY_ATTR_TEXTS_U2'
'JTF_NOTES_TL_C1'
'HZ_CLASS_CODE_DENORM_T1'
'AMV_C_CHANNELS_DESC_CTX'
'AMV_C_CHANNELS_NAME_CTX'
'ENI_DEN_HRCHY_PAR_IM1'
'IBC_ATTRIBUTE_BUNDLES_CTX'
'JTF_TASKS_TL_IM'
'JTF_AMV_ITEMS_TEXT_CTX'
'JTF_AMV_ITEMS_URL_CTX'
'JTF_AMV_ITEMS_NAME_CTX'
'JTF_AMV_ITEMS_DESC_CTX'
'OKC_TERMS_TEMPLATES_CTX'
'OKC_ARTICLES_CTX'
'ICX_QUES_CTX'
'IRC_POSTING_CON_TL_CTX'
'PER_EMPDIR_PEOPLE_N1'
'IRC_DOCUMENTS_CTX'
'MVCN_PO_VND_NAME_CTX'
'MVCN_PO_VND_NAME_ALT_CTX'
'MVCN_PO_VND_VAT_CTX'
'MVCN_PO_VND_TIN_CTX'
'MVCN_PO_VST_CODE_CTX'
'MVCN_PO_VST_VAT_CTX'
'IDX_UP_SEARCH_DESCR'
'IDX_UP_SEARCH_COMM'
'IDX_UP_SEARCH_SUPP'

===================================================
Use The Following Predicate In Your Where Condition
===================================================
('PV_ENTY_ATTR_TEXTS_U2','JTF_NOTES_TL_C1','HZ_CLASS_CODE_DENORM_T1','AMV_C_CHANNELS_DESC_CTX','AMV_C_CHANNELS_NAME_CTX',
'ENI_DEN_HRCHY_PAR_IM1','IBC_ATTRIBUTE_BUNDLES_CTX','JTF_TASKS_TL_IM','JTF_AMV_ITEMS_TEXT_CTX','JTF_AMV_ITEMS_URL_CTX',
'JTF_AMV_ITEMS_NAME_CTX','JTF_AMV_ITEMS_DESC_CTX','OKC_TERMS_TEMPLATES_CTX','OKC_ARTICLES_CTX','ICX_QUES_CTX',
'IRC_POSTING_CON_TL_CTX','PER_EMPDIR_PEOPLE_N1','IRC_DOCUMENTS_CTX','MVCN_PO_VND_NAME_CTX','MVCN_PO_VND_NAME_ALT_CTX',
'MVCN_PO_VND_VAT_CTX','MVCN_PO_VND_TIN_CTX','MVCN_PO_VST_CODE_CTX','MVCN_PO_VST_VAT_CTX','IDX_UP_SEARCH_DESCR',
'IDX_UP_SEARCH_COMM','IDX_UP_SEARCH_SUPP')
[oracle@b600e6tr askm]$
[/sourcecode]

Hope It Helps
SRI
Share this article :

Related Articles By Category



Post a Comment

Thank you for visiting our site and leaving your valuable comment.

 
Support :
Copyright © 2013. askMLabs - All Rights Reserved
Proudly powered by Blogger