rac
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revision | |||
| rac [2018/12/08 12:49] – created 0.0.0.0 | rac [2019/01/30 11:32] (current) – external edit 127.0.0.1 | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| - | ====== RAC ====== | + | ==== Oracle |
| + | * [[https:// | ||
| + | * [[http:// | ||
| + | * [[https:// | ||
| + | Real Application Clusters (RAC) is an clustering solution whereby multiple Oracle instances can communicate with one database located on shared storage.\\ | ||
| + | Datafiles and controlfiles are shared but each instance will have its own redo log files and undo tablespace.\\ | ||
| + | Use crsctl to manage the clusterware\\ | ||
| + | Use srvctl to manage the cluster\\ | ||
| - | =====Oracle RAC Overview===== | + | |
| - | | + | * [[http:// |
| - | Real Application Clusters (RAC) is an clustering solution whereby multiple Oracle instances can communicate with one database located on shared storage.< | + | Know nothing about RAC? Go through the RAC Attack labs step-by-step installation for [[https:// |
| - | Datafiles and controlfiles are shared but each instance will have its own redo log files and undo tablespace.< | + | or [[https:// |
| - | Use crsctl to manage the clusterware< | + | * [[RAC Attack template]] |
| - | Use srvctl to manage the cluster< | + | ==== How to Backup and Restore a RAC Database ==== |
| - | <br /> | + | * [[https:// |
| - | * [[https:// | + | ==== RAC components ==== |
| - | * [[http:// | + | === Virtual IP === |
| - | Know nothing about RAC? Go through the RAC Attack labs step-by-step installation for [[https:// | + | |
| - | or [[https:// | + | |
| - | * [[RAC Attack template]] | + | |
| - | =====How to Backup and Restore a RAC Database===== | + | |
| - | * [[https:// | + | |
| - | =====RAC components===== | + | |
| - | ====Virtual IP==== | + | |
| A virtual IP address is an IP address setup to " | A virtual IP address is an IP address setup to " | ||
| - | ====Voting Disk==== | + | === Voting Disk === |
| - | A Voting Disk is a file on a shared filesystem. It maintains a list of available cluster nodes and can resolve split-brain scenarios.<br /> | + | A Voting Disk is a file on a shared filesystem. It maintains a list of available cluster nodes and can resolve split-brain scenarios.\\ |
| All instances write to the voting disk to indicate that they are still active. | All instances write to the voting disk to indicate that they are still active. | ||
| - | ====Cluster Registry==== | + | === Cluster Registry === |
| The Cluster Registry (OCR) is used to store cluster wide settings and status information such as node names, IP and VIP addresses, voting disk locations, node applications, | The Cluster Registry (OCR) is used to store cluster wide settings and status information such as node names, IP and VIP addresses, voting disk locations, node applications, | ||
| - | ====Clusterware processes==== | + | === Clusterware processes === |
| - | A RAC cluster consists of the following daemons<br /> | + | A RAC cluster consists of the following daemons\\ |
| - | * crsd – Cluster Resource Services Daemon | + | * crsd – Cluster Resource Services Daemon |
| - | * cssd – Cluster Synchronisation Services Daemon | + | * cssd – Cluster Synchronisation Services Daemon |
| - | * evmd – Event Manager Daemon | + | * evmd – Event Manager Daemon |
| - | =====RAC commands===== | + | ==== RAC commands ==== |
| - | ====Location of Oracle Local Registry configuration file (olr.loc)==== | + | === Location of Oracle Local Registry configuration file (olr.loc) === |
| This file points to the clusters local node repository and depending on the OS, it is in one of these 2 locations | This file points to the clusters local node repository and depending on the OS, it is in one of these 2 locations | ||
| - | < | + | < |
| + | cat / | ||
| + | cat / | ||
| + | </ | ||
| This file is managed by OHASD and will point to the olrconfig_loc and the crs_home | This file is managed by OHASD and will point to the olrconfig_loc and the crs_home | ||
| - | ====Location of cluster config files==== | + | === Location of cluster config files === |
| - | < | + | < |
| + | / | ||
| + | </ | ||
| - | ====Some cluster control commands to check the status / health of the clusterware==== | + | === Some cluster control commands to check the status / health of the clusterware === |
| - | < | + | < |
| - | ====List network interfaces available to this cluster node==== | + | crsctl status resource -t |
| - | < | + | crsctl status server |
| - | ====Is Oracle Restart (High Availability Service) enabled?==== | + | crsctl check cluster |
| - | < | + | crsctl check crs |
| + | crsctl query css votedisk | ||
| + | crsctl query crs activeversion | ||
| + | crsctl query crs releaseversion | ||
| + | crsctl query crs softwareversion | ||
| + | </ | ||
| + | === List network interfaces available to this cluster node === | ||
| + | < | ||
| + | oifcfg iflist -p | ||
| + | </ | ||
| + | === Is Oracle Restart (High Availability Service) enabled? === | ||
| + | * [[https:// | ||
| + | < | ||
| + | cat / | ||
| + | crsctl check has | ||
| + | crsctl config has | ||
| + | crsctl start has | ||
| + | crsctl stop has | ||
| + | crsctl disable has | ||
| + | crsctl enable has | ||
| + | </ | ||
| - | ====Is ASM autostart enabled?==== | + | === Is ASM autostart enabled? === |
| - | < | + | < |
| - | ====Are diskgroups registered?==== | + | crsctl stat res ora.asm |
| - | < | + | </ |
| - | ====Is database registered and autostart enabled?==== | + | === Are diskgroups registered? === |
| - | < | + | < |
| + | srvctl status diskgroup -g DATA | ||
| + | crsctl stat res ora.DATA.dg | ||
| + | </ | ||
| + | === Is database registered and autostart enabled? === | ||
| + | < | ||
| + | srvctl config database -d < | ||
| + | </ | ||
| if not... | if not... | ||
| - | < | + | < |
| - | ====Set ASM diskgroups to be used by database==== | + | srvctl add database < |
| - | < | + | srvctl enable database < |
| - | ====Stop and start the clusterware services==== | + | </ |
| + | === Set ASM diskgroups to be used by database === | ||
| + | < | ||
| + | srvctl modify database -d < | ||
| + | </ | ||
| + | === Stop and start the clusterware services === | ||
| To set the correct home, can also search /etc/oratab for the relevant ASM instance and use . oraenv | To set the correct home, can also search /etc/oratab for the relevant ASM instance and use . oraenv | ||
| - | < | + | < |
| + | export ORA_CRS_HOME=$(awk -F: '/ | ||
| + | $ORA_CRS_HOME/ | ||
| + | $ORA_CRS_HOME/ | ||
| + | </ | ||
| - | =====Prevent cluster services from starting up on boot===== | + | ==== Prevent cluster services from starting up on boot ==== |
| - | < | + | < |
| - | =====Re-enable clusterware services===== | + | $ORA_CRS_HOME/ |
| - | < | + | </ |
| + | ==== Re-enable clusterware services ==== | ||
| + | < | ||
| + | $ORA_CRS_HOME/ | ||
| + | </ | ||
| - | =====List the resources under cluster control===== | + | ==== List the resources under cluster control ==== |
| - | < | + | < |
| + | $ORA_CRS_HOME/bin/crsctl status resource -t | ||
| or | or | ||
| - | < | + | $ORA_CRS_HOME/ |
| + | </code> | ||
| + | or | ||
| + | < | ||
| + | crsctl status res |grep -v " | ||
| + | " | ||
| + | awk -F " | ||
| + | "," | ||
| + | ", | ||
| + | </ | ||
| - | =====Find the ORACLE_HOME from a database cluster metadata file===== | + | ==== Find the ORACLE_HOME from a database cluster metadata file ==== |
| - | < | + | < |
| - | =====Stop all the cluster resources for a particular ORACLE_HOME===== | + | crsctl stat res ora.proddb11.db -p | grep ORACLE_HOME |
| - | If all resources for a home need to go down (e.g. for patching), this should do it.<br /> | + | </ |
| + | ==== Stop all the cluster resources for a particular ORACLE_HOME ==== | ||
| + | If all resources for a home need to go down (e.g. for patching), this should do it.\\ | ||
| Save the state so that the start command knows what to start and what not to. | Save the state so that the start command knows what to start and what not to. | ||
| - | < | + | < |
| + | srvctl stop home -o / | ||
| + | or | ||
| + | srvctl stop home -oraclehome / | ||
| + | or | ||
| + | srvctl stop home -oraclehome / | ||
| + | </ | ||
| Before running the startup, the state file can be edited and instances added/ | Before running the startup, the state file can be edited and instances added/ | ||
| - | < | + | < |
| + | srvctl start home -o / | ||
| + | </ | ||
| - | ====General syntax for starting and stopping a RAC instance==== | + | === General syntax for starting and stopping a RAC instance === |
| - | < | + | < |
| - | ====Stop one instance of a RAC database==== | + | srvctl start|stop instance -d < |
| - | < | + | </ |
| + | === Stop one instance of a RAC database === | ||
| + | < | ||
| + | srvctl stop instance –d < | ||
| + | </ | ||
| - | ====Start an ASM instance on a specific node==== | + | === Start an ASM instance on a specific node === |
| - | < | + | < |
| - | ====Stop all instances of a RAC database==== | + | srvctl start instance –n < |
| - | < | + | e.g. |
| - | ====Start all instances of a RAC database==== | + | srvctl start prodctl –n asmnode1 |
| - | < | + | </ |
| - | ====Start a database in mount mode==== | + | === Stop all instances of a RAC database === |
| - | < | + | < |
| + | srvctl stop database –db < | ||
| + | e.g. | ||
| + | srvctl stop database -db ACCINGPX | ||
| + | </ | ||
| + | === Start all instances of a RAC database === | ||
| + | < | ||
| + | srvctl start database –db < | ||
| + | e.g. | ||
| + | srvctl start database -db ACCINGPX | ||
| + | </ | ||
| + | === Start a database in mount mode === | ||
| + | < | ||
| + | srvctl start database –db < | ||
| + | e.g. | ||
| + | srvctl start database -db ACCINGPX -o mount | ||
| + | </ | ||
| - | ====Stop ASM on a RAC node==== | + | === Stop ASM on a RAC node === |
| - | < | + | < |
| + | srvctl stop asm –n <rac node> | ||
| + | e.g. | ||
| + | srvctl stop asm –n asmnode1 -o immediate | ||
| + | </ | ||
| - | ====Start / Stop all node applications on a RAC node==== | + | === Start / Stop all node applications on a RAC node === |
| - | < | + | < |
| + | srvctl start nodeapps –n <rac node> | ||
| + | srvctl stop nodeapps –n <rac node> | ||
| + | srvctl status nodeapps –n <rac node> | ||
| + | </ | ||
| - | ====Start / Stop a listener on a RAC node==== | + | === Start / Stop a listener on a RAC node === |
| - | < | + | < |
| + | srvctl start|stop listener -n node_name [[-l listener_name_list]] | ||
| + | e.g. | ||
| + | srvctl start listener -n node2 | ||
| + | srvctl start listener -n node2 -l DATAGUARD_LISTENER | ||
| + | srvctl stop LISTENER_SCAN1 | ||
| + | </ | ||
| - | ====Start / Stop services on a RAC node==== | + | === Start / Stop services on a RAC node === |
| - | **srvctl stop database command implicity does a srvctl stop services (because services are dependent on database).**<br /> | + | **srvctl stop database command implicity does a srvctl stop services (because services are dependent on database).**\\ |
| **However, a subsequent srvctl start database requires an explicit srvctl start service** | **However, a subsequent srvctl start database requires an explicit srvctl start service** | ||
| - | * service name list is optional and if not provided, the SRVCTL starts all of the database' | + | * service name list is optional and if not provided, the SRVCTL starts all of the database' |
| - | * -c connect_str Connect string (default: / as sysdba)<br /> | + | * -c connect_str Connect string (default: / as sysdba)\\ |
| - | * -q Query connect string from standard input | + | * -q Query connect string from standard input |
| - | < | + | < |
| + | srvctl start service -d < | ||
| + | srvctl stop service -d db_unique_name [[-s service_name_list [[-i inst_name]] | ||
| + | </ | ||
| - | ====Status of an ASM instance on a RAC node==== | + | === Status of an ASM instance on a RAC node === |
| - | < | + | < |
| - | ====Status of the database, all instances and all services==== | + | srvctl status asm -n sdtcsynoda01-rac |
| - | < | + | srvctl status asm -n sdtcsynoda02-rac |
| - | < | + | </ |
| - | ====Status of named instances with their current services (if on local node)==== | + | === Status of the database, all instances and all services === |
| - | < | + | < |
| - | < | + | srvctl status database -d TSTEV3 -v |
| - | < | + | </ |
| - | < | + | < |
| - | ====Add a new node==== | + | Instance TSTEV31 is running on node sdtcsynoda01-rac |
| - | < | + | Instance TSTEV32 is running on node sdtcsynoda02-rac |
| - | ====Add a new database==== | + | </ |
| - | < | + | === Status of named instances with their current services (if on local node) === |
| + | < | ||
| + | srvctl status instance -d TSTEV3 -i TSTEV31 -v | ||
| + | </ | ||
| + | < | ||
| + | Instance TSTEV31 is running on node sdtcsynoda01-rac. Instance status: Open. | ||
| + | </ | ||
| + | < | ||
| + | srvctl status instance -d TSTEV3 -i TSTEV32 -v | ||
| + | </ | ||
| + | < | ||
| + | Instance TSTEV32 is running on node sdtcsynoda02-rac with online services DOTS. Instance status: Open. | ||
| + | </ | ||
| + | === Add a new node === | ||
| + | < | ||
| + | srvctl add nodeapps -n myclust-1 -o $ORACLE_HOME –A 139.184.201.1/ | ||
| + | </ | ||
| + | === Add a new database === | ||
| + | < | ||
| + | srvctl add database -d ORACLE -o $ORACLE_HOME | ||
| + | eg. | ||
| + | srvctl add database -d MASTASPO -o / | ||
| + | </ | ||
| - | ====Add named instances to an existing database==== | + | === Add named instances to an existing database === |
| - | < | + | < |
| + | srvctl add instance -d ORACLE -i RAC01 -n myclust-1 | ||
| + | srvctl add instance -d ORACLE -i RAC02 -n myclust-2 | ||
| + | srvctl add instance -d ORACLE -i RAC03 -n myclust-3 | ||
| + | eg. | ||
| + | srvctl add instance -d MASTASPO -i MASTASPO -n sdtcoda01-rac | ||
| + | </ | ||
| - | ====Add a service to an existing database with preferred instances (-r) and available instances (-a). Use basic failover to the available instances==== | + | === Add a service to an existing database with preferred instances (-r) and available instances (-a). Use basic failover to the available instances === |
| - | < | + | < |
| + | srvctl add service -d ORACLE -s STD_BATCH -r RAC01 -a RAC02 | ||
| + | </ | ||
| - | ====Add a service to an existing database with preferred instances (-r) and available instances (-a). Use preconnect at the available instances==== | + | === Add a service to an existing database with preferred instances (-r) and available instances (-a). Use preconnect at the available instances === |
| - | < | + | < |
| - | ====Remove the applications for a database==== | + | srvctl add service -d ORACLE -s STD_BATCH -r RAC01 -a RAC02 -P PRECONNECT |
| - | < | + | </ |
| - | ====Remove the applications for named instances of an existing database==== | + | === Remove the applications for a database === |
| - | < | + | < |
| - | ====Remove the service==== | + | srvctl remove database -d ORACLE |
| - | < | + | </ |
| - | ====Remove the service from the instances==== | + | === Remove the applications for named instances of an existing database === |
| - | < | + | < |
| - | ====Remove all node applications from a node==== | + | srvctl remove instance -d ORACLE -i RAC03 |
| - | < | + | srvctl remove instance -d ORACLE -i RAC04 |
| - | ====Modify an instance to execute on another node==== | + | </ |
| - | < | + | === Remove the service === |
| - | ====Modify a service to execute on another node==== | + | < |
| - | < | + | srvctl remove service -d ORACLE -s STD_BATCH |
| - | ====Modify an instance to be a preferred instance for a service==== | + | </ |
| - | < | + | === Remove the service from the instances === |
| - | ====Relocate a service from one instance to another==== | + | < |
| - | < | + | srvctl remove service -d ORACLE -s STD_BATCH -i RAC03, |
| - | ====Switchover / failover a database from one node (server) to another==== | + | </ |
| - | < | + | === Remove all node applications from a node === |
| + | < | ||
| + | srvctl remove nodeapps -n myclust-4 | ||
| + | </ | ||
| + | === Modify an instance to execute on another node === | ||
| + | < | ||
| + | srvctl modify instance -d ORACLE -n myclust-4 | ||
| + | </ | ||
| + | === Modify a service to execute on another node === | ||
| + | < | ||
| + | srvctl modify service -d ORACLE -s HOT_BATCH -i RAC01 -t RAC02 | ||
| + | </ | ||
| + | === Modify an instance to be a preferred instance for a service === | ||
| + | < | ||
| + | srvctl modify service -d ORACLE -s HOT_BATCH -i RAC02 –r | ||
| + | </ | ||
| + | === Relocate a service from one instance to another === | ||
| + | < | ||
| + | srvctl relocate service -d orac -s CRM -i RAC04 -t RAC01 | ||
| + | </ | ||
| + | === Switchover / failover a database from one node (server) to another === | ||
| + | < | ||
| + | srvctl relocate db -d orac -n server02 | ||
| + | </ | ||
| - | =====Enable CRS resources (resources can be up or down when these commands are issued)===== | + | ==== Enable CRS resources (resources can be up or down when these commands are issued) ==== |
| - | ====Enable the database==== | + | === Enable the database === |
| - | < | + | < |
| - | ====Enable the named instances==== | + | srvctl enable database -d ORACLE |
| - | < | + | </ |
| - | ====Enable the service==== | + | === Enable the named instances === |
| - | < | + | < |
| - | ====Enable the service at the named instance==== | + | srvctl enable instance -d ORACLE -i RAC01, RAC02 |
| - | < | + | </ |
| - | =====Disable CRS resources (resources must be down when these commands are issued)===== | + | === Enable the service === |
| - | ====Disable the database globally==== | + | < |
| - | < | + | srvctl enable service -d ORACLE -s ERP,CRM |
| - | ====Disable the named instances==== | + | </ |
| - | < | + | === Enable the service at the named instance === |
| - | ====Disable the service(s) globally==== | + | < |
| - | < | + | srvctl enable service -d ORACLE -s CRM -i RAC03 |
| + | </ | ||
| + | ==== Disable CRS resources (resources must be down when these commands are issued) ==== | ||
| + | === Disable the database globally === | ||
| + | < | ||
| + | srvctl disable database -d ORACLE | ||
| + | </ | ||
| + | === Disable the named instances === | ||
| + | < | ||
| + | srvctl disable instance -d ORACLE -i RAC01, RAC02 | ||
| + | </ | ||
| + | === Disable the service(s) globally === | ||
| + | < | ||
| + | srvctl disable service -d ORACLE -s ERP,CRM | ||
| + | </ | ||
| - | ====Disable the service on the named instance==== | + | === Disable the service on the named instance === |
| - | < | + | < |
| + | srvctl disable service -d ORACLE -s CRM -i RAC02 | ||
| + | </ | ||
| - | ====Status of a named services==== | + | === Status of a named services === |
| - | < | + | < |
| + | srvctl status service -d TSTEV3 -s DOTS -v | ||
| + | </ | ||
| - | ====Status of all nodes supporting database applications==== | + | === Status of all nodes supporting database applications === |
| - | < | + | < |
| + | srvctl status nodeapps | ||
| + | </ | ||
| - | ====How to tell if database is a RAC cluster==== | + | === How to tell if database is a RAC cluster === |
| This will be TRUE if RAC database | This will be TRUE if RAC database | ||
| - | < | + | < |
| + | show parameter cluster | ||
| + | </ | ||
| or, the GV$ views will show more than 1 record | or, the GV$ views will show more than 1 record | ||
| - | < | + | < |
| + | select * from gv$instance; | ||
| + | |||
| + | | ||
| + | ---------- --------------- ---------------- ---------------------------------------------------------------- ----------------- --------- ------------ --- ---------- ------- --------------- ---------- --- ----------------- ------------------ --------- --- ---------- ----------- ------- -------------------------------------------------------------------------------- | ||
| + | | ||
| + | | ||
| + | |||
| + | 2 rows selected. | ||
| + | </ | ||
| or | or | ||
| - | < | + | < |
| + | set serverout on | ||
| + | begin | ||
| + | if dbms_utility.is_cluster_database then | ||
| + | dbms_output.put_line(' | ||
| + | else | ||
| + | dbms_output.put_line(' | ||
| + | end if; | ||
| + | end; | ||
| + | / | ||
| + | </ | ||
| or | or | ||
| - | < | + | < |
| + | select * from v_$active_instances; | ||
| + | </ | ||
| or | or | ||
| - | < | + | < |
| - | ====Show session distribution across the RAC nodes==== | + | select * from v_$thread; |
| - | < | + | </ |
| + | === Show session distribution across the RAC nodes === | ||
| + | < | ||
| + | select inst_id | ||
| + | , count(*) sessions | ||
| + | from | ||
| + | where type = ' | ||
| + | group by inst_id | ||
| + | / | ||
| + | </ | ||
rac.1544273361.txt.gz · Last modified: 2018/12/08 12:49 by 0.0.0.0
