GoogleCloudPlatform / database-assessment

Database Migration Assessment
https://googlecloudplatform.github.io/database-assessment/
Apache License 2.0
62 stars 35 forks source link

ER: Validate if any *log contains "ORA-" before loading it #80

Closed ersantosnet closed 2 years ago

ersantosnet commented 2 years ago

If any OP log file contains the pattern "ORA-" the file should be skipped. Those files should be flagged to the use with a message that tells them that those files were skipped most likely because there are errors in them and they should be manually reviewed. Exception to this rule are "patchlevel.log" and "alertlog*.log".

Today we can only stop those files using:

grep "ORA-" *log|cut -d ":" -f1|uniq

ersantosnet commented 2 years ago

Also, validate number o commas per line

for i in ls -l *awrhistosstat*.log|awk '{print $9}'|uniq; do echo "Processing: "$i

linecounter=0

while read line; do

commascounter=echo -n "$line" | tr -cd , | wc -c

if [ $commascounter -gt 18 ]; then

echo "Filename: "$i", Line Number: "$linecounter", Comma Line Counter: "$commascounter

fi

linecounter=$((linecounter+1))

done < $i

done

ersantosnet commented 2 years ago

Maybe validate only first X rows

ersantosnet commented 2 years ago

Another possible validation is to check: If the files is empty