Amazon Partner

Friday, 1 June 2012

ORACLE RAC FAQ's

Q:- How to change Interconnect Protocol : 

1) Login as Oracle Grid Infrastructure owner
2) Setup oracle Grid HOME
3) Remake ioracle  library with new protocol

To change from default UDP to IPC , issue the following


Prompt> make -f  $ORACLE_HOME/rdbms/lib/ins_rdbms.mk ipc_rds ioracle

Q:-

Wednesday, 30 May 2012

Oracle 11g Dataguard best Practice

Summary of Oracle recommended best practice in Oracle Documentation.

Oracle Data Guard Configuration Best Practices


Use Redo Transport Services Best Practices:

Use SYNC + STANDBY REDO LOG FILE for Zero data loss
Use ASYNC + STANDBY REDO LOG FILE for minimal data loss
Optimize Network Performance


Use RMAN to build Standy

1) With backup availablility on Standby node

Duplicate database for STandby;

2) Without Backup Availablity on STandby node

DUPLICATE DATABASE FOR STANDBY FROM ACTIVE DATABASE;


uSE flashback for Avoid REbuild of Standby after Failover


LOGGING L
USE Force Logging for physical Standby

ALTER DATABASE FORCE LOGGING

USE Supplimental Logging for Logical Standby
ALTER DATABASE FORCE LOGGING;
> ALTER DATABASE ADD SUPPLEMENTAL LOG DATA (PRIMARY KEY, UNIQUE INDEX) COLUMNS;


Specify full log archive format :-
T for thread
S for sequence
R for resetlog id

LOG_ARCHIVE_FORMAT=arch_%T_%S_%R.arc , format might ignored when Flash recovery area is used.



always use VALID_FOR Attribute in Log shipping to avod any changes after switchover.


VALID_FOR=(ONLINE_LOGFILES, PRIMARY_ROLES) DB_UNIQUE_NAME=SALES_stby'


* Always create STandby Redo log files

No of Standby redo log files will be based on formuala.


maximum logfile group +1 * maximum number of thread


for 5 node RAC with 5 groups each node you will need

6 group for each thraed x 5 = 30 Groups.




Set the LOG_ARCHIVE_MAX_PROCESSES Parameter
LOG_ARCHIVE_MAX_PROCESSES = sum(remote_destinations) + count(threads)



Set the Network Configuration and Highest Network Redo Rates

Properly Configure TCP Send / Receive Buffer Sizes:

To achieve high network throughput, especially for a high-latency, high-bandwidth network, the minimum recommended setting for the sizes of the TCP send and receive socket buffers is the bandwidth-delay product (BDP) of the network link between the primary and standby systems. Settings higher than the BDP may show incremental improvement

For example, on Linux, the parameters net.core.rmem_max and net.core.wmem_max limit the socket buffer size and must be set larger than RECV_BUF_SIZE and SEND_BUF_SIZE

Set the send and receive buffer sizes at either the value you calculated or 10 MB, whichever is larger. For example, if bandwidth is 622 Mbits and latency is 30 ms, then you would calculate the minimum size for the RECV_BUF_SIZE and SEND_BUF_SIZE parameters as follows: 622,000,000 / 8 x 0.030 = 2,332,500 bytes. Then, multiply the BDP 2,332,500 x 3 for a total of 6,997,500.

In this example, you would set the initialization parameters as follows:

RECV_BUF_SIZE=6,997,500

SEND_BUF_SIZE=6,997,500


Set TCP.NODELAY to YES



Determine When to Use Redo Transport Compression : only if required and sufficient CPU is available

COLUMN   type ON
FORMAT   a20

COLUMN   UNITS ON
FORMAT   a20

COLUMN   item ON
FORMAT   a30

COLUMN   TIMESTAMP ON
FORMAT   999999999999999999

COLUMN   COMMENTS ON
FORMAT   a20


select * from v$recovery_progress where item like '%Appl%' order by 1

