Script to generate oracle add service commands

Home Forums DBA – Wiki Script to generate oracle add service commands

Tagged: ,

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

  • Author
    Posts
  • #1967

    Amit Bansal
    Keymaster

    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

You must be logged in to reply to this topic.