Sunday, August 15, 2010

RAC

For Oracle RAC installations:
a. Start the database as follows, where db_name is the database name:

$ srvctl start database -d db_name


To stop and start 10g rac database (10g crs )
Database:
server1: login as oraprod
srvctl stop database -d PROD
lsnrctl stop LISTENER_server1

server2: login as oraprod
lsnrctl stop LISTENER_server2

server3: login as oraprod
lsnrctl stop LISTENER_server3

CRS:

server1, server2, server3: login as root
/d02/oracrs/prodcrs/10.2.0/bin/crsctl stop crs

-Repeat above steps on all servers indicated above

start procedure
CRS:

server1, server2, server3: login as root
/d02/oracrs/prodcrs/10.2.0/bin/crsctl start crs

-Repeat above steps on all servers indicated above


Database:

server1: login as oraprod
---> DO NOT START MANUALLY, CRS SHOULD START IT UP AUTOMATICALLY.
---> IF CRS FAILS TO STARTUP THE DB, EXECUTE: srvctl start database -d PROD
lsnrctl start LISTENER_server1

server2: login as oraprod
lsnrctl start LISTENER_server2

server3: login as oraprod
lsnrctl start LISTENER_server3

crs commands
crs_stat -t :Show HA resource status (hard to read)
crsstat :Ouptut of crs_stat รข€“t formatted better
ps -ef|grep d.bin :crsd.bin evmd.bin ocssd.bin
crsctl check crs :css, crs, evm appear healthy
crsctl stop crs :Stop crs and all other services
crsctl disable crs :Prevent crs from starting on reboot
crsctl enable crs :Enable crs start on reboot
crs_stop -all :Stop everything
crs_start -all :Start everything

Go to following location and check the current CRS version.
cd /CRS/app/10.2.0/bin
./crsctl query crs softwareversion
./crsctl query crs activeversion



To configure AutoConfig to generate the failover aliases
To generate the failover aliases use the database tier context variable s_alt_service_instances.
Specify a comma separated list of "servicename:instance" to use connect time failover management.

For example 'SERVICE_NAME:INSTANCE_NAME1,SERVICE_NAME:INSTANCE_NAME2' will generate a TNS Alias in the tnsnames.ora file that fails over to INSTANCE_NAME1 when the current instance is not available. If INSTANCE_NAME1 is not available it fails over to INSTANCE_NAME2.

So Update the context variable s_alt_service_instances in the database tier context file applying the failover rules as described above.
Run AutoConfig on all database tiers.
Run AutoConfig on all application tiers.
These steps will generate tns aliases _FO with description lists as configured in s_alt_service_instances. These aliases will still not be used anywhere. Have to set the two task variables like s_tool_twotask to actually use these aliases.

Note: On database versions that are 8.1.7.4 or higher the generated alias _FO can only be used for failover. On 8.0.6 the generated alias can't be used for failover. However, it can be used for load balancing.

undo for rac
RAC01.undotablespace=undotbs3
RAC02.undotablespace=undotbs2
alter system set undo_tablespace=undotbs1 sid='RAC01';

Threads in rac
RAC01.thread=1
RAC02.thread=2
alter database add logfile thread 2 group 4
alter databse add logfile thread 2 group 5
alter database enable thread 2


srvctl command
srvctl start instance -d RACDB -i RACDB1,RACDB2
srvctl stop instance -d RACDB -i RACDB1,RACDB2
srvctl start database -d RACDB -o open

srvctl start|stop instance -d -i
[-o open|mount|nomount|normal|transactional|immediate|abort]
[-c connect_str | -q]

srvctl start|stop database -d
[-o open|mount|nomount|normal|transactional|immedaite|abort]
[-c connect_str | -q]

srvctl modify database -d RACDB -y manual

