Suppose you have 10g database which you are trying to migrate to 11g. You wish to create a file to generate command for adding services. You can use below script to do same
[pre]
srvctl config service -d db_name >services.lst
cat services.lst|while read ln
do
echo $ln|sed ‘s/PREF//’|sed ‘s/AVAIL//’|awk -F : ‘{print “-s ” $1 “-r” $2 “-a” $3}’|sed ‘s/ /,/g’|sed ‘s/-r,/-r/’|sed ‘s/,-a/ -a/’|sed ‘s/-a,/ -a / ‘|sed ‘s/-s,/ -s / ‘|sed ‘s/,-r/ -r / ‘|sed ‘s/-a$/ /’|sed ‘s/^/srvctl add service -d db_name/’
done
[/pre]
Thanks to Alok Kumar
Recent Comments