Thursday, April 28, 2011

Rman: Ora-01008 When Connecting To Target in 11.2.0.2 [ID 1280447.1]




It's a bug with a patch. Workaround is to :

SQL> alter system flush shared_pool;

Hope This Helps! Rupam

Tuesday, April 26, 2011

Basics of 10g RAC/CRS




IMP: login as root for startup and shutdown

To Start CRS
Go to $CRS_HOME/bin
# ./crsctl start crs
Or
#  /etc/init.d/init.crs start

Check CRSD process
ps -ef|grep crsd.bin

To Stop CRS
Go to $CRS_HOME/bin
# ./crsctl stop crs
Or
# /etc/init.d/init.crs stop

CRS enable/disable
Go to $CRS_HOME/bin
crsctl enable crs
crsctl disable crs # ensures that the services do not come up after a reboot.

To find out the value of your CLUSTER_NAME from CRS (OCR),
  cd $CRS_HOME/bin
  ./cemutlo -n

lists the version of CRS software installed
crsctl query crs softwareversion []

lists the CRS software operating version
crsctl query crs activeversion


Status of CRS services
Go to $CRS_HOME/bin
bash-3.00$ ./crs_stat -t
Name Type Target State Host
------------------------------------------------------------
ora.cmwdb1.gsd application ONLINE ONLINE cmwdb1
ora.cmwdb1.ons application ONLINE ONLINE cmwdb1
ora.cmwdb1.vip application ONLINE ONLINE cmwdb1
ora.cmwdb2.gsd application ONLINE ONLINE cmwdb2
ora.cmwdb2.ons application ONLINE ONLINE cmwdb2
ora.cmwdb2.vip application ONLINE ONLINE cmwdb2


Check current OCR file

bash-3.00$ ocrcheck
Status of Oracle Cluster Registry is as follows :
Version : 2
Total space (kbytes) : 102188
Used space (kbytes) : 2140
Available space (kbytes) : 100048
ID : 617463612
Device/File Name : /dev/vx/rdsk/racdg/rac_srvconfig
Device/File integrity check succeeded

Device/File not configured

Cluster registry integrity check succeeded


Check current CRS file

bash-3.00$ crsctl query css votedisk
0. 0 /dev/vx/rdsk/racdg/crs

located 1 votedisk(s).

Files need to backed for CRS

CRS HOME and startup scripts

$CRS_HOME
/etc/init.d/init.cssd
/etc/init.d/init.crs
/etc/init.d/init.crsd
/etc/init.d/init.evmd
/var/opt/oracle
/etc/inittab

OCR file

bash-3.00$ ocrconfig -showbackup
cmwdb1 2010/09/27 12:17:02 /oracle/crs/cdata/crs
cmwdb1 2010/09/27 08:17:01 /oracle/crs/cdata/crs
cmwdb1 2010/09/27 04:17:00 /oracle/crs/cdata/crs
cmwdb1 2010/09/26 12:16:57 /oracle/crs/cdata/crs
cmwdb1 2010/09/19 08:16:08 /oracle/crs/cdata/crs

CRS file
bash-3.00$ crsctl query css votedisk
0. 0 /dev/vx/rdsk/racdg/crs
dd if=/dev/vx/rdsk/racdg/crs of=/oracle/crs/data/crs/crs_backup.dmp bs=4k


CRS Log files location
$CRS_HOME/log/hostname


cluster verification utlity
     cluvfy comp crs -n all -verbose
     cluvfy comp ocr -n all -verbose
     cluvfy comp nodecon -n all -verbose
     olsnodes
     cluvfy comp -list
     cluvfy stage -list
     cvuqdisk
     cluvfy stage -post crsinst -n all -verbose  # as oracle

Do you want to check the health of the Clusterware?
     crsctl check crs
     crsctl check evmd
     crsctl check cssd
     crsctl check crsd
           

