Friday, October 15, 2010

Register the database with CRS

CRS  SRVCTL

Register database with CRS to enable automatic startup/shutdown of database and services when server is bounced

To register the database with CRS


# Script : grid_register_database.sh
#!/bin/sh
if [[ -z $1 ]]; then
  echo "Error: Format is register_database 'sid'"
  exit 2
fi
ORADB=$1
#  must use the 11g grid control version of srvctl
export ORACLE_HOME=/ora01/grid/11.2.0.2/grid
export PATH=$ORACLE_HOME/bin:$PATH
echo "ORADB =" ${ORADB}
srvctl add database -d ${ORADB} -n ${ORADB} -o /ora01/oracle/product/db_1020 -p +ORADATA001/${ORADB}/spfile${ORADB}.ora -s open -t immediate \
-y AUTOMATIC -a "ORADATA001,ORAFLASH001"

srvctl config database -d ${ORADB}
exit

# to register the cluster database(RAC) with CRS

srvctl add database -d demo -o /ora01/oracle/product/db_1020 -p +ORADATA001/demo/spfiledemo.ora
srvctl add instance -d demo -i demo1 -n lnx101
srvctl add instance -d demo -i demo2 -n lnx102
srvctl add service -d demo -s dmb_srv -r “demo1,demo2”


# Check CRS with crs_stat -t


Hope this help. Regards Rupam