In Part I of this article, I  discussed the Cluster administrator’s view of the What-If Command Evaluation and demonstrated how cluster administrators can use crsctl to

  • Perform What-If Command Evaluation
    • On Application Resources
    • On Oracle Clusterware Resources
  • Format the Output for What-If Command Evaluation on Oracle Clusterware Resources

In this second and final article in this series, I will discuss about Database administrator’s view of the What-If Command Evaluation and demonstrate

  • What-If Command Evaluation using srvctl command with -eval option
  • Evaluating Failure Consequences with srvctl predict

Let’s get started.

Database administrator’s view of What-if command evaluation

RAC database administrators who do not have access to the crsctl utility can use

  • srvctl command with the -eval option to analyze the effects of:
    • Adding, starting, stopping, modifying, and relocating databases
    • Adding, starting, stopping, modifying, and relocating database services
    • Adding, modifying, and removing server pools
    • Relocating a server from one server pool to another
  • srvctl predict command for:
    • Evaluating the consequences of a failure affecting different types of resources

What-If Command Evaluation using srvctl command with -eval option

The syntax of the available commands is as follows:

$ srvctl { add | start | stop | modify | relocate } database … -eval

$ srvctl { add | start | stop | modify | relocate } service … -eval

$ srvctl { add | modify | remove } srvpool … -eval

$ srvctl relocate server … –eval

The parameter -eval, when used, simulates execution of a command without making any changes to the system. The output of the srvctl informs what will happen if a particular command is actually run.

Note that –eval option does not support Administrator-managed databases. If we attempt to evaluate the impact of stopping Administrator-managed database amdb, we receive error message PRKO-2712.

[oracle@host01 ContentsXML]$ srvctl stop database -d amdb -eval
PRKO-2712 : Administrator-managed database amdb is not supported with -eval option

Hence, I am going to create another policy managed database pmdb as under:

  • Hosting server pool – pmpool having a cardinality of 2.
  • Services
    • pm_single – singleton
    • pm_uniform – Uniform

I will unregister administrator managed database amdb from cluster so that all the hub nodes can host instances the policy managed database pmdb.

[oracle@host01 ContentsXML]$ srvctl remove database -d amdb -f
[root@host01 bin]# crsctl stat serverpool
NAME=Free
ACTIVE_SERVERS=host01 host02 host03 host04 host05

NAME=Generic
ACTIVE_SERVERS=

NAME=apache_sp
ACTIVE_SERVERS=host04 host05

After creation of the database pmdb, note that

  • Servers host02 and host03 have been assigned to server pool pmpool
  • Instances pmdb_1 and pmdb_2 of database pmdb are running on servers host01 and host02
  • Database service pm_single is running on server host02
  • Database Service pm_uniform is running on servers host02 and host03

[root@host01 bin]# crsctl stat serverpool
NAME=Free
ACTIVE_SERVERS=host01 host04 host05

NAME=Generic
ACTIVE_SERVERS=

NAME=apache_sp
ACTIVE_SERVERS=host04 host05

NAME=ora.pmpool
ACTIVE_SERVERS=host02 host03

[oracle@host01 ~]$ srvctl status database -d pmdb
Instance pmdb_1 is running on node host02
Instance pmdb_2 is running on node host03

[oracle@host01 ~]$ srvctl status service -d pmdb
Service pm_single is running on nodes: host02
Service pm_uniform is running on nodes: host02,host03

Example: Evaluate impact of stopping the database pmdb

The database pmdb and its services will be stopped.

[oracle@host01 ~]$ srvctl stop database -d pmdb -eval

Service pm_single will be stopped on node host02
Service pm_uniform will be stopped on nodes host03,host02
Database pmdb will be stopped on nodes host02,host03

Example: Evaluate impact of relocating service pm_single from host02 to host03

Since an instance of database pmdb is running on server host03, Service pm_single will be started on node host03.

[oracle@host01 ~]$ srvctl relocate service -s pm_single -d pmdb -currentnode  
host02 -targetnode host03 -eval

Service pm_single will be started on node host03

Example: Evaluate impact of stopping database service pm_single

Service pm_single will be stopped on node host02

[oracle@host01 ~]$ srvctl stop service -s pm_single -d pmdb -evalService
pm_single will be stopped on node host02

Example: Evaluate impact of increasing cardinality of server pool ora.pmpool to 3

If cardinality of server pool pmpool is increased to 3, free server host01 will be moved to pmpool and an instance of database pmdb will be started on host01

[oracle@host02 root]$ srvctl modify srvpool -serverpool ora.pmpool -min 1 – max 3 -eval

Database pmdb will be started on node host01
Server host01 will be moved from pool Free to pool pmpool

Example : Evaluate impact of relocating server host02 to another server pool newpool

