[Contents] [Index] [Info] [Previous] [Next]

APPENDIX C. Sample ORASRV_BEQ_<sid> Command Procedure

This appendix shows the contents of the ORASRV_BEQ_COM.SAMPLE file. You can find a copy of this file in the TNS_ADMIN directory.

$!
$! NAME: ORASRV_BEQ_<sid>.COM template
$!
$! FUNCTION: Setup environment for RDBMS shadow processes and start it for
$!           SQL*Net V2 bequeath adapter.
$!
$! MODIFIED:
$!  Rgutherz  04/18/97 - Mods for BEQ listener
$!  DSchwab   07/23/95 - Mods so that this will run in spawned process
$!  DHayter   07/19/96 - Avoid running ORAUSER_<dbname>.COM if possible
$!  DSchwab   07/16/96 - Created
$!-------------------------------------------
$!
$! This file serves as a template for the actual file that will be created on a
$! per instance basis to setup environment for, and startup RDBMS shadow
$! processes for SQL*Net V2 bequeath connections.  It must exist as 
$! ORA_ROOT:[NETWORK.ADMIN]ORASRV_BEQ_<sid>.COM.
$!
$ ON ERROR THEN GOTO CLEANUP
$!
$! Edit the following lines to substitute the SID of this database
$! and its administration directory:- 
$! 
$! Substitute <sid> with the actual sid of the database 
$ sid    = "<sid>"               ! e.g. PROD
$! 
$! Substitute <dbname> with the name of the database
$ dbname = "<dbname>"            ! e.g. PRODDB
$! 
$! Substitute <ora_db> with the location of the database admin. directory
$ ora_db = "<ora_db>"            ! e.g. DKB300:[ORACLE7.DB_PROD] 
$!
$!
$ define ora_sid 'sid'           ! Need the ORA_SID logical
$ lnm = "ORA_RDBMS_LNM_''sid'"   ! The database's own logical name table 
$!
$!
$! If the logical name table doesn't (yet) exist then pick up the required
$! logical names from the ORAUSER_<dbname>.COM command procedure.
$! This should only be the case if the database has not yet been started.
$!
$! If the logical name table DOES exist, then it should contain all of the
$! logicals required for the server process to access message files etc.
$! 
$ lnmx = f$trnlnm(lnm,"LNM$SYSTEM_DIRECTORY",,,,"TABLE") 
$ if lnmx                             ! If ORA_RDBMS_LNM_<sid> exists... 
$ then 
$   ora_rdbms = f$trnlnm("ORA_RDBMS",lnm)      ! If ORA_RDBMS isn't there... 
$   if ora_rdbms .eqs. "" then lnmx = "FALSE"  ! ....pretend the table isn't 
$ endif 
$! 
$! If the ORA_RDBMS_LNM_<sid> logical name table exists, and has ORA_RDBMS
$! defined within it, then we should be safe in assuming that it will have
$! all the other required logicals.  ORA_SYSTEM and ORA_PLSQL may be
$! exceptions to this before Oracle7 Server release 7.3.2.2.0 so we'll
$! make SURE that they get defined somewhere.
$! 
$ if lnmx                          ! If it REALLY exists... 
$ then 
$   if f$trnlnm("ORA_SYSTEM",lnm) .eqs. "" then define ora_system 'ora_rdbms'
$   if f$trnlnm("ORA_PLSQL", lnm) .eqs. "" then define ora_plsql  'ora_rdbms'
$   lnm = lnm+","
$ else 
$!
$! If we get to this point then we are forced to use ORAUSER_<dbname>.COM
$! to define the necessary logicals for us - but this may be rather slow.
$!
$   v1 = f$verify(0)   ! If logging output we don't want to see ORAUSER stuff
$   @'ora_db'orauser_'dbname' 'sid'  ! Pick up the required logicals this way
$   v2 = f$verify(v1)  ! Switch VERIFY back on if it was originally on
$   lnm = ""           ! Blank out logical name table as it doesn't yet exist
$ endif 
$!
$ orasrv := $ORA_RDBMS:SRV.EXE
$!
$! Form name of our logical name table
$!
$ pid = f$getjpi("", "PID")
$ tab = "TNS_" + pid
$!
$ define/table=lnm$process_directory lnm$file_dev -
        'lnm' 'tab',lnm$process,lnm$job,lnm$group,lnm$system
$!
$!
$ set noon
$ arg0 = f$trnlnm("arg0")
$ arg1 = f$trnlnm("arg1")
$ arg2 = f$trnlnm("arg2") 
$ arg3 = f$trnlnm("arg3")
$ arg4 = f$trnlnm("arg4")
$ arg5 = f$trnlnm("arg5")
$ arg6 = f$trnlnm("arg6")
$ arg7 = f$trnlnm("arg7")
$ arg8 = f$trnlnm("arg8")
$! 
$! __________________________________________________
$! 
$! Execute the Authentication command scripts, if present
$ oraroot = f$trnlnm("ORA_NETWORK") - "NETWORK]"
$ if f$search("''ORAROOT'netconfig]SECURID_USER.COM") .nes. "" then -
    @'ORAROOT'netconfig]SECURID_USER.COM
$ if f$search("''ORAROOT'netconfig]KERBEROS_USER.COM") .nes. "" then -
    @'ORAROOT'netconfig]KERBEROS_USER.COM
$ if f$search("''ORAROOT'netconfig]KERBEROS_USER.COM") .nes. "" then -
    define SYS$SCRATCH 'ORAROOT'NETWORK.KRB5]
$! 
$!Change process name (Rgutherz)
$ sname = f$edit(sid,"upcase")
$ i = 1
$retry
$  if i .gt. 100
$  then
$    write sys$output "Error changing process name after 100 times"
$    exit
$  endif
$  on error then goto retry
$  time = f$time()
$  time = f$cvtime(time)
$  time = f$extract(17,5,time)
$  time = time - "."
$  i = i + 1
$  set process/name="ORA_''sname'B''time'"
$  on error then goto CLEANUP
$! 
$ old_priv = f$setprv("PRMMBX,LOG_IO,TMPMBX,NETMBX,SYSNAM,DETACH,CMKRNL,WORLD")
$ if arg1 .eqs. ""
$ then
$   orasrv "(LOCAL=NO)"
$ else
$   orasrv 'arg1' 'arg2' 'arg3' 'arg4' 'arg5' 'arg6' 'arg7' 'arg8'
$ endif
$! 
$CLEANUP:
$ sts = $status
$ severity = f$message(sts,"severity")
$! 
$ if severity .eqs. "%E" .or. severity .eqs. "%F" .or. severity .eqs. "%W"
$ then
$  status = sts
$  trace_dir = ora_db - "]" + ".trace]
$  open/write trace_file 'trace_dir'orasrv_beq_'pid'.trc
$  write trace_file "This trace file was generated by ORASRV_BEQ_''sid'.COM"
$  write trace_file "exit with STATUS = ''status'"
$  msg = f$message("''status'")
$  write trace_file "''msg'"
$  close trace_file
$ endif
$! 
$ on error then continue
$ deassign/user/table=lnm$system_directory 'tab'
$ exit 'sts'


[Contents] [Index] [Info] [Previous] [Next]