Skip to content

Instantly share code, notes, and snippets.

@amitzilblog
Created July 28, 2019 23:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save amitzilblog/c7571bfc7b7638ef0769591f40d98714 to your computer and use it in GitHub Desktop.
Save amitzilblog/c7571bfc7b7638ef0769591f40d98714 to your computer and use it in GitHub Desktop.
#!/bin/bash
t=30
if [ -n "$1" ]; then
t=$1
fi
first=$(sqlplus -s / as sysdba << EOF
set pages 0 lines 1000 echo off
select sum(sequence#),sum(block#) from v\$managed_standby where process='RFS';
exit
EOF
)
echo "sleeping for $t seconds"
sleep $t
second=$(sqlplus -s / as sysdba << EOF
set pages 0 lines 1000 echo off
select sum(sequence#),sum(block#) from v\$managed_standby where process='RFS';
exit
EOF
)
first_seq=$(echo ${first} | awk '{print $1}')
first_sum=$(echo ${first} | awk '{print $2}')
second_seq=$(echo ${second} | awk '{print $1}')
second_sum=$(echo ${second} | awk '{print $2}')
if [ "${first_seq}" != "${second_seq}" ]; then
echo "something has changed, try again"
else
diff=$((second_sum - first_sum))
echo "blocked copied in $t seconds is $diff"
diff_mb=$(bc <<< "scale=2; ${diff}*0.5/${t}/1024")
echo "${diff_mb} MB/s"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment