Saturday, May 16, 2020

Hi All,

In this post, I am going to describe Oracle 12c (RAC) feature, What - If command evaluation.

Cluster Administrators can employ the crsctl eval command on Oracle clusterware resources - Servers, server pools and policies to perform what-if command evaluation that tests the effect of:

We can use eval and predict with CRSCTL[Cluster Control] and SRVCTL[Server Control].

Use of eval in CRSCTL:

[oracle@rac01 Desktop]$ crsctl eval -h

Usage:
  crsctl eval start resource {<resname>|-w <filter>}[-n server] [-f]
    Evaluate start of specified resources

where
     resname        Name of a resource
     -w             Resource filter
     -n             Server Name
     -f             Evaluate as with force option


  crsctl eval stop resource {<resname>|-w <filter>} [-f]
    Evaluate stop of specified resources

where
     resname        Name of a resource
     -w             Resource filter
     -f             Evaluate as with force option


  crsctl eval relocate resource {<resName> | {<resName>|-all} -s <server> | -w <filter>} {-n <server>} [-f]
    Evaluate relocate of specified resource


where
     resName        Name of a resource
     -all           Relocate all resources
     -s             Source server
     -w             Resource filter (e.g., "TYPE = ora.database.type")
     -n             Destination server
     -f             Evaluate as with force option


  crsctl eval add serverpool <spName> [-file <filePath> | -attr  "<attrName>=<value>[,...]"] [-f] [-admin [-l <level>] [-x] [-a]]
    Evaluate addition of specified serverpool

where
     spName         Name of the serverpool
     -file          File containing attributes
     -attr          Attributes for the serverpool
     -f             Evaluate as with force option
     -admin         Cluster Administrator view
     level          Output display level ('serverpools' for server pools, 'resources' for resources or 'all' for all)
     -x             Show differences only
     -a             Show all resources


  crsctl eval modify serverpool <spName> {-file <filePath> | -attr  "<attrName>=<value>[,...]"} [-f] [-admin [-l <level>] [-x] [-a]]
    Evaluate modification of specified serverpool

where
     spName         Name of the serverpool
     -file          File containing attributes
     -attr          Attributes for the serverpool
     -f             Evaluate as with force option
     -admin         Cluster Administrator view
     level          Output display level ('serverpools' for server pools, 'resources' for resources or 'all' for all)
     -x             Show differences only
     -a             Show all resources


  crsctl eval delete serverpool <spName>  [-admin [-l <level>] [-x] [-a]]
    Evaluate deletion of specified server pool

where
     spName         Name of the server pool
     -admin         Cluster Administrator view
     level          Output display level ('serverpools' for server pools, 'resources' for resources or 'all' for all)
     -x             Show differences only
     -a             Show all resources


  crsctl eval add server <serverName> [-file <filePath> | -attr  "<attrName>=<value>[,...]"] [-admin [-l <level>] [-x] [-a]]
    Evaluate addition of server

where
     serverName     Name of the server
     -file          File containing attributes
     -attr          Attributes for the server
     -admin         Cluster Administrator view
     level          Output display level ('serverpools' for server pools, 'resources' for resources or 'all' for all)
     -x             Show differences only
     -a             Show all resources


  crsctl eval relocate server <serverName> -to <toPool> [-f] [-admin [-l <level>] [-x] [-a]]
    Evaluate relocation of specified server

where
     serverName     Name of the server
     -admin         Cluster Administrator view
     level          Output display level ('serverpools' for server pools, 'resources' for resources or 'all' for all)
     -x             Show differences only
     -a             Show all resources
     toPool         ServerPool to add the server to


  crsctl eval delete server <serverName> [-admin [-l <level>] [-x] [-a]]
    Evaluate deletion of specified server

where
     serverName     Name of the server
     -admin         Cluster Administrator view
     level          Output display level ('serverpools' for server pools, 'resources' for resources or 'all' for all)
     -x             Show differences only
     -a             Show all resources


  crsctl eval add resource <resName> -type <typeName> [-file <filePath> | -attr  "<attrName>=<value>[,...]"]  [-f]
    Evaluate add of specified resource

where
     resName         Name of the resource
     type            Resource type
     attrName        Attribute name
     value           Attribute value
     -f              Evaluate as with force option


  crsctl eval modify resource <resName> -attr "<attrName>=<value>[,...]" [-f] 
    Evaluate modification of specified resource

where
     resName         Name of the resource
     attrName        Attribute name
     value           Attribute value
     -f              Evaluate as with force option


  crsctl eval fail resource {<resname> | -w <filter>} [-n <server>] [-env "<attr>=<val>[,...]"]
    Evaluate failure of specified resource

where
     resName         Name of the resource
     filter          Resource filter
     server          Server Name
     -env            Attribute overrides for this command


  crsctl eval activate policy <policyName> [-f] [-admin {[-l <level>]|[-x]|[-a]}]
    Evaluate activation of specified policy