START_TIM TYPE                 ITEM                           UNITS                     SOFAR      TOTAL TIMESTAMP COMMENTS
--------- -------------------- ------------------------------ -------------------- ---------- ---------- --------- --------------------
23-MAY-12 Media Recovery       Last Applied Redo              SCN+Time                      0          0 23-MAY-12 SCN: 66053893415
23-MAY-12 Media Recovery       Average Apply Rate             KB/sec                        7          7
23-MAY-12 Media Recovery       Apply Time per Log             Seconds                       3          3
23-MAY-12 Media Recovery       Active Apply Rate              KB/sec                       13         13
23-MAY-12 Media Recovery       Maximum Apply Rate             KB/sec                       13         13
24-MAY-12 Media Recovery       Last Applied Redo              SCN+Time                      0          0 28-MAY-12 SCN: 66078162035
24-MAY-12 Media Recovery       Average Apply Rate             KB/sec                      626        626
24-MAY-12 Media Recovery       Apply Time per Log             Seconds                      44         44
24-MAY-12 Media Recovery       Active Apply Rate              KB/sec                     2129       2129
24-MAY-12 Media Recovery       Maximum Apply Rate             KB/sec                    22888      22888
24-MAY-12 Media Recovery       Standby Apply Lag              Seconds                      11         11
24-MAY-12 Media Recovery       Redo Applied                   Megabytes                220939     220939
28-MAY-12 Media Recovery       Active Apply Rate              KB/sec                       70          0
28-MAY-12 Media Recovery       Apply Time per Log             Seconds                      56          0
28-MAY-12 Media Recovery       Average Apply Rate             KB/sec                      587          0
28-MAY-12 Media Recovery       Last Applied Redo              SCN+Time                      0          0 30-MAY-12 SCN: 66088268976
28-MAY-12 Media Recovery       Redo Applied                   Megabytes                 88572          0
28-MAY-12 Media Recovery       Maximum Apply Rate             KB/sec                    15961          0
28-MAY-12 Media Recovery       Standby Apply Lag              Seconds                       0          0





Use DB_BLOCK_CHECKING=OFF and Set DB_BLOCK_CHECKSUM=FULL ( if recovery rate meet the minimum requirement)


Set DB_CACHE_SIZE to a Value Greater than on the Primary Database


 Because media recovery does not require DB_KEEP_CACHE_SIZE and DB_RECYCLE_CACHE_SIZE or require a large SHARED_POOL_SIZE, the memory can be reallocated to the DB_CACHE_SIZE. but reducing the Cache size can also be helpful where cache is size big.


Wednesday, 11 January 2012

Useful SQL

I was observing high DFS lock handle wait during Siebel CRM performance testing  and i found below SQL very useful to understand the root cause of Watis.

Output of Query 1 will input to Query 2.

Query1:

SELECT CHR(to_char(bitand(p1,-16777216))/16777215)||CHR(to_char(bitand(p1, 16711680))/65535) "Lock Type",  to_char( bitand(p1, 65535) )    "Lock Mode"
FROM v$session_wait
WHERE event = 'DFS lock handle'
/
Lock Mode
------------------
SV


Query 2:
column name format a20
column type format a5
column DESCRIPTION  format a40
select type,name , description from V$lock_type where type='SV'
/

TYPE  NAME                 DESCRIPTION
----- -------------------- ----------------------------------------
SV    Sequence Ordering    Lock to ensure ordered sequence allocati
                                          on in RAC mode


when Query the V$lock_type we can clearly see type SV mean database having ordered sequence allocation issue in RAC mode.

Thursday, 21 July 2011

Root.sh Failed when installing Grid Infrastructure 11g R2



Problem :

root@host1:>/u01/app/product/grid/11.2.0/root.sh
Running Oracle 11g root script...

The following environment variables are set as:
    ORACLE_OWNER= oracle
    ORACLE_HOME=  /u01/app/product/grid/11.2.0

Enter the full pathname of the local bin directory: [/usr/local/bin]:
The contents of "dbhome" have not changed. No need to overwrite.
The contents of "oraenv" have not changed. No need to overwrite.
The contents of "coraenv" have not changed. No need to overwrite.

Entries will be added to the /etc/oratab file as needed by
Database Configuration Assistant when a database is created
Finished running generic part of root script.
Now product-specific root actions will be performed.
Using configuration parameter file: /u01/app/product/grid/11.2.0/crs/install/crsconfig_params
CRS-4046: Invalid Oracle Clusterware configuration.
CRS-4000: Command Create failed, or completed with errors.
Failure initializing entries in /var/opt/oracle/scls_scr/host1
/u01/app/product/grid/11.2.0/perl/bin/perl -I/u01/app/product/grid/11.2.0/perl/lib -I/u01/app/product/grid/11.2.0/crs/install /u01/app/product/grid/11.2.0/crs/install/rootcrs.pl execution failed

Checking cfgtoollogs file shows $ORACLE_HOME/cfgtoollogs/crsconfig/rootcrs_host1.log
root@host1:>

cd /u01/app/product/grid/11.2.0/cfgtoollogs/crsconfig
tail -10 rootcrs_host1.log
2011-07-21 16:02:26: Executing /u01/app/product/grid/11.2.0/bin/crsctl create scr oracle
2011-07-21 16:02:26: Executing cmd: /u01/app/product/grid/11.2.0/bin/crsctl create scr oracle
2011-07-21 16:02:26: Command output:
>  CRS-4046: Invalid Oracle Clusterware configuration.
>  CRS-4000: Command Create failed, or completed with errors.
>End Command output


