Tuesday, November 13, 2018

RAC crsctl commands

For checking SYNTAX of any crsctl command on server - type command crsctl and then enter

>> crsctl commands to be run by root user
If you want to know the GRID home location, just do
ps -ef | grep d.bin >> You will find the cluster running processes GRID HOME location

crsctl stop crs >> Stop cluster on local node
crsctl start crs >> Start cluster on local node

crsctl stop cluster -all >> To stop cluster on all nodes part of cluster, OHASD will be running only and can be stopped by below command on all nodes

crsctl stop has >> To stop HAS on local node

crsctl enable crs >> ENABLE autostart of cluster after server reboot
crsctl disable crs >> DISABLE autostart of cluster after server reboot


>> Below commands can be run by root / grid owner

crsctl check crs >> To see CRS status on local node
crsctl check cluster -all >> To see cluster status on all the nodes part of Cluster

crsctl stat res -t >> To see all cluster resource status
crsctl stat res <<resource_name>> -t >> To see status of specific resource
crsctl query cssvotedisk >> To see the voting file details
ocrcheck >> To check the OCR location
ocrconfig -showbackup >> To show backup status of OCR
ocrconfig -manualbackup >> To take manual backup of OCR



Below commands to be used to adding / modifying resource of cluster
crsctl add resource -help
crsctl modify resource -help


We can use below command to see the detailed attributes of resource

crsctl stat res <<resource_name>> -p

Wednesday, November 7, 2018

RMAN Catalog de-register unused database

Below are the steps of one method that you can use to remove old db entries from RMAN catalog database.

+++++++++++++++++++++++++++++
oracle@target2300:~> sqlplus / as sysdba

SQL*Plus: Release 12.1.0.2.0 Production on Mon Nov 5 02:09:26 2018

Copyright (c) 1982, 2014, Oracle.  All rights reserved.


Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Advanced Analytics and Real Application Testing options

SQL> -- connect to RMAN Catalog user
SQL> connect rman/backup
Connected.
SQL> SELECT db_key, dbid, name FROM rc_database WHERE name = 'TestingDBA';

    DB_KEY       DBID NAME
---------- ---------- --------
   1450377 1874538921 TestingDBA
   3256317 1885700034 TestingDBA
  28091447 1903574000 TestingDBA
  28805999 1903892800 TestingDBA

SQL>  SELECT db_key, dbid, name FROM rc_database WHERE name like 'TestingDB%';

    DB_KEY       DBID NAME
---------- ---------- --------
  41927688  826894727 TestingDBBETA
   1450377 1874538921 TestingDBA
   3256317 1885700034 TestingDBA
  28091447 1903574000 TestingDBA
  34396606 3955608007 TestingDBALFA
  34400693 1392119613 TestingDBBETA
  28805999 1903892800 TestingDBA

7 rows selected.

SQL> EXECUTE dbms_rcvcat.unregisterdatabase(1450377,1874538921);

PL/SQL procedure successfully completed.

SQL> EXECUTE dbms_rcvcat.unregisterdatabase(3256317,1885700034);

PL/SQL procedure successfully completed.

SQL> EXECUTE dbms_rcvcat.unregisterdatabase(28091447,1903574000);

PL/SQL procedure successfully completed.

SQL> EXECUTE dbms_rcvcat.unregisterdatabase(28805999,1903892800);

PL/SQL procedure successfully completed.

SQL> SELECT db_key, dbid, name FROM rc_database WHERE name like 'TestingDB%';

    DB_KEY       DBID NAME
---------- ---------- --------
  41927688  826894727 TestingDBBETA
  34396606 3955608007 TestingDBALFA
  34400693 1392119613 TestingDBBETA