Oracle Technologies Blog

By ASKM

Prepare Query Predicate From Failed Commands In Import Logfile

Posted by Srikrishna Murthy Annam on May 12, 2011

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:

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

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

Sample Output:

[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]$

Hope It Helps
SRI

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: