Monday, February 27, 2012

CRS output readable format

When you run crs_stat -t command, you can see  at below format output

Name              Type           Target    State     Host
------------------------------------------------------------
ora.test.db       application    ONLINE    ONLINE    server01
ora....e1.inst    application    ONLINE    ONLINE    server01
ora....e2.inst    application    ONLINE    ONLINE    server02
ora....SM1.asm    application    ONLINE    ONLINE    server01
ora....02.lsnr    application    ONLINE    ONLINE    server01
ora.server01.gsd  application    ONLINE    ONLINE    server01
ora.server01.ons  application    ONLINE    ONLINE    server01
ora.server01.vip  application    ONLINE    ONLINE    server01
ora....SM2.asm    application    ONLINE    ONLINE    server02
ora....02.lsnr    application    ONLINE    ONLINE    server02
ora.server02.gsd  application    ONLINE    ONLINE    server02
ora.server02.ons  application    ONLINE    ONLINE    server02
ora.server02.vip  application    ONLINE    ONLINE    server02

Here is readable format output.

Run below code  in shell script

#!/usr/bin/ksh
#
# Sample 10g CRS resource status query script
#
# Description:
#    - Returns formatted version of crs_stat -t, in tabular
#      format, with the complete rsc names and filtering keywords
#   - The argument, $RSC_KEY, is optional and if passed to the script, will
#     limit the output to HA resources whose names match $RSC_KEY.
# Requirements:
#   - $ORA_CRS_HOME should be set in your environment
RSC_KEY=$1
export ORA_CRS_HOME=/home/oracle/oracle/product/10.1/crs
QSTAT=-u
AWK=/usr/bin/awk    # if not available use /usr/bin/awk
# Table header:echo ""
$AWK \
  'BEGIN {printf "%-45s %-10s %-18s\n", "HA Resource", "Target", "State";
          printf "%-45s %-10s %-18s\n", "-----------", "------", "-----";}'
# Table body:
$ORA_CRS_HOME/bin/crs_stat $QSTAT | $AWK \
 'BEGIN { FS="="; state = 0; }
  $1~/NAME/ && $2~/'$RSC_KEY'/ {appname = $2; state=1};
  state == 0 {next;}
  $1~/TARGET/ && state == 1 {apptarget = $2; state=2;}
  $1~/STATE/ && state == 2 {appstate = $2; state=3;}
  state == 3 {printf "%-45s %-10s %-18s\n", appname, apptarget, appstate; state=0;}'

Here is output

HA Resource                                                     Target          State
-----------                                                            ------            -----
ora.test.db                                                          ONLINE     ONLINE on server01
ora.neptune.test1.inst                                        ONLINE     ONLINE on server01
ora.neptune.test2.inst                                        ONLINE     ONLINE on server02
ora.server01.ASM1.asm                                   ONLINE     ONLINE on server01
ora.server01.LISTENER_server01.lsnr           ONLINE     ONLINE on server01
ora.server01.gsd                                                ONLINE     ONLINE on server01
ora.server01.ons                                                ONLINE     ONLINE on server01
ora.server01.vip                                                 ONLINE     ONLINE on server01
ora.server02.ASM2.asm                                    ONLINE     ONLINE on server02
ora.server02.LISTENER_server02.lsnr           ONLINE     ONLINE on server02
ora.server02.gsd                                                 ONLINE     ONLINE on server02
ora.server02.ons                                                 ONLINE     ONLINE on server02
ora.server02.vip                                                 ONLINE     ONLINE on server02

Tuesday, February 14, 2012

ORA-27054: NFS file system where the file is created or resides is not mounted with correct options

When you do export or import into oracle database, you can see below error

ORA-39001: invalid argument value
ORA-39000: bad dump file specification
ORA-31640: unable to open dump file "<Dump file path>" for read
ORA-27054: NFS file system where the file is created or resides is not mounted with correct options
Additional information: 3 

And also you can see below error message in alert.log file

Wed May 13 10:23:27 2009
DM00 started with pid=77, OS id=21928, job <username>.SYS_IMPORT_FULL_01
WARNING:NFS file system /ora/odmp mounted with incorrect options
WARNING:Expected NFS mount options: rsize>=32768,wsize>=32768,hard,noac/actimeo=0
Wed May 13 10:23:27 2009

Cause
The problem is due to a configuration issue trying to write the dumpfile using a directory on a NFS mount point.

Solution
Here are the mount options that need to be used for NFS volumes on Linux are:
rsize=32k, wsize=32k, hard, actimeo=0 
Along with the error there are warning messages printed in the alert log with the mount options to be used.Sometimes you may need to do the following to allow datapump to work with NFS mounted files:
Set the event in the init.ora, to disable the mount point parameter checking:

event="10298 trace name context forever, level 32"
          
Note that the event 10298 skips all mount checks.  Setting this event has to be done with care. Verify settings with your System Administrator to ensure no datafiles are corrupted