Post on 27-Jul-2018
Reduce Infrastructure costs with Oracle Clusterware
How to Reduce License Cost without losing High Availability
Presented By: Bill Pritchett, Senior Consultant
Advantages of having a single instance database as a clustered resource
Process to implement a database as a clustered resource
Key Considerations and Attributes when implementing a database as a clustered resource
Shared storage options for non oracle files that need to be shared between nodes
Documentation Resources
Questions
2
Discussion Topics
Reduce Budget Impact
Enable automatic Failover of a Database Instance
Ability to provide automatic failover for all applications on a database server
3
Advantages of having a single instance database as a clustered resource
License one server per cluster for Database use
Clusterware and ASM are free with Database License
Expenses for Database Licensing are cut in half
Reduce future support costs
4
Reduce Budget Impact
Reduce downtime due to unplanned outages
Reduce downtime related to Server maintenance
Reduce downtime for Database patching
Enable automatic failover for NIC Card related issues
Enable automatic failover when network issues occur
5
Enable automatic Failover of Database Instance
Remove need for manual application migration
Reduce downtime related to Server maintenance
Enable Cluster management of non Oracle Applications
6
Provide automatic failover for all applications on a database server
Install Software and Create Database
Create an Action Script
Create a resource attribute file
Remove Database from cluster
Add database back to cluster as a clustered resource
7
Process to implement a database to a clustered resource
Install Clusterware on all servers – Request 3 Ips per server and 3 Ips for the SCAN Listener – Verify all Ips except the private Ips resolve using nslookup (This includes reverse lookup) – Create Voting Disk ASM diskgroup – Verify passwordless SSH capability for Clusterware Owner – Create rest of ASM Diskgroups
8
Install Software and Create Database
Install the Database software using the RAC install option – Select install Database Software only – Select Oracle Real Application Clusters database installation – Select all cluster nodes – Verify passwordless SSH capability for Database software Owner
Create Single instance database using DBCA – Make Sure to Select Oracle Single Instance Database
9
Install Software and Create Database (Continued)
Action Scripts are required for managing an application as a clustered resource.
Action Scripts must be owned by Oracle and executable by Root
Should be created in a directory owned by Oracle under the GRID_HOME/crs directory
The Action Script is usually a perl or shell script. It consists of the following: – Oracle Home and Oracle Sid variables – Case statement containing the following entry points: Start, Stop, Clean, Check and abort(optional) – IF statement test case to determine success or failure of entry point
10
Create an Action Script
The START entry point acts to bring a resource online. The agent framework calls this entry point whenever it receives the start command from Oracle Clusterware.
Example Start entry Point
11
Create an Action Script – Start Entry Point
'start') $ORACLE_HOME/bin/sqlplus /nolog <<EOF conn / as sysdba startup exit EOF RET=0 ;;
The STOP entry points acts to gracefully bring down a resource. The agent framework calls this entry point whenever it receives the stop command from Oracle Clusterware.
Example Stop entry Point
12
Create an Action Script – Stop Entry Point
'stop') $ORACLE_HOME/bin/sqlplus /nolog <<EOF conn / as sysdba shutdown immediate exit EOF RET=0 ;;
The CLEAN entry point acts whenever there is a need to clean up a resource. It is a non-graceful operation that is invoked when users must forcefully terminate a resource. This command cleans up the resource-specific environment so that the resource can be restarted.
Example Clean entry Point
13
Create an Action Script – Clean Entry Point
'clean') $ORACLE_HOME/bin/sqlplus /nolog <<EOF conn / as sysdba shutdown abort exit EOF RET=0 ;;
The CHECK (monitor) entry point acts to monitor the health of a resource. The agent framework periodically calls this entry point. If it notices any state change during this action, then the agent framework notifies Oracle Clusterware about the change in the state of the specific resource
Example Check entry Point
14
Create an Action Script – Check Entry Point
'check') ok=`ps -ef | grep smon | grep $ORACLE_SID | grep -v grep | wc -l` if [ $ok = 0 ]; then RET=1 else RET=0 fi ;;
If any of the other entry points hang, the agent framework calls the ABORT entry point to abort the ongoing action. If the agent developer does not supply an abort function, then the agent framework exits the agent program.Example Check entry Point
Optional Entry Point
15
Create an Action Script – Abort Entry Point
‘abort') killcmd=`ps -ef | grep pmon | grep $ORACLE_SID | grep -v grep | awk ‘{print $2}’` kill -9 $killcmd if [ $? = 0 ]; then RET=0 else RET=1 fi ;;
The Attributes of a database differ from the Attributes of a clustered resource. This creates the need to modify the resource attributes
Create a resource file by running the following command – $GRID_HOME/bin/crsctl stat res <db resource name> -p > mydb_resource.txt
Modify resource attributes to resemble a clustered resource – TYPE – ACTION_SCRIPT – AUTO_START – START_DEPENDENCIES – STOP_DEPENDENCIES
16
Create a resource attribute file
Shutdown the database – srvctl stop database –d <database name>
Remove the database from the cluster – srvctl remove database –d <database name>
17
Remove Database from cluster (As Database Owner)
To Add the Database as a clustered Resource use the following command – $GRID_HOME/bin/crsctl add resource <database name>.db –type cluster_resource –file <full path to
resource file>
Then start the resource – $GRID_HOME/bin/crsctl start resource ora.mytest.db -n <hostname>
18
Add database back to cluster as a clustered resource (As Database Owner)
Considerations – Command restrictions – License restrictions – TNS Information – Diagnostic and Admin directories
Attributes – AUTO_START – START_DEPENDENCIES – STOP_DEPENDENCIES
How to modify attributes
19
Key Considerations and attributes when implementing a database as a Clustered Resource
Command line startup options are limited – Inability to start the database in restrict mode or mount state using srvctl commands
Database may only run on secondary node 10 days out of a calendar year – A day is considered used whether it runs on secondary node10 minutes or 23 hours – Talk to your License representative for more information
Copy the TNSNAMES.ora file from Node 1 to Node 2 – Modify the local listener TNS entry on Node 2 to point to Node 2
Build Diagnostics and Admin directory structures on Node 2 – Diagnostics directory should be on shared storage if possible
20
Key Considerations
Determines how the resource is started after a system reboot. The following settings are valid – always: Restarts the resource when the server restarts regardless of the state of the resource when the
server stopped. – restore: Restores the resource to the same state that it was in when the server stopped. Oracle Clusterware
attempts to restart the resource if the value of TARGET was ONLINE before the server stopped. – never: Oracle Clusterware never restarts the resource regardless of the state of the resource when the
server stopped.
An AUTO_START setting of never can be overridden if the START_DEPENDENCIES attribute contains any pullup dependencies.
If you only license one server of the cluster then you should set AUTO_START to never so that you can make sure the database starts up on node one
21
Key Attribute – AUTO_START
Enforces resource dependencies so that the resource only starts once all the dependencies are met. The following types of dependencies are valid – hard([intermediate:][global:]{resource_name | type:resource_type}):Specify a hard start dependency for a
resource when you want the resource to start only when a particular resource or resource of a particular type starts.
– weak([concurrent:][global:][uniform:]{resource_name | type:resource_type}): Specify a weak start dependency for a resource when you want that resource to start despite whether named resources are running, or not. An attempt to start this resource also attempts to start any resources on which this resource depends if they are not running.
– attraction([intermediate:]{resource_name | type:resource_type}):Use the attraction start dependency when you want this resource to run on the same server with a particular named resource or any resource of a particular type.
– pullup[:always]([intermediate:][global:]{resource_name | type:resource_type}):When you specify the pullup start dependency for a resource, then this resource starts as a result of named resources starting.
22
Key Attribute – START_DEPENDENCIES
Oracle recommends that resources with hard start dependencies also have pullup start dependencies.
If you specify the pullup dependency on a resource type for a resource, then, when any resource of that particular type starts, Oracle Clusterware can start this resource. This causes the AUTO_START setting of NEVER to be overridden
23
Key Attribute – START_DEPENDENCIES (Continued)
From my example file
START_DEPENDENCIES=hard(ora.DATA.dg,ora.ARCH.dg) weak(type:ora.listener.type,uniform:ora.ons)
Enforce resource dependencies for shutting down the resource. The only type of dependency available is hard – hard([intermediate:][global:][shutdown:]{resource_name | type:resource_type}): Specify a hard stop dependency for a
resource that you want to stop when named resources or resources of a particular resource type stop.
If you want the database to failover to the passive node when there are issues with the Public Network then you have to specify the network as a dependency
24
Key Attribute – STOP_DEPENDENCIES
From my example file
STOP_DEPENDENCIES=hard(intermediate:ora.asm,shutdown:ora.DATA.dg,shutdown:ora.ARCH.dg,ora.net1.network)
To modify the attributes of a resource you use the following command – $GRID_HOME/bin/crsctl modify res <resource name> -attr “<Attribute Name>=‘value’” – Multiple attributes may be listed in the double quotes by using commas between the Attributes
25
How to modify attributes
To help manage files needed on both servers the Storage options listed below are available. Examples of files needed on both servers are – Backup scripts – Database Diag information – Monitoring scripts
ACFS (ASM Clustered Filesystem) – utilizes ASM to manage the mountpoints
NFS (Network File System) – If NFS is chosen please verify the resource stop_dependencies setting includes the public network.
Otherwise the database will hang if your server loses the Public Network
26
Shared storage options for non oracle files that need to be shared between nodes
Cluster Admin Guide 11gR2 Clusterware Administration and Deployment Guide
SOP – Single Single Instance Database on Grid Infrastructure
27
Documentation Resources