Tuesday, February 26, 2008

ORA-01034: ORACLE not available / ORA-27101: shared memory realm does not exist

Database is "UP" but Veritas Netbackup detect that the oracle db is down and cannot create template from Netbackup Java Console.


Because of this error, than I try to configure the Hot Backup Oracle using RMAN script provided by Netbackup on "/usr/openv/netbackup/ext/db_ext/oracle/samples/rman". Using this script, I also found the same error.

RMAN-00571:=============================================
RMAN-00569:======== ERROR MESSAGE STACK FOLLOWS =========
RMAN-00571:=============================================
RMAN-03002: failure of allocate command at 02/25/2008 15:12:29
RMAN-06403: could not obtain a fully authorized session
ORA-01034: ORACLE not available
ORA-27101: shared memory realm does not exist
SVR4 Error: 2: No such file or directory
We can connect locally to RMAN, and test the link to Veritas Netbackup with successfully.

bash-2.05$ pwd
/rdbms/oracle9
bash-2.05$ rman target veritas/veritas
Recovery Manager: Release 9.2.0.6.0 - 64bit Production
Copyright (c) 1995, 2002, Oracle Corporation. All rights reserved.
connected to target database: ODONG2 (DBID=1263713746)
RMAN> RUN {
2> ALLOCATE CHANNEL ch00 TYPE 'SBT_TAPE';
3> RELEASE CHANNEL ch00;
4> }
using target database controlfile instead of recovery catalog
allocated channel: ch00
channel ch00: sid=38 devtype=SBT_TAPE
channel ch00: VERITAS NetBackup for Oracle - Release 5.0GA (2003103006)
released channel: ch00
RMAN> quit
Recovery Manager complete.
bash-2.05$
But using the netbackup Java Console & Netbackup Script still the same error. After discuss with the DBA, refer to documentation support from Veritas Netbackup, and some tries, we found that, the problem is on environtment variables :

Here is our environtment variables on this server :
bash-2.05$ env
PWD=/rdbms/oracle9
ORACLE_SID=test
HOSTNAME=odong2
LD_LIBRARY_PATH=/rdbms/oracle9/OraHome1/lib
MACHTYPE=sparc-sun-solaris2.9
MAIL=/var/mail/oracle9
EDITOR=vi
ORACLE_BASE=/rdbms/oracle9/
ORACLE_HOME=/rdbms/oracle9//OraHome1/
LOGNAME=oracle9
SHELL=/bin/bash
HOSTTYPE=sparc
OSTYPE=solaris2.9
HOME=/rdbms/oracle9
And the problem is we cannot go directly to ORACLE_HOME using the script, but must be used "ORACLE_HOME=$ORACLE_BASE/OraHome1/" .

To SOLVE the problem, we "add" the ORACLE_BASE parameter to the Script :
# ----------------------------------------------------------
# Replace /db/oracle81, below, with the Oracle home path.
# ----------------------------------------------------------

ORACLE_BASE=/rdbms/oracle9/
export ORACLE_BASE
ORACLE_HOME=$ORACLE_BASE/OraHome1/
export ORACLE_HOME
After adding the ORACLE_BASE parameter, Hot Backup Online Oracle running normal.

Thursday, January 31, 2008

Hot Backup Oracle using Veritas Netbackup

Requirements :
Oracle DB Archivelog status = ON & Start …….. here
Controlfile Autobackup = ON…….. here
Default Autobackup device type = SBT_TAPE

Preparations :
Install Netbackup for Oracle Agent
Shutdown all of the Oracle instances (SIDs).
Login or su – from root to oracle user
# sqlplus /nolog
SQL> connect / as sysdba
SQL> shutdown immediate
SQL> exit

Link Netbackup to Oracle :
Automatically link :
/install_path /netbackup/bin/oracle_link
Manually Link :
ln -s /install_path /netbackup/bin/libobk.so.1 libobk.so (solaris)
ln -s /install_path /netbackup/bin/libobk.so64.1 libobk.so (solaris with 64-bit Oracle Software)
ln -s /install_path /netbackup/bin/libobk.a64 libobk.a (AIX)
ln -s /install_path /netbackup/bin/libobk.sl64 libobk.sl (HP-UX)
ln -s /install_path /netbackup/bin/libobk.so libobk.so (linux)
Test Connectivity from Oracle RMAN to Veritas Netbackup :
RMAN> run{allocate channel ch00 type 'SBT_TAPE';
2> release channel ch00;
3> }
Output :
using target database controlfile instead of recovery catalog
allocated channel: ch00
channel ch00: sid=14 devtype=SBT_TAPE
channel ch00: VERITAS NetBackup for Oracle - Release 5.0GA (2006030216)
released channel: ch00
RMAN> quit
Recovery Manager complete.