Solution:

root@host1:/u01/app/product/grid/11.2.0/crs/install> ./rootcrs.pl -verbose -deconfig -force
Using configuration parameter file: ./crsconfig_params
Usage: srvctl []
    commands: enable|disable|start|stop|status|add|remove|modify|getenv|setenv|unsetenv|config
    objects: database|service|asm|diskgroup|listener|home|ons
For detailed help on each command and object and its options use:
  srvctl -h or
  srvctl -h
PRKO-2012 : nodeapps object is not supported in Oracle Restart
CRS-4046: Invalid Oracle Clusterware configuration.
CRS-4000: Command Stop failed, or completed with errors.
You must kill crs processes or reboot the system to properly
cleanup the processes started by Oracle clusterware
Failure in execution (rc=-1, 0, No such file or directory) for command 1 /sbin/init.d/ohasd deinstall
Successfully deconfigured Oracle clusterware stack on this node
Retry the running root.sh 
root@host1:/u01/app/product/grid/11.2.0/crs/install> cd ..
root@host1:/u01/app/product/grid/11.2.0/crs> cd ..
root@host1:/u01/app/product/grid/11.2.0> /u01/app/product/grid/11.2.0/root.sh
Running Oracle 11g root script...
The following environment variables are set as:
    ORACLE_OWNER= oracle
    ORACLE_HOME=  /u01/app/product/grid/11.2.0
Enter the full pathname of the local bin directory: [/usr/local/bin]:
The contents of "dbhome" have not changed. No need to overwrite.
The contents of "oraenv" have not changed. No need to overwrite.
The contents of "coraenv" have not changed. No need to overwrite.
Entries will be added to the /etc/oratab file as needed by
Database Configuration Assistant when a database is created
Finished running generic part of root script.
Now product-specific root actions will be performed.
Using configuration parameter file: /u01/app/product/grid/11.2.0/crs/install/crsconfig_params
LOCAL ADD MODE
Creating OCR keys for user 'root', privgrp 'sys'..
Operation successful.
OLR initialization - successful
  root wallet
  root wallet cert
  root cert export
  peer wallet
  profile reader wallet
  pa wallet
  peer wallet keys
  pa wallet keys
  peer cert request
  pa cert request
  peer cert
  pa cert
  peer root cert TP
  profile reader root cert TP
  pa root cert TP
  peer pa cert TP
  pa peer cert TP
  profile reader pa cert TP
  profile reader peer cert TP
  peer user cert
  pa user cert
Adding daemon to inittab
CRS-2672: Attempting to start 'ora.mdnsd' on 'host1'
CRS-2676: Start of 'ora.mdnsd' on 'host1' succeeded
CRS-2672: Attempting to start 'ora.gpnpd' on 'host1'
CRS-2676: Start of 'ora.gpnpd' on 'host1' succeeded
CRS-2672: Attempting to start 'ora.cssdmonitor' on 'host1'
CRS-2672: Attempting to start 'ora.gipcd' on 'host1'
CRS-2676: Start of 'ora.gipcd' on 'host1' succeeded
CRS-2676: Start of 'ora.cssdmonitor' on 'host1' succeeded
CRS-2672: Attempting to start 'ora.cssd' on 'host1'
CRS-2672: Attempting to start 'ora.diskmon' on 'host1'
CRS-2676: Start of 'ora.diskmon' on 'host1' succeeded
CRS-2676: Start of 'ora.cssd' on 'host1' succeeded
ASM created and started successfully.
Disk Group OCR created successfully.
clscfg: -install mode specified
Successfully accumulated necessary OCR keys.
Creating OCR keys for user 'root', privgrp 'sys'..
Operation successful.
CRS-4256: Updating the profile
Successful addition of voting disk 149c287d7f844f24bf3499d862694a0f.
Successful addition of voting disk 38d5b5ba93b64f59bf2f105bf50cc838.
Successful addition of voting disk a1325764ae654fa4bf6eb996e33193b6.
Successfully replaced voting disk group with +OCR.
CRS-4256: Updating the profile
CRS-4266: Voting file(s) successfully replaced
##  STATE    File Universal Id                File Name Disk group
--  -----    -----------------                --------- ---------
 1. ONLINE   149c287d7f844f24bf3499d862694a0f (/dev/oradisk/diskocr001) [OCR]
 2. ONLINE   38d5b5ba93b64f59bf2f105bf50cc838 (/dev/oradisk/diskocr002) [OCR]
 3. ONLINE   a1325764ae654fa4bf6eb996e33193b6 (/dev/oradisk/diskocr003) [OCR]