# OEM User Defined OS Metric.
    Script is called by OEM to monitor the health of CRSd on a particular node.
    # UserDefinedHostScripts/checkCRS.sh

    The script runs the "crsctl check crsd" command. The normal output
    is "CRS appears healthy". Any other response will trigger an alert.
    The alert is configured to send an email and an snmp trap to Unicenter.

    #!/usr/bin/ksh
    if [[ $(/ora01/oracle/product/crs_1020/bin/crsctl check crsd) = "CRS appears healthy" ]]
      then print "em_result=0\nem_message=CRSd is healthy\n"
      else print "em_result=1\nem_message=CRSd not responding\n"
    fi
    exit

CRS reboot issue
Whenever a node is having issues joining the cluster back post reboot, here is a quick check list :

    * /var/log/messages
    * ifconfig
    * ip route
    * /etc/hosts
    * /etc/sysconfig/network-scripts/ifcfg-eth*
    * ethtool
    * mii-tool
    * cluvfy
    * $CRS_HOME/log/hostname









To find the root cause, please provide the following from all the nodes to Oracle Support.

1)- OSWatcher output from all the nodes
2)- All log files under $CRS_HOME/log. You can use diagcollection.pl to get all log files.
3)- System OS logs "/var/log/messages".

4)- OPROCD log files under /etc/oracle/oprocd or /var/opt/oracle/oprocd.

5) Capture output of the cluvfy command.
Execute the following commands as oracle:

>ORACLE_SID=crs;ORAENV_ASK=NO;. oraenv;ORAENV_ASK=YES
>HOST=$(hostname)
>cd /opt/oracle/admin/SR
>script $HOST.cluvfy.log
>cluvfy stage -post crsinst -n all -verbose
>exit
Upload the files to Oracle in support of your SR.


Using the diagcollection.pl procedure
Run the following commands on each node. These commands must be run as root.

>export ORA_CRS_HOME=/ora01/oracle/product/crs_1020
>export ORACLE_BASE=/ora01/oracle
>export ORACLE_HOME=/ora01/oracle/product/crs_1020
>export HOSTNAME=$(hostname)
>cd $ORA_CRS_HOME/bin
>script diag.log
>env
>id
>./diagcollection.pl -collect
>exit
This creates the
            diag.log file in $ORA_CRS_HOME/bin and
these files crsData_.tar.gz,
            ocrData_.tar.gz,
            oraData_.tar.gz and
            basData_.tar.gz

If you get a prompt to overwrite existing tar.gz files, go ahead and overwrite.
This is a perl script, so /bin/perl has to be in your PATH.




Hope this helps! Rupam

Tuesday, April 19, 2011

DATAPUMP With PARALLEL > 1 ON 11.2 RAC



Symptoms
Datapump on 11.2 RAC with PARALLEL > 1  hits the following errors


ORA-31693: Table data object "SCOTT"."ESCSTATUS" failed to load/unload and is being skipped do error:
ORA-31617: unable to open dump file "/ora01/oracle/admin/demo/dpdump/demo_expdp_SCOTT.041911_06_02.dmp" for write
ORA-19505: failed to identify file "/ora01/oracle/admin/demo/dpdump/demo_expdp_SCOTT.041911_16_02.dmp"
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3

Cause
From 11.2, Datapump new parameter CLUSTER is introduced.

CLUSTER : Default=Y

Purpose :
Determines whether Data Pump can use Oracle Real Application Clusters (RAC)
resources and start workers on other Oracle RAC instances.

Syntax and Description : CLUSTER=[Y | N]


Solution
To force Data Pump to use only the instance where the job is started and to replicate pre-Oracle Database 11g release 2 (11.2) behavior, specify CLUSTER=N.

Example:
$ expdp hr DIRECTORY=dpump_dir1 DUMPFILE=hr_clus%U.dmp CLUSTER=N PARALLEL=3

Hope this help! Rupam



Sunday, April 03, 2011

How to Change 11gR2 ASM parameter in Non-RAC environment


Steps :
1.      shutdown listener 
2.      shutdown databases
3.      change ASM parameter
4.      shutdown ASM as sysasm
5.      mount ASM
6.      check changed parameter
7.      startup databases as sysasm
8.      check connectivity


Change ASM parameter

sqlplus / as sysasm
  > show parameter proc
NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
processes                            integer     100

> alter system set processes=800 scope=spfile;
System altered.

>  show parameter proc
NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
processes                            integer     100

Shutdown ASM

> shutdown immediate
ASM diskgroups volume disabled
ASM diskgroups dismounted
ASM instance shutdown

Mount ASM

> startup mount
ASM instance started

Total System Global Area  283930624 bytes
Fixed Size                  2225792 bytes
Variable Size             256539008 bytes
ASM Cache                  25165824 bytes
ASM diskgroups mounted
ASM diskgroups volume enabled

Check changed parameter

>  show parameter proc
NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
processes                            integer     800
> exit

 
Hope this helps! Rupam

Friday, April 01, 2011

RMAN Restore Datafile



Steps:
1. identify datafile#  to be recoved
2. plug in the value the restore script
3. execute restore.sh

# rman_file_recover.cmd
run {
  allocate channel t1 type sbt;
  restore datafile 4;
  recover datafile 4;
}

# restore.sh
. ~/.profile
ORACLE_SID=demo;ORAENV_ASK=NO;. oraenv;ORAENV_ASK=YES
cd /ora01/oracle/admin/BACKUP/WKBP
rman nocatalog target / cmdfile rman_file_recover.cmd
status=$?
exit $status
Hope this helps!Rupam

RMAN Restore block



Steps:
1. identify file# and block# to be recoved
2. plug in the value the restore script
3. execute restore.sh

# rman_block_recover.cmd
run {
  allocate channel t1 type sbt;
  BLOCKRECOVER DATAFILE 19 BLOCK 1833660;
}

# restore.sh
. ~/.profile
ORACLE_SID=demo;ORAENV_ASK=NO;. oraenv;ORAENV_ASK=YES
cd /ora01/oracle/admin/BACKUP/WKBP
rman nocatalog target / cmdfile rman_block_recover.cmd
status=$?
exit $status

Hope this helps!Rupam

RMAN commands : quick reference guide


RMAN> list backupset;
RMAN> list backupset of database;
RMAN> list backupset of database completed before '22-NOV-00';
RMAN> list backupset of archivelog all;
RMAN> list backupset of tablespace users;
RMAN> list backupset of datafile 1;

RMAN> list backup summary;
RMAN> list backup;
RMAN> list backup of controlfile;
RMAN> list backup of tablespace SYSTEM;
RMAN> list backup by file;
RMAN> list backup of archivelog all ;

RMAN> list copy of database;
RMAN> list copy of database archivelog all;

RMAN> allocate channel for maintenance type disk;
RMAN> configure channel device type disk clear ;

RMAN> report need backup days=2 database;
RMAN> report need backup days=10 tablespace TEMP;
RMAN> report need backup days=4 datafile 'D:\ORACLE\ORADATA\OR816\TEMP01.DBF';
RMAN> report schema;
RMAN> report obsolete;

RMAN> crosscheck backup;
RMAN> crosscheck backupset;
RMAN> crosscheck copy;
RMAN> crosscheck archivelog all;
RMAN> crosscheck controlfilecopy '/ora01/oracle/admin/BACKUP/demo/demo_controlfile_bak_03-15-11_19:59:11' ;

RMAN> delete noprompt expired backup ;
RMAN> delete noprompt obsolete;
RMAN> delete archivelog all;
RMAN> delete expired archivelog all;
RMAN> delete archivelog all completed before 'sysdate -1';
RMAN> delete noprompt archivelog until time 'sysdate - 1';
RMAN> delete archivelog all backed up 1 times to device type disk completed before 'sysdate-1';

Hope this helps! Rupam