Logo

UNIX Shell Script

Set Database ARCHIVELOG Mode

Tested on Oracle 8.1

Updated : 18-Apr-2002
Version : 2.0

Description

Shut database down and sets the database in Archive Log Mode.

Parameters

$1 (MANDATORY) - ORACLE_SID of the database to set ARCHIVELOG mode.

Shell Source

#!/bin/ksh
DATABASE=$1
USERPASS="/ as sysdba"

# Check that we have a database
if [ -z "${DATABASE}" ]
then
   echo
   echo "No Database Specified !"
   echo
   echo "Usage : set_archivelog.ksh "
   echo
   echo "where ORACLE_SID (Mandatory) - SID of database to start"
   echo
   echo " e.g.  $ set_archivelog.ksh PROD" 
   echo
   exit 1
fi

ORACLE_SID=$DATABASE
export ORACLE_SID
export ORAENV_ASK=NO
. oraenv       

if [ ! -d "${ORACLE_HOME}" ]
then
  echo
  echo "$ORACLE_HOME does not exist !"
  echo
  exit 1
fi

#
# SHUT THE DATABASE DOWN
# 
sqlplus "${USERPASS}" << EOF
shutdown immediate
exit
EOF

sqlplus "${USERPASS}" << EOF
startup mount exclusive;
alter database archivelog;
alter database open;
archive log start
archive log list
exit
EOF

exit 0

Previous Oracle Version Links

Set Database ARCHIVELOG Mode

Return to Index of SQL Scripts


Home | Company Profile | Services | Contact Us | SQL scripts and tips | Quiz
Legal

Logo