Hot Backup Oracle :

Create Online Backup Shell Script for Full DB & archivelogs refer to sample RMAN script on "/install_path/netbackup/ext/db_ext/oracle/samples/rman" or using template from Veritas Netbackup GUI Wizard.

Hot Backup Oracle SCRIPT…….. here
Hot Backup Oracle TEMPLATE…….. here

Create Policy for Full Online Backup & Archivelogs Backup.
Test Hot Backup Oracle using Veritas Netbackup.

Hot Database Backup Sample Script

Online Backup Shell Script for Full DB & archivelogs refer to sample RMAN script (/install_path/netbackup/ext/db_ext/oracle/samples/rman)

#!/bin/sh
# $Header: hot_database_backup.sh,v 1.2 2002/08/06 23:51:42 $
#bcpyrght
#***************************************************************************
#$VRTScprght:Copyright 1993-2003 VERITAS Software Corporation,All Rights Reserved $
#***************************************************************************
#ecpyrght
#hot_database_backup.sh
# Determine the user which is executing this script.
CUSER=`id |cut -d"(" -f2 | cut -d ")" -f1`
# Put output in .out. Change as desired.
# Note: output directory requires write permission.
RMAN_LOG_FILE=${0}.out
# You delete the output file so that backup information does not accumulate.
# If not, delete the following lines.

if [ -f "$RMAN_LOG_FILE" ]
then
rm -f "$RMAN_LOG_FILE"
fi
# Initialize the log file.
echo >> $RMAN_LOG_FILE
chmod 666 $RMAN_LOG_FILE
# Log the start of this script.
echo Script $0 >> $RMAN_LOG_FILE
echo ==== started on `date` ==== >> $RMAN_LOG_FILE
echo >> $RMAN_LOG_FILE

# Replace /db/oracle/product/ora81, below, with the Oracle home path.
ORACLE_HOME=/db/oracle/product/ora81
export ORACLE_HOME
# Replace ora81, below, with the Oracle SID of the target database.
ORACLE_SID=ora81
export ORACLE_SID
# Replace ora81, below, with the Oracle DBA user id (account).
ORACLE_USER=ora81
# Set the target connect string. Replace "sys/manager", below, with the target connect string.
TARGET_CONNECT_STR=sys/manager
# Set the Oracle Recovery Manager name.
RMAN=$ORACLE_HOME/bin/rman
# Print out the value of the variables set by this script.
echo >> $RMAN_LOG_FILE
echo "RMAN: $RMAN" >> $RMAN_LOG_FILE
echo "ORACLE_SID: $ORACLE_SID" >> $RMAN_LOG_FILE
echo "ORACLE_USER: $ORACLE_USER" >> $RMAN_LOG_FILE
echo "ORACLE_HOME: $ORACLE_HOME" >> $RMAN_LOG_FILE
# Print out the value of the variables set by bphdb.
echo >> $RMAN_LOG_FILE
echo "NB_ORA_FULL: $NB_ORA_FULL" >> $RMAN_LOG_FILE
echo "NB_ORA_INCR: $NB_ORA_INCR" >> $RMAN_LOG_FILE
echo "NB_ORA_CINC: $NB_ORA_CINC" >> $RMAN_LOG_FILE
echo "NB_ORA_SERV: $NB_ORA_SERV" >> $RMAN_LOG_FILE
echo "NB_ORA_POLICY: $NB_ORA_POLICY" >> $RMAN_LOG_FILE
# NOTE: This script assumes that the database is properly opened.
# If desired, this would be the place to verify that.
echo >> $RMAN_LOG_FILE
if [ "$NB_ORA_FULL" = "1" ]
then
echo "Full backup requested" >> $RMAN_LOG_FILE
BACKUP_TYPE="INCREMENTAL LEVEL=0"
elif [ "$NB_ORA_INCR" = "1" ]
then
echo "Differential incremental backup requested" >> $RMAN_LOG_FILE
BACKUP_TYPE="INCREMENTAL LEVEL=1"
elif [ "$NB_ORA_CINC" = "1" ]
then
echo "Cumulative incremental backup requested" >> $RMAN_LOG_FILE
BACKUP_TYPE="INCREMENTAL LEVEL=1 CUMULATIVE"
elif [ "$BACKUP_TYPE" = "" ]
then
echo "Default - Full backup requested" >> $RMAN_LOG_FILE
BACKUP_TYPE="INCREMENTAL LEVEL=0"
fi
# Call Recovery Manager to initiate the backup. This example does not use a Recovery Catalog.
# If you choose to use one, replace the option 'nocatalog' from the rman command line below
# with the 'rcvcat /@' statement.
# Backs up the whole database. This backup is part of the incremental strategy
# (this means it can have incremental backups of levels > 0 applied to it).
CMD_STR="
ORACLE_HOME=$ORACLE_HOME
export ORACLE_HOME
ORACLE_SID=$ORACLE_SID
export ORACLE_SID
$RMAN target $TARGET_CONNECT_STR nocatalog msglog $RMAN_LOG_FILE append <<>> $RMAN_LOG_FILE
RSTAT=$?
else
/usr/bin/sh -c "$CMD_STR" >> $RMAN_LOG_FILE
RSTAT=$?
fi
# Log the completion of this script.
if [ "$RSTAT" = "0" ]
then
LOGMSG="ended successfully"
else
LOGMSG="ended in error"
fi
echo >> $RMAN_LOG_FILE
echo Script $0 >> $RMAN_LOG_FILE
echo ==== $LOGMSG on `date` ==== >> $RMAN_LOG_FILE
echo >> $RMAN_LOG_FILE
exit $RSTAT

