Useful RAC Commands

Check if all nodes are up and running

===========================================
$ CRS_HOME/bin/crs_stat -t


To jump to node 2
=======================
rsh myrac2
$ CRS_HOME/bin/crs_stat -t

How to start/stop nodes
===========================
CRS_HOME/bin/srvctl stop nodeapps -n rac1
CRS_HOME/bin/srvctl start nodeapps -n rac1

How to check Nodes status
==============================
$ srvctl status nodeapps -n rac1
$ ./crs_stat -p ora.myrac1.LISTENER_MYRAC1.lsnr


How to start all nodes and service
======================================
CRS_HOME/bin/crs_start -all

Login as “oracle” user (passward- oracle). 
Open a terminal and execute the following commands:

Status of all instances and services
=====================================
$ srvctl status database -d orcl
Instance orcl1 is running on node node1
Instance orcl2 is running on node ndoe2

Status of a single instance
====================================
$ srvctl status instance -d orcl -i orcl2
Instance orcl2 is running on node node2

Status of a named service globally across the database
====================================================================
$ srvctl status service -d orcl -s orcltest
Service orcltest is running on instance(s) orcl2, orcl1

Status of node applications on a particular node
====================================================
$ srvctl status nodeapps -n node1
VIP is running on node: node1
GSD is running on node: node1
Listener is running on node: node1
ONS daemon is running on node: node1

Status of an ASM instance
===============================
$ srvctl status asm -n node1
ASM instance +ASM1 is running on node node1.

List all configured databases
================================
$ srvctl config database
orcl

Display configuration for our RAC database
==============================================
$ srvctl config database -d orcl
node1 orcl1 /u01/app/oracle/product/10.1.0/db_1
node2 orcl2 /u01/app/oracle/product/10.1.0/db_1

Display all services for the specified cluster database
=====================================================
$ srvctl config service -d orcl
orcltest PREF: orcl2 orcl1 AVAIL:

Display the configuration for node applications - (VIP, GSD, ONS, Listener)
==========================================================
$ srvctl config nodeapps -n node1 -a -g -s -l
VIP exists.: /vip-linux1/192.168.101.5/255.255.255.0/eth0:eth1
GSD exists.
ONS daemon exists.
Listener exists.

Display the configuration for the ASM instance(s)
========================================================
$ srvctl config asm -n node1
+ASM1 /u01/app/oracle/product/10.1.0/db_1



Stopping the Oracle10g RAC Environment
==========================================
The first step is to stop the Oracle instance. 
Once the instance (and related services) is down, then bring down the ASM instance. 
Finally, shutdown the node applications (Virtual IP, GSD, TNS Listener, and ONS).

$ export ORACLE_SID=orcl1
$ lsnrctl stop
$ emctl stop dbconsole
$ srvctl stop instance -d orcl -i orcl1
$ srvctl stop asm -n node1
$ srvctl stop nodeapps -n node1

Starting the Oracle10g RAC Environment
=========================================
The first step is to start the node applications (Virtual IP, GSD, TNS Listener, and ONS). 
Once the node applications are successfully started, 
then bring up the ASM instance. Finally, bring up the Oracle instance (and related services) 
and the Enterprise Manager Database console.

$ export ORACLE_SID=orcl1
$ lsnrctl start
$ srvctl start nodeapps -n node1
$ srvctl start asm -n node1
$ srvctl stop asm -n node1
$ srvctl start instance -d orcl -i orcl1
$ emctl start dbconsole

Start / Stop All Instances with SRVCTL
==============================================
Start / Stop all of the instances and its enabled services. I just included this for fun as a way to bring down all instances!
$ srvctl start database -d orcl

$ srvctl stop database -d orcl

Check CSS/CRS health
=====================
# crsctl start crs (as root)
$ crsctl check crs
$ crsctl start resources

In the affected node, stop all services, login as root user, stop and start the crs

# /etc/init.d/init.crs stop


# /etc/init.d/init.crs start

How to check Listeners
==============================
$ crs_home/bin/crs_stat -v | grep LISTENER
$ crs_unregister ora.myrac2.LISTENER_MYRAC2_MYRAC2.lsnr (unregistering listener)
$ srvctl start listener -n rac2 (start listener)

GoldenGate important commands

How to start goldenGate:
$ cd $GGATE
$ ./ggsci
GGSCI (goldengate2.localdomain) 4> dblogin userid ggate
Password:
Successfully logged into database.
---------display information---------
gg>info all
gg>START MANAGER

How to view current log

GGSCI (goldengate2.localdomain) 20>view ggsevt
GGSCI (goldengate2.localdomain) 20>view report ext1

See information of EXTRACT and REPLICAT

GGSCI (goldengate2.localdomain) 20>info extract ext1
GGSCI (goldengate2.localdomain) 20>info replicat rep1

Deleting Extract group

$ ./ggsci
>dblogin userid ggate
>ggate

delete extract ext1
delete replicat rep1

View Stats:

GGSCI (goldengate1.localdomain) 4> stats EXT1
GGSCI (goldengate *** Total statistics since 2010-10-06 16:14:53 ***
        Total inserts                                1.00
        Total updates                                0.00
        Total deletes                                0.00
        Total discards                               0.00
        Total operations                             1.00 

How to take Top 5 Timed Events

To pull Top 5 Timed Events via AWR Report, follow the below steps:

STEP-1

change directory to $ORACLE_HOME/RDBMS/ADMIN
SQLPLUS sys "/as sysdba"
password:xxxx
SQL>@awrrpt.sql

Current Instance
~~~~~~~~~~~~~~~~

   DB Id    DB Name      Inst Num Instance
----------- ------------ -------- ------------
  258013968 STRM1               1 STRM1

Specify the Report Type ~~~~~~~~~~~~~~~~~~~~~~~ Would you like an HTML report, or a plain text report? Enter 'html' for an HTML report, or 'text' for plain text Defaults to 'html' Enter value for report_type:text

STEP-2

Type Specified:  text

Instances in this Workload Repository schema ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ DB Id Inst Num DB Name Instance Host ------------ -------- ------------ ------------ ------------ * 258013968 1 STRM1 STRM1 streams1.loc aldomain Using 258013968 for database Id Using 1 for instance number Specify the number of days of snapshots to choose from ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Entering the number of days (n) will result in the most recent (n) days of snapshots being listed. Pressing without specifying a number lists all completed snapshots. Enter value for num_days:

STEP-3

Enter value for num_days: 1

Listing the last day's Completed Snapshots

Snap Instance DB Name Snap Id Snap Started Level ------------ ------------ --------- ------------------ ----- STRM1 STRM1 62 07 Sep 2010 00:00 1 63 07 Sep 2010 01:00 1 64 07 Sep 2010 02:00 1 65 07 Sep 2010 03:00 1 66 07 Sep 2010 04:00 1 67 07 Sep 2010 05:00 1 68 07 Sep 2010 06:00 1 69 07 Sep 2010 07:00 1 70 07 Sep 2010 08:00 1 71 07 Sep 2010 09:00 1 72 07 Sep 2010 10:00 1 73 07 Sep 2010 11:00 1 74 07 Sep 2010 12:00 1 Specify the Begin and End Snapshot Ids ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Enter value for begin_snap:

STEP-4

Specify the Begin and End Snapshot Ids
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Enter value for begin_snap: 62
Begin Snapshot Id specified: 62

Enter value for end_snap: 74
End   Snapshot Id specified: 74


Specify the Report Name ~~~~~~~~~~~~~~~~~~~~~~~ The default report file name is awrrpt_1_62_74.txt. To use this name, press to continue, otherwise enter an alternative. test_awrrpt.txt

STEP-5 SQL>exit CAT test_awrrpt.txt

Top 5 Timed Events                                         Avg %Total
~~~~~~~~~~~~~~~~~~                                        wait   Call
Event                                 Waits    Time (s)   (ms)   Time Wait Class
------------------------------ ------------ ----------- ------ ------ ----------
CPU time                                             94          81.0
os thread startup                     1,034          78     75   66.7 Concurrenc
control file parallel write          14,398          34      2   29.5 System I/O
log file parallel write              10,317          33      3   28.0 System I/O
log file sync                         3,828          19      5   16.4     Commit
          -------------------------------------------------------------

Operating System Statistics                 DB/Inst: STRM1/STRM1  Snaps: 62-74
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Statistic                                       Total
-------------------------------- --------------------
BUSY_TIME                                     171,065
IDLE_TIME                                   4,131,681
NICE_TIME                                          21
SYS_TIME                                      149,784
USER_TIME                                      21,260
LOAD                                                0
RSRC_MGR_CPU_WAIT_TIME                              0
PHYSICAL_MEMORY_BYTES                         368,632
NUM_CPUS                                            1
          -------------------------------------------------------------
Statistic                                     Total     per Second     per Trans
-------------------------------- ------------------ -------------- -------------
redo entries                                132,772            3.1          16.4
redo log space requests                           1            0.0           0.0
redo log space wait time                         19            0.0           0.0
redo ordering marks                               0            0.0           0.0
redo size                                40,214,752          930.5       4,970.3
redo synch time                               2,000            0.1           0.3
redo synch writes                            35,766            0.8           4.4
redo wastage                              3,125,620           72.3         386.3
redo write time                               3,394            0.1           0.4
redo writer latching time                         5            0.0           0.0

New Feature 11gR2

Upgrading an Existing Oracle Database 11gR1 to Oracle 11gR2

With a new Oracle 11gR2 database home installed and configured, it's time to run an Oracle 11gR2 single-instance database within that new Oracle home. To accomplish this, I’ve selected one of my original “test bed” Oracle 11gR1 databases as the target of a manual upgrade to the latest release of Oracle (11.2.0.1.0). Preparing to Upgrade Manually. To make this scenario a bit more interesting, I’ll also be upgrading my “test bed” database from a 32-bit Oracle Enterprise Linux (OEL) environment to a corresponding 64-bit OEL environment:

*Copy all the crucial database files – control files, datafiles, tempfiles, and online redo logs – from my 32-bit environment to my 64-bit environment.

* Next, build a new SPFILE from the original 32-bit database’s initialization parameters by first creating a PFILE for that database, copying it over to the target 64-bit environment, and then issuing the CREATE SPFILE FROM PFILE=’/home/oracle/initorcl.ora’; command within SQL*Plus. Remember, it’s necessary to have the database instance completely shut down before an SPFILE can be recreated.

* Next, Start the instance in MOUNT mode – this is most important! – while pointing to the new Oracle 11gR2 database home that’s resident on ACFS storage. I made sure that the control files were recognized during the startup; once I verified this, I shut the database down once again.

* Open the database in STARTUP UPGRADE mode to prepare it for the manual upgrade process, and then I executed procedure script utlirp.sql from directory $ORACLE_HOME/rdbms/admin directory to invalidate all PL/SQL packages in the database. This step insures that all PL/SQL packages will be recompiled during the 32-bit to 64-bit conversion process.

Finish by shutting down the database once again, then start it up in STARTUP UPGRADE mode, spool output to a log file, and then run script utlu112i.sql from the $ORACLE_HOME/rdbms/admin directory to find out what adjustments (if any) were required before I could begin the upgrade.

OTN Discussion Forums: Message List - Database - General

Ask Tom HOT ARTICLES

 
© Copyright 2008 - 2011. All rights reserved to dba-sansar.blogspot.com.
All other blogs, posts and entries are the property of their respective authors.
Please email us for your comments and suggessions Click Here