Located 3 voting disk(s).
CRS-2672: Attempting to start 'ora.asm' on 'host1'
CRS-2676: Start of 'ora.asm' on 'host1' succeeded
CRS-2672: Attempting to start 'ora.OCR.dg' on 'host1'
CRS-2676: Start of 'ora.OCR.dg' on 'host1' succeeded
Configure Oracle Grid Infrastructure for a Cluster ... succeeded

Sunday, 20 March 2011

Change DBNAME or DBID using nid Oracle 10g/11g

nid  ---- (NEW ID)

DBNEWID: Release 11.2.0.2.0 - Production on Sun Mar 20 22:17:55 2011
Keyword Description (Default)
----------------------------------------------------
TARGET Username/Password (NONE)
DBNAME New database name (NONE)
LOGFILE Output Log (NONE)
REVERT Revert failed change NO
SETNAME Set a new database name only NO
APPEND Append to output log NO
HELP Displays these messages NO

To Change Database ID/NAME :
1) Database must be mounted exclusively, if run command in other status you will get the following error

NID-00120: Database should be mounted exclusively

If you running RAC , you need to stop all the nodes and set CLUSTER_DATABASE=FALSE ,before restarting the database instance in mount state.

2) nid TARGET=sys/password@TNSENTRY



Thursday, 10 February 2011

Building Standby database ( without backup) from Primary Database

Oracle 11g has many feature which allow DBA's manage there database more esily and quickly. One of the feature which made DBA's life much easy is build standby database without backup i.e. building from Primary/Active Database.

This feature comes with following benifits.
* No Need to backup
* NO need to sheep backup to Standby server,
* No hessle of Mounting backup to Standby server as nfs or anything like that.

Building standby database is done using RMAN command DUPLICATE which we used before to duplicate database.


Step by Step.

1. Create pfile from spfile on the primay database.

2. scp pfile to new server.
3. edit pfile
4. Create spfile
5. startup nomount;
6. Create listener and Tnsnames.
7. Start standby database using RMAN duplicate database
$ rman

Recovery Manager: Release 11.2.0.2.0 - Production on Thu Feb 10 22:18:23 2011
Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.

RMAN> CONNECT TARGET SYS/password@DB_DG_SITEB
connected to target database: DBPRD (DBID=39856714)

RMAN> Connect auxiliary SYS/password@DB_DG_SITEA
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-04006: error from auxiliary database: ORA-01031: insufficient privileges

Above error occured if you forget to copy password file from primary site.
Fix this by coping password file from primary/production site.

SITEA>scp $ORACLE_HOME/dbs/orapwDBPRD1 oracle@SITEB:$ORALE_HOME/dbs/orapwDBPRD1

RMAN> Connect auxiliary SYS/password@DB_DG_SITEA
connected to auxiliary database: DBPRD (not mounted)




DUPLICATE TARGET DATABASE
FOR STANDBY
FROM ACTIVE DATABASE;

Thursday, 3 February 2011

Ho to Manually Configure Database Vault Administrator Configuration for Grid Control


Deploying Database Vault Administrator to the Database Console OC4J Container

To manually deploy Database Vault Administrator to the Database Console OC4J container:
  1. Stop Oracle Database Console.
    • UNIX: Go to the $ORACLE_HOME/bin directory and run the following command:
      ./emctl stop dbconsole
      
    • Windows: In the Administrative Services, select the Services utility, and then right-click the OracleDBConsolesid service. Select Stop from the menu.
  2. Create a backup copy and then open the $ORACLE_HOME/oc4j/j2ee/OC4J_DBConsole_service_name/config/server.xml file.
  3. Add the following line before the  element:
    
    
    On Windows systems, replace $ORACLE_HOME with the absolute path to your Oracle Database home.
  4. Create a backup copy and then open the $ORACLE_HOME/oc4j/j2ee/OC4J_DBConsole_service_name/config/http-web-site.xml file.
  5. Add the following line before the element:
    
    
  6. Restart Oracle Database Console.
    • UNIX: Go to the $ORACLE_HOME/bin directory and run the following command:
      ./emctl start dbconsole
      
    • Windows: In the Administrative Services, select the Services utility, and then right-click the OracleDBConsolesid service. Select Start from the menu.
After you complete these steps, you can start Oracle Database Vault Administrator by using the following URL:
https://hostname:port/dva
For example:
https://myserver:1158/dva
If you are unsure of the port number, open the ORACLE_HOME/host_sid/sysman/config/emd.properties file and search for REPOSITORY_URL. In most cases, the host name and port number are the same as Oracle Enterprise Manager Database Control.