Enabling Oracle ARCHIVELOG Mode

Procedure 1

Login as "ora" or su - from "root" at operating system
# sqlplus /nolog
SQL > connect / as sysdba
SQL > shutdown immediate;
SQL > startup mount;
Checking the current archive mode status.
SQL> SELECT LOG_MODE FROM SYS.V$DATABASE;
LOG_MODE
------------
NOARCHIVELOG

Set archivelog destination and format :
SQL> alter system set log_archive_format=’ SIDarch%t_%s.dbf;
SQL> alter system set log_archive_dest=’/oracle/SID/archivelogs;
Check archivelog destination and format
SQL> select name,value from v$parameter where name=’log_archive_format’;
SQL> select name,value from v$parameter where name=’log_archive_dest’;
Backup or Copy original "initSID.ora" :
# cp /oracle/SID/920_64/dbs/initSID.ora /oracle/SID/920_64/dbs/initSID.ora.orig
SQL> create pfile=’ /oracle/SID/920_64/dbs/initSID.ora’ from spfile;
SQL> alter database archivelog;
SQL> select log_mode from v$database;
LOG_MODE
------------
ARCHIVELOG
SQL> alter database open;
SQL> exit

PROCEDURE 2 [only do this procedure if procedure 1 above failed]

This procedure update the pfile directly. The pfile should be in either $ORACLE_BASE/admin/SID/pfile or $ORACLE_HOME/admin/SID/pfile.

Login as "ora" or su - from "root" at operating system.
# sqlplus /nolog
SQL > connect / as sysdba
Checking the current archive mode status, if status "NOARCHIVELOG" than shutdown database to run enable archivelog mode procedure.
SQL> SELECT LOG_MODE FROM SYS.V$DATABASE;
LOG_MODE
------------
NOARCHIVELOG
SQL > shutdown immediate;
SQL > exit
# vi $ORACLE_BASE/admin/SID/pfile
Add the following lines to the end of the pfile :
# Archive Log Destinations #
log_archive_dest_1='location=/oracle/SID/archivelogs'
log_archive_start=TRUE
Startup the database in mount mode and put it in archivelog mode.
# sqlplus /nolog
SQL > connect / as sysdba
SQL > startup mount;
SQL> alter database archivelog;
SQL> alter database open;
Check archivelog destination and status
SQL> SELECT LOG_MODE FROM SYS.V$DATABASE;
LOG_MODE
------------
ARCHIVELOG
SQL> show parameter log_archive_dest_1
SQL> show parameter spfile;
SQL> show parameter log_archive_start;
Test create archivelog
SQL> alter system switch logfile;
SQL> create pfile from spfile;
SQL> shutdown immediate;
SQL> startup
SQL> exit

Problem solving Error Status Code 6 [NBU - Oracle]

Problem :
STATUS CODE 6: "The backup failed to back up the requested files"
The archive log file may have been deleted from the operating system and it does not exist at the specified location.

Reference :
http://seer.entsupport.symantec.com/docs/275089.htm

Resolution :
RMAN> Change Archivelog All Validate;
RMAN> Change Archivelog All Crosscheck;