cfg_pdmora

来自「proe5.0野火版下载(中文版免费下载)」· 代码 · 共 695 行 · 第 1/2 页

TXT
695
字号
    echo "setenv ORACLE_TBSP $oracle_tbsp" >> $orahome/.cshrc    source $orahome/.cshrc  endifendif#       end of defining tablespace files directory                 - echo ""set def="10"unset valid_tbsizewhile(! $?valid_tbsize)   echo "How big should the index and data tablespace files be initially (in Mb)"   echo -n "[$def] ?: "   set tbsize="$<"   if ("$tbsize" == "") set tbsize="$def"   if (`echo "$tbsize" | egrep -c '^[0-9]+$'` == 0 || $tbsize <= 0) then      echo "ERROR:  $tbsize - must be a number > 0 (in Mb)."      echo ""   else if ("$tbsize" < "10") then      unset valid_ans      while(! $?valid_ans)         echo -n "This is less than the default (10) are you sure (y/n) ?: "         set ans="$<"         if ("$ans" =~ [Yy]* || "$ans" =~ [Nn]*) set valid_ans         echo ""      end      if ("$ans" =~ [Yy]*) set valid_tbsize   else      set valid_tbsize   endifendecho ""echo "Creating the oracle user account ..."echo "" # local initsif ("$PRO_LOAD_DIR" == "__unset__") then   if (-d $scrdir/../../pdm/pdmtools/sql) then      set sqlscrdir="$scrdir/../../pdm/pdmtools/sql"   else      set sqlscrdir="$cwd"   endifelse   set sqlscrdir="$PRO_LOAD_DIR/pdm/pdmtools/sql"endifset ptcoradir="$orahome/PTC_PDM"set reqd_kb=`echo "2*$tbsize*1024 + 100" | bc`set oraprocess="ora_pmon_$orasid"set sql_start_cmd="startup pfile=$orainitfile"# Set ORACLE env. variablessetenv ORACLE_HOME "$orahome"setenv ORACLE_SID "$orasid"setenv ORACLE_TBSP "$oracle_tbsp"#Check if the installer has Oracle login privilege.set sqldba_cmd="$orahome/bin/sqldba"set get_login="/tmp/login_ok.$$"echo "$conline" > $get_login.sqlecho "exit" >> $get_login.sql$sqldba_cmd @$get_login.sql  >> $get_login.sqlif (`cat $get_login.sql | grep 'logon denied' | wc -l` != 0) then    echo ""    echo "ERROR: Logon denied, please make sure you have the automatic login privilege"    echo "       or the valid Oracle login format username/password."    echo ""    goto EXIT_ERRORendifrm -f $get_login.sql >& /dev/null# check write access to init filetouch $orainitfile >& /dev/nullif ($status != 0) then   echo ""   echo "ERROR:  $orainitfile - no write access."   echo "        As the owner of $orainitfile type:"   echo "        chmod g+rw $orainitfile"   echo "        then retry."   goto EXIT_ERRORendif# use sqldba/grep to identify the Oracle versionset tmpfile="/tmp/version.txt"echo "$conline" > $gen_tmpfile.sqlcat $sqlscrdir/find_version.sql >> $gen_tmpfile.sql$sqldba_cmd @$gen_tmpfile.sql >& $tmpfileif (`grep '7.*' $tmpfile |wc -l` != 0) then   set  ORAC_VERSION = "7"else   set  ORAC_VERSION = "6"endifrm -f $tmpfile $gen_tmpfile.sql >& /dev/null# Check the user status. If already existing, issue an error message. set orauser = `echo $PDMUSER | tr '[a-z]' '[A-Z]'`echo "$conline" > $gen_tmpfile.sqlif ($ORAPWDCHK) then   echo "select username from all_users where username = '$orauser'" >> $gen_tmpfile.sqlelse   echo "select username from all_users where username like 'OPS%$orauser'" >> $gen_tmpfile.sqlendifset get_query="/tmp/query_out.$$"$sqldba_cmd @$gen_tmpfile.sql  >& $get_query set numrows=`cat $get_query | grep 'row selected' | awk '{print $1}'`rm -f $get_query >& /dev/nullif ($ORAPWDCHK) then  set password = "PTC"  #default password  if ("$numrows" > 0) then    echo "Sorry, user '$PDMUSER' already exists in the Oracle server"    echo ""    goto EXIT_ERROR  else    echo "'$PDMUSER' is a new user in the Oracle server."    unset valid_ans      while (! $?valid_ans)         echo ""         echo -n "Do you want to accept PTC as the new user($PDMUSER)'s default password (y/n)? "         set ans="$<"         if ("$ans" =~ [Yy]* || "$ans" =~ [Nn]* ) set valid_ans      end    if ("$ans" =~ [Nn]*) then           while ("$password" == "" || "$password" == "PTC")                 echo ""                 echo "Please set the new user($PDMUSER)'s password. "                 echo -n "$PDMUSER's Password: "                 set  password="$<"                 if ("$password" == "PTC") echo "Please don't set PTC as the default password."           end    endif endifelse  #auto login priviledge check   if ("$numrows" > 0) then    echo "Sorry, '$PDMUSER' with automatic login privilege already exists in the Oracle server"    echo ""    goto EXIT_ERROR  else    echo "'$PDMUSER' with automatic login privilege is a new user in the Oracle server."  endifendif # CHECK ORACLE IS RUNNINGif ("$PS_CMD" != "__unset__") then   if (`$PS_CMD | grep -v grep | egrep " $oraprocess *"$ | wc -l` == 0) then      echo ""      echo "starting ORACLE ..."      echo "$sql_start_cmd" > $gen_tmpfile      if ($ORAC_VERSION == "6") then         $sqldba_cmd @$gen_tmpfile >& /dev/null      else         $sqldba_cmd @/$sqlscrdir/startdb.sql.V7 >& /dev/null       endif       rm -f $gen_tmpfile      if (`$PS_CMD | grep -v grep | egrep " $oraprocess *"$ | wc -l` == 0) then         echo ""         echo "ERROR:  could not start oracle"         goto EXIT_ERROR      endif   endifendif# check if rollback exists and is large enoughunset add_rollset outfile="/tmp/rollsegs.out"set tmpfile="/tmp/rollsegs.lst"echo "$conline" > $gen_tmpfile.sqlcat $sqlscrdir/checkroll.sql >> $gen_tmpfile.sql$sqldba_cmd @$gen_tmpfile.sql >& $outfileif (! -e $tmpfile) then   echo ""   echo "ERROR:  could not check rollbacks.  Check that DBA access privilege has been"   echo "        granted to the installer. "   echo ""   echo "Oracle error message was:"   cat $outfile   rm -f $outfile $tmpfile >& /dev/null   goto EXIT_ERRORelse   if (`cat $outfile | grep 'logon denied' | wc -l` != 0) then      echo ""      echo "ERROR:  could not check rollbacks - check that DBA access or login"      echo "        privilege has been granted to the installer."      rm -f $outfile $tmpfile >& /dev/null      goto EXIT_ERROR   endif   set numrows=`cat $tmpfile | grep 'rows selected' | awk '{print $1}'`   if ("$numrows" == 0) set add_rollendifrm -f $outfile $tmpfile >& /dev/nullif ($?add_roll) then   echo ""   echo "WARNING:  After the install the ORACLE database must be shutdown"   echo "          and restarted."endif# create PTC table space# According to the Oracle Version, to run the different .sql script filesswitch ( $ORAC_VERSION )case "6" :# create tablespace in Oracle Version 6  if ($ORAPWDCHK) then#  cat $sqlscrdir/setup_tbsp_user.sql | grep -v 'grant connect' | sed s/' identified by PTC'//g | sed s/'OPS$<PDMuser>'/$PDMUSER/g > $gen_tmpfile.sql     echo "$conline" > $gen_tmpfile.sql.V6     cat $sqlscrdir/setup_tbsp_user.sql | grep -v 'grant connect' | grep -v 'alter user' | sed s/' identified by PTC'//g | sed s/'OPS$<PDMuser>'/$PDMUSER/g >> $gen_tmpfile.sql.V6  else     echo "$conline" > $gen_tmpfile.sql     cat $sqlscrdir/usersearch.sql >> $gen_tmpfile.sql     $sqldba_cmd @$gen_tmpfile.sql >>& $gen_tmpfile.users     if (`grep -i ^OPS\$$PDMUSER\  $gen_tmpfile.users | wc -l` == 0) then        echo "$conline" > $gen_tmpfile.sql.V6        cat $sqlscrdir/setup_tbsp_user.sql | sed s/'<PDMuser>'/$PDMUSER/g >> $gen_tmpfile.sql.V6     else        echo "$conline" > $gen_tmpfile.sql.V6        cat $sqlscrdir/setup_tbsp_user.sql | sed s/'<PDMuser>'/$PDMUSER/g | sed s/' identified by PTC'//g | sed s/' identified by ptc'//g >> $gen_tmpfile.sql.V6     endif  endif  rm -f $gen_tmpfile.users >& /dev/null  breakswcase "7":# create tablespace in Oracle Version 7 if ($ORAPWDCHK) then  echo "$conline" > $gen_tmpfile.sql.V7  cat $sqlscrdir/setup_tbsp_user.sql.V7 | sed s/'OPS$<PDMuser>'/$PDMUSER/g | sed s/'PTC'/$password/g >> $gen_tmpfile.sql.V7  else  echo "$conline" > $gen_tmpfile.sql  cat $sqlscrdir/usersearch.sql >> $gen_tmpfile.sql  $sqldba_cmd @$gen_tmpfile.sql >>& $gen_tmpfile.users  if (`grep -i ^OPS\$$PDMUSER\  $gen_tmpfile.users | wc -l` == 0) then     echo "$conline" > $gen_tmpfile.sql.V7     cat $sqlscrdir/setup_tbsp_user.sql.V7 | sed s/'<PDMuser>'/$PDMUSER/g >> $gen_tmpfile.sql.V7  else     echo "$conline" > $gen_tmpfile.sql.V7     cat $sqlscrdir/setup_tbsp_user.sql.V7 | sed s/'<PDMuser>'/$PDMUSER/g | sed s/'by PTC'/'externally'/g >> $gen_tmpfile.sql.V7  endif endif rm -f $gen_tmpfile.users >& /dev/null breakswdefault:   echo "ERROR:  problem configuring Oracle DB....."   goto EXIT_ERRORendswcd /tmpset tmpfile="/tmp/sqlout.txt"if ($ORAC_VERSION == "7") then   echo "$conline" > /tmp/create_tbsp.sql   cat $sqlscrdir/create_tbsp.sql.V7 | sed s/"SIZE 10 M"/"SIZE $tbsize M"/g >> /tmp/create_tbsp.sql   $sqldba_cmd @$gen_tmpfile.sql.V7 >& $tmpfileelse   echo "$conline" > /tmp/create_tbsp.sql   cat $sqlscrdir/create_tbsp.sql | sed s/"SIZE 10 M"/"SIZE $tbsize M"/g >> /tmp/create_tbsp.sql   $sqldba_cmd @$gen_tmpfile.sql.V6 >& $tmpfileendifif (`grep -i 'already exists' $tmpfile | wc -l` == 0) then   if (`grep -i 'statement processed' $tmpfile | wc -l` == 0) then      echo ""      echo "ERROR:  problem creating table space(or users) with insufficient privileges."      echo ""      echo "Oracle error message was:"      cat $tmpfile      rm -f $tmpfile /tmp/create_tbsp.sql >& /dev/null      echo ""      echo ""      echo "*** Please make sure that you have sufficient privileges to create an Oracle user account. ***"       goto EXIT_ERROR   endifendifrm -f $tmpfile $gen_tmpfile.sql.V*  /tmp/create_tbsp.sql* >& /dev/nullif ($?add_roll) then   # Create roll   set tmpfile="/tmp/sqlout.txt"   echo "$conline" > $gen_tmpfile.sql   cat $sqlscrdir/create_roll.sql >> $gen_tmpfile.sql   $sqldba_cmd @$gen_tmpfile.sql >& $tmpfile   if (`grep -i 'already exists' $tmpfile | wc -l` == 0) then      if (`grep -i 'statement processed' $tmpfile | wc -l` == 0) then         rm -f $tmpfile >& /dev/null         echo ""         echo "ERROR:  problem creating rollback segment."         goto EXIT_ERROR      endif   endif   rm -f $tmpfile >& /dev/null   # Modify Initfile   cp $orainitfile /tmp/$orainitfile:t.bak >& /dev/null   set rbline=`grep '^ *rollback_segments' $orainitfile`   if (`echo "$rbline" | grep PTC_FIRST_ROLL | wc -l` == 0) then      if ("$rbline" == "") then         set newrbline="rollback_segments=PTC_FIRST_ROLL"      else         set rbnames=`echo "$rbline" | awk -F\= '{print $2}'`         set rbnames=`echo "$rbnames" | tr -d '(' |  tr -d ')'`         set newrbline="rollback_segments=($rbnames,PTC_FIRST_ROLL)"      endif      cat $orainitfile | grep -v '^ *rollback_segments' > $gen_tmpfile      echo "$newrbline" >> $gen_tmpfile      cp $gen_tmpfile $orainitfile      rm -f $gen_tmpfile >& /dev/null   endifendifEXIT_SUCCESS:if ($?add_roll) then   set stat="roll"else   set stat="succ"endifecho "$stat" > $CNFG_STATFILErm -f $gen_tmpfile.sql >& /dev/nullecho ""echo "The Oracle user account has been created successfully. "echo ""exit(0)EXIT_ERROR:echo "fail" > $CNFG_STATFILErm -f $gen_tmpfile.sql >& /dev/nullecho "Fail to create the Oracle user account."echo ""exit(1)

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?