Wednesday, May 18, 2011

crsctl Commands


Checking CRS Status:
crsctl check crs   <<--  for the local node
crsctl check cluster  <<--  for remote nodes in the cluster
[root@node1-pub ~]#   crsctl check cluster
                                     node1-pub    ONLINE
                                     node2-pub    ONLINE
 
Viewing Cluster name:
ocrdump -stdout -keyname SYSTEM | grep -A 1 clustername | grep ORATEXT | awk '{print $3}'
OR
Oracle creates a directory with the same name as Cluster under the $ORA_CRS_HOME/cdata.

[root@node1-pub ~]#   ls /u01/app/crs/cdata


Viewing No. Of Nodes configured in Cluster:
olsnodes -n -p –I   this also displays 3 IP’s

[root@node1-pub ~] #   olsnodes -n -p -i 
node1-pub       1       node1-prv       node1-vip
node2-pub       2       node2-prv       node2-vip

Viewing Votedisk Information:         crsctl query css votedisk
Viewing OCR Disk Information:   ocrcheck

Status of Oracle Cluster Registry is as follows :
         Version                  :          2
         Total space (kbytes)     :     262120
         Used space (kbytes)      :       3848
         Available space (kbytes) :     258272
         ID                       :  744414276
         Device/File Name         : /u02/ocfs2/ocr/OCRfile_0
                                    Device/File integrity check succeeded
         Device/File Name         : /u02/ocfs2/ocr/OCRfile_1
                                    Device/File integrity check succeeded

Various Timeout Settings in Cluster:
crsctl get css disktimeout
crsctl get css misscount
crsctl get css  reboottime

Add/Remove OCR file in Cluster:
Removing OCR File:              ocrconfig -replace ocrmirror
                                                 ocrconfig -replace ocr

Adding OCR :
1)    Get the Current status of OCR:    ocrcheck
2)    As you can see, I only have one OCR file but not the second file which is OCR Mirror.
So, I can add second OCR (OCR Mirror) as below command. 

ocrconfig -replace ocrmirror <File name>

Add/Remove Votedisk file in Cluster:
Adding Votedisk:
1)     Stop CRS on all the nodes in cluster but one.

                              crsctl stop crs

2)     Get the list of Existing Vote Disks
                      crsctl query css votedisk
    3)  Backup the Vote Disk file

             dd  if=/u02/ocfs2/vote/VDFile_0  of=$ORACLE_BASE/bkp/vd/VDFile_0
    4)  Add an Extra Votedisk into the Cluster:
            crsctl add css votedisk /u02/ocfs2/vote/VDFile_3 <<-- as oracle
     5) Confirm that the file has been added successfully:

               [root@node1-pub ~] #  ls –l /u02/ocfs2/vote/VDFile_3

Removing Votedisk:         crsctl delete css votedisk /u02/ocfs2/vote/VDFile_3
Backing Up OCR

Oracle performs physical backup of OCR devices every 4 hours under the default backup direcory $ORA_CRS_HOME/cdata/<CLUSTER_NAME> 
and then it rolls that forward to Daily, weekly and monthly backup.
 
                                ocrconfig –showbackup

Manually backing up the OCR :
ocrconfig -manualbackup      --->>>Physical Backup of OCR
You can export the contents of the OCR using below command (Logical backup).
ocrconfig -export /tmp/ocr_exp.dat -s online   ----->>>Logical Backup of OCR

Restoring OCR:       ocrconfig -restore <file name>
Locate the avialable Backups:      ocrconfig –showbackup

Perform Restore from previous Backup
[root@node2-pub ~]#   ocrconfig -restore /u01/app/crs/cdata/test-crs/week.ocr
If you have logical backup of OCR (taken using export option).

ocrconfig  -import /tmp/ocr_exp.dat
Restoring Votedisks
·         Shutdown CRS on all the nodes in Cluster.
·         Locate the current location of the Votedisks
·         Restore each of the votedisks using "dd" command from the previous good backup of Votedisk taken using the same "dd" command.
·         Start CRS on all the nodes.
crsctl stop crs
crsctl query css votedisk
dd if=<backup of Votedisk> of=<Votedisk file>     à>>>do this for all the votedisks
crsctl start crs



Friday, May 13, 2011

Automatic Memory Management(AMM)


In Oracle10g we need to set TWO parameter for automatic memory management.
1. SGA_TARGET = xxx G
2. PGA_AGGREGATE_TARGET = xxx G
then oracle will automatically allocated size for Buffer cache, Shared pool, large pool etc.

             Now In Oracle 11g will reduce two parameter (SGA_TARGET, PGA_AGGREGATE_TARGET) and introduce one new parameter called "MEMORY_TARGET". Which use for SGA or PGA size configuration.
When we specify MEMORY_TARGET parameter for instance then we no need to specify SGA_TARGET or PGA_AGGREGATE_TARGET parameter for memory configuration. Oracle will automatically allocate memory for memory parameter.

How to enable automatic memory management?
As previous parameter SGA_MAX_SIZE in 11g also one new parameter MEMORY_MAX_TARGET which is maximum limit for instance memory for oracle database.

SQL> alter system set memory_max_target=200M scope=SPFILE;
System altered.


 

 

 AMM Configuration

The Database Configuration Assistant (DBCA) allows you to configure automatic memory management during database creation

AMM Tuning

In addition to the existing memory management V$ views, Oracle 11g includes four new V$ views to support automatic memory management:
  • V$MEMORY_CURRENT_RESIZE_OPS
  • V$MEMORY_DYNAMIC_COMPONENTS
  • V$MEMORY_RESIZE_OPS
  • V$MEMORY_TARGET_ADVICE
The amount of memory allocated to each dynamic component is displayed using the V$MEMORY_DYNAMIC_COMPONENTS view.
The V$MEMORY_CURRENT_RESIZE_OPS and V$MEMORY_RESIZE_OPS views provide information on current and previous component resize operations.
The V$MEMORY_TARGET_ADVICE view provides information to help tune the MEMORY_TARGET parameter. It displays a range of possible MEMORY_TARGET settings, as factors of the current setting, and estimates the potential DB Time to complete the current workload based on these memory sizes.



Auto Scroll Stop Scroll