Quantcast
Channel: Doyensys Allappsdba Blog..
Viewing all articles
Browse latest Browse all 1640

Identify the datafiles in number of hosts in hostfile

$
0
0
for host in `cat ~oracle/.rhosts|\
cut -d"." -f1|awk '{print $1}'|sort -u`
do
    echo ""
    echo "************************"
    echo "$host"
    echo "************************"
    # loop from database to database
    for db in `cat /etc/oratab|egrep ':N|:Y'|\
      grep -v \*|grep ${db}|cut -f1 -d':'"`
    do
        home=`rsh $host "cat /etc/oratab|egrep ':N|:Y'|\
          grep -v \*|grep ${db}|cut -f2 -d':'"`
        echo "************************"
        echo "database is $db"
        echo "************************"
        rsh $host "
        ORACLE_SID=${db}; export ORACLE_SID;
        ORACLE_HOME=${home}; export ORACLE_HOME;
        ${home}/bin/sqlplus -s /<<!
        set pages 9999;
        set heading off;
        select name from v"\\""$"datafile;
        exit
        !"
    done
done

Viewing all articles
Browse latest Browse all 1640

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>