where
     policyName     Name of policy
     -f             Evaluate as with force option
     -admin         Cluster Administrator view
     level          Output display level ('serverpools' for server pools, 'resources' for resources or 'all' for all)
     -x             Show differences only
     -a             Show all resources

-> Adding, deleting and modifying server pools
-> Adding a server to the cluster
-> Removing a server from the cluster
-> Relocating a server from one server pool to another
-> Enabling a specific management policy

The eval commands available for Oracle clusterware resources are:

Server pools:

$ crsctl eval { add | delete | modify } serverpool

crsctl eval add serverpool: Predicts the effects of adding a server pool without making changes to the system.
crsctl eval modify serverpool: Predicts the effects of modifying a server pool without making changes to the system.
crsctl eval delete serverpool: Simulates the deletion of a server pool without making changes to the system.

Servers:

$ crsctl eval { add | relocate | delete } server

crsctl eval add server: Simulates the addition of a server without making changes to the system.
crsctl eval delete server: Predicts the effects of deleting a server without making changes to the system.
crsctl eval relocate server: Predicts the effects of relocating a server to a different server pool without making changes to the system.

Example:

[oracle@rac01 Desktop]$ crsctl eval delete server rac02

Stage Group 1:
--------------------------------------------------------------------------------
Stage Number Required Action
--------------------------------------------------------------------------------

     1     Y Resource 'ora.DATA.dg' (rac02) will be in state
[OFFLINE]
    Y Resource 'ora.LISTENER.lsnr' (rac02) will be in
state [OFFLINE]
    Y Resource 'ora.LISTENER_SCAN1.lsnr' (1/1) will be
in state [OFFLINE]
    Y Resource 'ora.asm' (rac02) will be in state
[OFFLINE]
    Y Resource 'ora.net1.network' (rac02) will be in
state [OFFLINE]
    Y Resource 'ora.ons' (rac02) will be in state
[OFFLINE]
    Y Resource 'ora.rac02.vip' (1/1) will be in state
[OFFLINE]
    Y Resource 'ora.scan1.vip' (1/1) will be in state
[OFFLINE]
    Y Resource 'ora.srlab.db' (2/1) will be in state
[OFFLINE]
    Y Server 'rac02' will be removed from pools
[Generic ora.srlab]

     2     Y Resource 'ora.rac02.vip' (1/1) will be in state
[ONLINE|INTERMEDIATE] on server [rac01]
    Y Resource 'ora.scan1.vip' (1/1) will be in state
[ONLINE] on server [rac01]

     3     Y Resource 'ora.LISTENER_SCAN1.lsnr' (1/1) will be
in state [ONLINE|INTERMEDIATE] on server [rac01]

--------------------------------------------------------------------------------

[oracle@rac01 Desktop]$ crsctl eval add server rac03

Stage Group 1:
--------------------------------------------------------------------------------
Stage Number Required Action
--------------------------------------------------------------------------------

     1     Y Server 'rac03' will be added to pools [Free]

--------------------------------------------------------------------------------

Policies:

$ crsctl eval activate policy

crsctl eval activate policy: Predicts the effects of activating a specific policy without making changes to the system.

[oracle@rac01 Desktop]$ crsctl eval stop resource ora.cvu -unsupported

Stage Group 1:
--------------------------------------------------------------------------------
Stage Number Required Action
--------------------------------------------------------------------------------

     1     Y Resource 'ora.cvu' (1/1) will be in state
[OFFLINE]

--------------------------------------------------------------------------------


Use of predict in SRVCTL:

[oracle@rac01 Desktop]$ srvctl predict -h

The SRVCTL predict command evaluates the consequences of resource failure.

Usage: srvctl predict database -db <database_name> [-verbose]
Usage: srvctl predict service -db <database_name> -service <service_name> [-verbose]
Usage: srvctl predict asm [-node <node_name>] [-verbose]
Usage: srvctl predict diskgroup -diskgroup <diskgroup_name> [-verbose]
Usage: srvctl predict filesystem -device <volume_device> [-verbose]
Usage: srvctl predict vip -vip <vip_name> [-verbose]
Usage: srvctl predict network [-netnum <network_number>] [-verbose]
Usage: srvctl predict listener -listener <listener_name> [-verbose]
Usage: srvctl predict scan -scannumber <scan_ordinal_number> [-netnum <network_number>] [-verbose]
Usage: srvctl predict scan_listener -scannumber <scan_ordinal_number> [-netnum <network_number>] [-verbose]
Usage: srvctl predict oc4j [-verbose]

[oracle@rac01 Desktop]$ srvctl predict vip -vip 192.168.56.182 -verbose

VIP rac02 will be started on node rac01
Listener LISTENER will be stopped

[oracle@rac01 Desktop]$ srvctl predict scan -scannumber 1

VIP scan1 will be started on node rac01
Listener LISTENER_SCAN1 will be started on node rac01

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

Post a Comment: