#!/bin/ksh
#***********************************************************************
#*                                                                     *
#*             Copyright (c) Ultra Electronics Limited 2007            *
#*                         All rights reserved                         *
#*                                                                     *
#***********************************************************************
#* 
#* Filename:           create_recovery_catalog.ksh
#* Subsystem Name:     Database initialisation . RMAN backup
#* Originating Author: Gary Roberts
#* Design Reference:   UAS/FALCP/CA/02517
#*
#***********************************************************************
#*
#* Description:
#*     Creates a recovery catalog on the current server, in the database
#*     referenced by the current $ORACLE_SID environment variable. The
#*     catalog is created in a new schema called "rec_cat".
#* 
#* Usage:
#*     create_recovery_catalog
#*
#*
#**********************************************************************/


#
# Creation of the recovery catalog user
#
sqlplus "/ as sysdba" << EOF
CREATE USER rec_cat IDENTIFIED BY rec_cat DEFAULT TABLESPACE sysaux;
GRANT connect, resource, recovery_catalog_owner TO rec_cat;
EOF

#
# Build the recovery catalog using RMAN
#
rman catalog=rec_cat/rec_cat << EOF
create catalog tablespace sysaux;
EOF