In order to demonstrate this scenario, I have created a new server pool newpool and as can be seen, server host01 has been assigned to newpool.

[oracle@host02 root]$ srvctl add srvpool -serverpool newpool

[root@host01 trace]# crsctl status serverpool ora.newpool
NAME=ora.newpool
ACTIVE_SERVERS=host01

If server host02 is relocated to newpool, database pmdb and its services will be stopped on host02.

[oracle@host02 root]$ srvctl relocate server -servers host02 -serverpool  newpool -eval

Service pm_single will be stopped on node host02
Service pm_uniform will be stopped on node host02
Database pmdb will be stopped on node host02
Server host02 will be moved from pool pmpool to pool newpool

Evaluating Failure Consequences with srvctl predict

Using the srvctl predict command, RAC database administrators can evaluate the consequences of a failure affecting different types of resources, including databases, services, ASM instances, ASM disk groups, networks, VIPs, listeners, and so on.

Command syntax:

$ srvctl predict { database | service | asm | diskgroup | filesystem | vip | network | listener | scan | scan_listener |    oc4j } … [-verbose]

Example : Evaluate consequences of failure of database pmdb

If database pmdb fails, it will lead to stopping of the database on servers host02 and host03. Consequently, both its services i.e. pm_single and pm_uniform should also stop. But here I found an error (a bug?) in the output. Whereas service pm_uniform is correctly predicted to stop on both the nodes, service pm_single has been predicted to start on host03 after having been stopped on host02.

[root@host02 ~]# srvctl predict database  -db pmdb -verbose
Database pmdb will be stopped on nodes host02,host03
Service pm_single will be started on node host03
Service pm_single will be stopped on node host02
Service pm_uniform will be stopped on nodes host02,host03

Example : Evaluate consequences of failure of asm on host02

If ASM fails on server host02, ASM and both the diskgroups DATA and FRA will be stopped.

[root@host02 ~]# srvctl predict asm -verbose
Resource ora.asm will be stopped
Resource ora.DATA.dg will be stopped
Resource ora.FRA.dg will be stopped

[root@host02 ~]# srvctl predict asm -n host02
Resource ora.asm will be stopped
Resource ora.DATA.dg will be stopped
Resource ora.FRA.dg will be stopped

Example : Evaluate consequences of failure of SCAN on server host01

If SCAN fails on server host01, corresponding SCAN-VIP and SCAN-listener will be started on server host02.

[oracle@host02 root]$ srvctl status scan -scannumber 1
SCAN VIP scan1 is enabled
SCAN VIP scan1 is running on node host01

[oracle@host02 root]$ srvctl predict scan -scannumber 1
VIP scan1 will be started on node host02
Listener LISTENER_SCAN1 will be started on node host02

Example : Evaluate consequences of failure of VIP on server host02

If VIP fails on server host02, it will be started on server host03. Also, service pm_single which is currently executing on server host02 will be started on server host03.

[root@host02 ~]# srvctl status vip -node host02
VIP 192.9.201.218 is enabled
VIP 192.9.201.218 is running on node: host02
 
[root@host02 ~]# srvctl predict vip -vip 192.9.201.218 -verbose
VIP host02 will be started on node host03
Listener LISTENER will be stopped
Service pm_single will be started on node host03

Summary:

  • Database administrators can use
    • srvctl command with the -eval option to analyze the effects of:
      • Adding, starting, stopping, modifying, and relocating databases
      • Adding, starting, stopping, modifying, and relocating database services
      • Adding, modifying, and removing server pools
      • Relocating a server from one server pool to another
      • srvctl predict command for:
        • Evaluating the consequences of a failure affecting different types of resources

References

https://docs.oracle.com/database/121/RACAD/GUID-821C357A-AA16-4E30-B14F-DF7B4AE4EBFA.htm#RACAD8532

https://docs.oracle.com/en/database/oracle/oracle-database/18/racad/server-control-utility-reference.html#GUID-803F603E-8638-4946-84D4-CB24D21C893C

About the Author

Anju Garg

Anju Garg is an Oracle Ace with over 14 years of experience in IT Industry in various roles. Since 2010, she has been involved in teaching and has trained more than a hundred DBAs from across the world in various core DBA technologies like RAC, Data guard, Performance Tuning, SQL statement tuning, Database Administration etc. She is a regular speaker at Sangam and OTNYathra. She writes articles about Oracle and is one of the reviewers of the following book published by Pearson Oracle Problem-Solving and Troubleshooting Handbook. She is passionate about learning and has keen interest in RAC and Performance Tuning. You can learn all about Anju’s credentials and read more from her via her technical blog site at http://oracleinaction.com/

Start the discussion at forums.toadworld.com