Home > bash, CentOS, RHEL, Slackware, Uncategorized > Linux bash: Oracle calculate the sum size of the expdmp files by the expdmp log

Linux bash: Oracle calculate the sum size of the expdmp files by the expdmp log

[oracle@xxxx:[Thu Feb 17 17:20:30]:[/opt/oracle/rman/xxxx_xxxx/export]$ cat datapump_FULL.20110214.elog  \
| awk '/exported/ {crap=$5;if ($6=="KB") {crap=$5*1024;$6="Bytes"}  else if ($6=="MB") {crap=$5*1024*1024;$6="Bytes"} else if ($6=="GB") {crap=$5*1024*1024*1024;$6="Bytes"} SUM+=crap;} END {printf("%07.2f GB \n",SUM/(1024*1024*1024))}'
0029.14 GB]

more verbose:

cat datapump_FULL.20110214.elog \
| awk '/exported/ {ded=$6;crap=$5;if ($6=="KB") {crap=$5*1024;ded="Bytes"}  else if ($6=="MB") {crap=$5*1024*1024;ded="Bytes"} else if ($6=="GB") {crap=$5*1024*1024*1024;ded="Bytes"} SUM+=crap;printf("%014.2f Bytes [%016.2f] %s\n",crap,SUM,$0)} END {printf("%07.2f GB \n",SUM/(1024*1024*1024))}'
Advertisements
  1. No comments yet.
  1. No trackbacks yet.

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: