#!/bin/sh # # $DBA/crearch # # Defines database-specific info for the $SID database: # ARCHSTAT = Archive log status of the database; One of: ARCHIVELOG or # NOARCHIVELOG # ARCHSTART = Start of Archive log file specification # ARCHEND = End of Archive log file specification # ARCHDIR = Archive log directory (without any file name prefix) # # Parameters: # $SID = ORACLE_SID of the database whose info is to be defined # # (The calling script must execute this in the context of the parent's shell, # so the environment variables that are defined are accessible by the parent) # # <<<<<<<<<<<<<<<<<<< MODIFICATION HISTORY >>>>>>>>>>>>>>>>>>> # 02/20/97 Brian Lomasky Original # ARCHSTART="" ARCHEND="" ARCHDIR="" ARCHSTAT="" if [ "$SID" = "" ]; then echo "crearch: Error - No SID environment variable found" echo "Usage: SID=" echo " . crearch" exit 2 fi mysid=`fixcase $SID` valid_db $mysid if [ $? -ne 0 ]; then exit 2 fi SID=$mysid . define dbo_stat $mysid if [ $? -eq 0 ] then sqlplus -s / < /dev/null set pagesize 0 set echo off set feedback off set heading off set termout off set verify off set concat + spool crearch_$mysid.lst set concat . select '#!/bin/sh' || chr(10) || 'ARCHSTAT=' || log_mode || chr(10) || 'ARCHSTART=' || s.value || chr(10) || 'ARCHDIR=' || decode(sign(length(s.value) - instr(s.value,'/',-1)),0,s.value, substr(s.value,1,instr(s.value,'/',-1)-1)) || chr(10) || 'ARCHEND='||substr(e.value,decode(instr(e.value,'.'),0,1, instr(e.value,'.'))) from v\$parameter s, v\$parameter e, v\$database where s.name = 'log_archive_dest' and e.name = 'log_archive_format'; spool off exit XXX if [ ! -r crearch_$mysid.lst ] then echo "crearch: Error - No crearch_$mysid.lst file found" exit 2 fi . crearch_$mysid.lst export ARCHSTAT export ARCHSTART export ARCHEND export ARCHDIR echo " ARCHSTAT env name for $mysid has been set to $ARCHSTAT" echo " ARCHSTART env name for $mysid has been set to $ARCHSTART" echo " ARCHEND env name for $mysid has been set to $ARCHEND" echo " ARCHDIR env name for $mysid has been set to $ARCHDIR" rm crearch_$mysid.lst if [ "$ARCHSTAT" = "ARCHIVELOG" ] then if [ "$ARCHSTART" = "" ] then echo "Warning: Database $mysid has no archive log"\ " file destination..." fi else echo " Database $mysid is in NOARCHIVELOG mode" fi else echo "Warning: Database $mysid is down - No archive log info available" fi