Script to generate oracle add service commands

Tagged: ,

  • This topic is empty.
Viewing 0 reply threads
  • 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

Viewing 0 reply threads
  • You must be logged in to reply to this topic.