Created
July 28, 2019 23:25
-
-
Save amitzilblog/c7571bfc7b7638ef0769591f40d98714 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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