Removing node from RAC Cluster















 **Host names etc changed.



Stop all Process running on the Database home     




srvctl stop instance -d rpap_gdc2 -n prsodb02

srvctl disable  instance -d rpap_gdc2 -n prsodb02



RELOCATE ALL SERVICES HAVING NODE 2 AS PREFERRED OR AVAILABLE


srvctl modify  service -s customer_pdb.scc.local -d rpap_gdc2  -modifyconfig  -preferred "rpap1"

srvctl modify  service -s lms_pdb.scc.local -d rpap_gdc2  -modifyconfig  -preferred "rpap1"

srvctl modify  service -s osmm.scc.local -d rpap_gdc2  -modifyconfig  -preferred "rpap1"

srvctl modify  service -s pdb1p_pdb.scc.local -d rpap_gdc2  -modifyconfig  -preferred "rpap1"

srvctl modify  service -s batch_service -d rpap_gdc2  -modifyconfig  -preferred "rpap1"



Ensure that the instance to be removed from the database is neither a preferred nor an available instance of any service



srvctl config service –s  customer_pdb.scc.local -d rpap_gdc2 

srvctl config service –s lms_pdb.scc.local -d rpap_gdc2 

srvctl config service –s  s osmm.scc.local -d rpap_gdc2 

srvctl config service –s pdb1p_pdb.scc.local -d rpap_gdc2 

srvctl config service –s s batch_service -d rpap_gdc2 





DELETE THE DATABASE INSTANCE USING DBCA SILENT MODE


dbca -silent -responseFile deleterpap2.rsp




Verify that the dropped instance's redo thread has been removed by using SQL*Plus on an existing node to query the GV$LOG view. If the redo thread is not disabled, then disable the thread. For example:

 ALTER DATABASE DISABLE THREAD 2;

Verify that the instance has been removed from OCR by running the following command, where db_unique_name is the database unique name for your Oracle RAC database:

 srvctl config database -d rpap_gdc2



UPDATE INVENTORY ON prsodb02 TO REFLECT NODE TO BE DELETED


Run the following command from $ORACLE_HOME/oui/bin on the node that you are deleting to update the inventory on that node:

 ./runInstaller -updateNodeList ORACLE_HOME= /u01/app/oracle/product/12.1.0.1/dbhome_1 "CLUSTER_NODES={prsodb02}" -local



DEINSTALL ORACLE HOME ON prsodb02


Deinstall the Oracle home—only if the Oracle home is not shared—from the node that you are deleting by running the following command from the Oracle_home\deinstall directory:

 deinstall -local



UPDATE THE INVENTORY ON prsodb01 To REFLECT REMAINING NODE


 


Run the following command from the $ORACLE_HOME/oui/bin directory on any one of the remaining nodes in the cluster to update the inventories of those nodes, specifying a comma-delimited list of remaining node names and the name of the local node:

  ./runInstaller -updateNodeList ORACLE_HOME=/u01/app/oracle/product/12.1.0.1/dbhome_1

"CLUSTER_NODES={ prsodb01}"  LOCAL_NODE= prsodb01







 


REMOVE GRID HOME




Stop and DISABLE THE listener process


srvctl stop listener -l listener  -n prsodb02

 srvctl disable listener -l listener  -n prsodb02

UPDATE INVENTORY ON prsodb02 TO REFLECT NODE TO BE DELETED


On the node you want to delete, run the following command as the user that installed Oracle Clusterware from the Grid_home/oui/bin directory where node_to_be_deleted is the name of the node that you are deleting:

  ./runInstaller -updateNodeList ORACLE_HOME= /u01/app/12.1.0.1/grid "CLUSTER_NODES={

prsodb02}" CRS=TRUE -silent -local



DEINSTALL GRID HOME ON prsodb02


For a local home, deinstall the Oracle Clusterware home from the node that you want to delete, as follows, by running the following command, where Grid_home is the path defined for the Oracle Clusterware home:

  Grid_home/deinstall/deinstall –local



UPDATE THE INVENTORY ON prsodb01 To REFLECT REMAINING NODE




On any node other than the node you are deleting (except for a Leaf Node in an Oracle Flex Cluster), run the following command from the Grid_home/oui/bin directory where remaining_nodes_list is a comma-delimited list of the nodes that are going to remain part of your cluster:

./runInstaller -updateNodeList ORACLE_HOME== /u01/app/12.1.0.1/grid  "CLUSTER_NODES={ prsodb01}" CRS=TRUE -silent



REMOVE DELETED NODE FROM OCR


From any node that you are not deleting, run the following command from the Grid_home/bin directory as root to delete the node from the cluster:

  crsctl delete node -n prsodb02

Run the following CVU command to verify that the specified nodes have been successfully deleted from the cluster:

  cluvfy stage -post nodedel -n prsodb01 -verbose



If you remove a cluster node on which Oracle Clusterware is down, then determine whether the VIP for the deleted node still exists, as follows:

 srvctl config vip -node prsodb02



If the VIP still exists, then delete it, as follows:

  srvctl stop vip -node prsodb02

  srvctl remove vip -node prsodb02

Cluster Health Diagnostic

This is proving very useful - more to follow.

[grid@ORA01 ~]$ chactl query diagnosis -start "2018-12-31 00:00:00" -end "2019-01-08 23:59:00" -htmlfile ~/chaprob.html

Oracle sysdate / timestamp etc.


This just a reminder to myself when outputting date / time  in oracle.

Loads of possibilities to achieve this - one solution.

Standard sysdate output (limited to date only but pain when you want the time too)...

SQL> select sysdate from dual;

SYSDATE
---------
07-JAN-19

Could use the cast function to change the type to timestamp so more detail to include time

SQL> select CAST(sysdate as timestamp) from dual;

CAST(SYSDATEASTIMESTAMP)
---------------------------------------------------------------------------
07-JAN-19 09.37.41.000000 AM

more control alter session and pick the format you want....

SQL> alter session set nls_date_format = 'DD-MON-YYYY HH24:MI:SS';

Session altered.

SQL> select sysdate from dual;

SYSDATE
--------------------
07-JAN-2019 09:37:54


Break a table down into counts by month for a date column :

SQL> select count(REQ_TIMESTAMP), to_char(trunc REQ_TIMESTAMP),'MM-YYYY') from REQ_LOG group by to_char(trunc(REQ_TIMESTAMP),'MM-YYYY');

COUNT(REQUEST_TIMESTAMP) TO_CHAR
------------------------ -------
2740644  04-2019
3978        02-2019
3604984  05-2019
or...

SQL> select count(*),trunc(REQ_TIMESTAMP,'MM') from REQ_LOG group by trunc(REQ_TIMESTAMP,'MM');

COUNT(*) TRUNC(INS
---------- ---------
2740644  01-APR-19
3978        01-FEB-19
3604984  01-MAY-19

SQL> delete from EC_MAIN.API_REQUEST_LOG where trunc(INSERTED_DTM,'MM') = '01-FEB-19';

3978 rows deleted.