Here are some of the commands for managing database-related services:
srvctl start instance -d orcl -i orcl2 :Start an instance
srvctl start database -d orcl :Start all instances
srvctl stop database -d orcl :Stop all instances and close database
srvctl stop instance -d orcl -i orcl2 :Stop an instance
srvctl start service -d orcl -s rac :Start a service
srvctl stop service -d orcl -s rac :Stop a service
srvctl status service -d orcl :Check status of a service
srvctl status instance -d orcl -i orcl1 :Check an individual instance
srvctl status database -d orcl :Check status of all instances
srvctl start nodeapps -n server1 :Start gsd, vip, listener, and ons.
srvctl stop nodeapps -n server2 :Stop gsd, vip, listener, and ons
For help with all commands:
srvctl -h

For Detailed Help:
srvctl start database -h
srvctl add service -h
srvctl relocate service –h


Check out current configuration information:
srvctl config database
Displays the configuration information of the cluster database.

srvctl config service
Displays the configuration information for the services.

srvctl config nodeapps
Displays the configuration information for the node applications.

srvctl config asm
Displays the configuration for the ASM instances on the node.

To look for all the registered services for a database:
srvctl config service -d DBATOOLS

To get VIP information:
srvctl config nodeapps -n xxxx708 -a

VIP exists.: /xxxx708-vip/xx.xxx.xx.xx/xxx.xxx.xxx.0/eth4

or

ifconfig -a

Look for interface with two IPs
When node 1 comes back up, it will start it’s CRS stack. It will take back
it’s VIP. In order to fail the service back, you would need to run
srvctl relocate
The following example is relocating the service from node 2 back to node 1:

srvctl relocate service -d V10SN -s SRV_AVAIL -i V10SN2 -t V10SN1

To Forcefully remove a database from the OCR

srvctl remove database with -f (force option):
Then use belwo to add again
srvctl add database -d DB -o $­ORACLE_HOME



alter parameter on rac db
alter system set dpname SCOPE=MEMORY sid='sid|*';
alter system RESET dpname SCOPE=MEMORY sid='sid';


Stop/Start Oracle RAC

1. Stop Oracle 10g on one of RAC nodes.
$ export ORACLE_SID=RAC1
$ srvctl stop instance -d RAC -i RAC1
$ srvctl stop asm -n orarac1
$ srvctl stop nodeapps -n orarac1

2. Start Oracle 10g on one of RAC nodes.
$ export ORACLE_SID=RAC1
$ srvctl start nodeapps -n orarac1
$ srvctl start asm -n orarac1
$ srvctl start instance -d RAC -i RAC1

3. Stop/start Oracle 10g on all RAC nodes.
$ srvctl stop database -d RAC
$ srvctl start database -d RAC


Check status of Oracle RAC
$ srvctl status database -d RAC
Instance RAC1 is running on node orarac1
Instance RAC2 is running on node orarac2

$srvctl status instance -d RAC -i RAC1
Instance RAC1 is running on node orarac1

$srvctl status asm -n orarac1
ASM instance +ASM1 is running on node orarac1

$srvctl status nodeapps -n orarac1
VIP is running on node: orarac1
GSD is running on node: orarac1
PRKO-2016 : Error in checking condition of listener on node: orarac1
ONS daemon is running on node: orarac1


Check Oracle Listener on nodes
$ srvctl config listener -n orarac1
orarac1 LISTENER_ORARAC1
$ lsnrctl start LISTENER_ORARAC1

Check configuration of ORACLE RAC,ASM,nodeapps
$srvctl config database -d RAC
orarac1 RAC1 /space/oracle/product/10.2.0/db_2
orarac2 RAC2 /space/oracle/product/10.2.0/db_2

$srvctl config asm -n orarac2
+ASM2 /space/oracle/product/10.2.0/db_2

$srvctl config nodeapps -n orarac1 -a -g -s -l
VIP exists.: /orarac1-vip.abc.lan/xx.xx.xx.xx/xxx.xxx.xxx.x/Public
GSD exists.
ONS daemon exists.
Listener exists.


Check, backup, restore OCR
$ocrconfig -showbackup

$ocrconfig -export /data/backup/rac/ocrdisk.bak

To restore OCR, it must stop Clusterware on all nodes before.
$ocrconfig -import /data/backup/rac/ocrdisk.bak

$cluvfy comp ocr -n all //verification

$ocrcheck //check OCR disk usage

No comments: