Script to generate oracle add service commands

Tagged: ,

This topic contains 0 replies, has 0 voices, and was last updated by  Amit Bansal 6 years, 9 months ago.

  • Author
  • #1967

    Amit Bansal

    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   



    srvctl config service -d db_name >services.lst

    cat services.lst|while read ln


    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/’



    Thanks to Alok Kumar

You must be logged in to reply to this topic.