//
you're reading...
Oracle Grid Infrastructure

Using Oracle Restart for Oracle Database 11g Release 2 (Single Instance)


Oracle Restart can help you to improve the availability of your oracle database by automatically re-starting database on failure. Beside database, Oracle Restart can also manage other types of services like listener, ASM instance, etc. It’ll keep an eye of the services you registered and re-start them when failure happen. Do note that Oracle has confirmed that Oracle Restart is only intended for managing of single instance (non-RAC) 11.2 Oracle products only.

Oracle Restart runs from Oracle Grid Infrastructure home, so you need to install Oracle Grid Infrastructure to use this feature. The installer is pack together with the database installation software. After you unzip, you’ll see a directory called ‘grid’. Run the “runInstaller” inside that directory and the universal installer will launch.

If you are installing Grid Infrastructure for Oracle RAC, you choose the first option. Since I am not using Oracle RAC nor ASM, I have two choices. I can choose option #2 or #4. The different is option #4 requires you to manually run the Configuration of Oracle Grid Infrastructure software while #2 it’ll be done as part of the installation. Details of the configuration can be found here 

After the installation and configuration you should see two demon running:


bash-3.2# ps -ef|grep d.bin
 oracle 3695 1714 0 15:58:41 ? 0:13 /oracle/product/grid/11.2.0.3/bin/ohasd.bin reboot
 root 5250 2802 0 17:37:43 pts/2 0:00 grep d.bin
 oracle 4051 1714 0 15:59:04 ? 0:01 /oracle/product/grid/11.2.0.3/bin/evmd.bin

Setup “root” user oracle environment variable.You can put these line in the user startup script, so every time you log in these will be set.

GRID_HOME=/oracle/product/grid/11.2.0.3
ORACLE_HOME=$GRID_HOME; export ORACLE_HOME
PATH=$PATH:$ORACLE_HOME/bin; export PATH
LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib; export LD_LIBRARY_PATH

Checking Oracle High Availability Service

bash-3.2# crsctl check has
CRS-4638: Oracle High Availability Services is online
bash-3.2# crsctl config has
CRS-4622: Oracle High Availability Services autostart is enabled.

To start and stop Oracle High Availibility Service (HAS)


bash-3.2# crsctl stop has
CRS-2791: Starting shutdown of Oracle High Availability Services-managed resources on 'oracle-dev'
CRS-2673: Attempting to stop 'ora.evmd' on 'oracle-dev'
CRS-2677: Stop of 'ora.evmd' on 'oracle-dev' succeeded
CRS-2793: Shutdown of Oracle High Availability Services-managed resources on 'oracle-dev' has completed
CRS-4133: Oracle High Availability Services has been stopped.
bash-3.2# ps -ef|grep d.bin
 root 8206 2802 0 17:46:57 pts/2 0:00 grep d.bin

Starting it back…


bash-3.2# crsctl start has
CRS-4123: Oracle High Availability Services has been started.
bash-3.2# ps -ef|grep d.bin
 oracle 8944 1714 0 17:49:08 ? 0:01 /oracle/product/grid/11.2.0.3/bin/evmd.bin
 oracle 8731 1714 0 17:48:42 ? 0:03 /oracle/product/grid/11.2.0.3/bin/ohasd.bin reboot
 root 8955 2802 0 17:49:09 pts/2 0:00 grep d.bin
bash-3.2#

To see resources that are managed by Oracle HAS


bash-3.2# crsctl status resource -t
--------------------------------------------------------------------------------
NAME                   TARGET STATE SERVER STATE_DETAILS
--------------------------------------------------------------------------------
Local Resources
--------------------------------------------------------------------------------
ora.ons
                              OFFLINE OFFLINE oracle-dev
--------------------------------------------------------------------------------
Cluster Resources
--------------------------------------------------------------------------------
ora.cssd
           1                 OFFLINE OFFLINE
ora.diskmon
           1                 OFFLINE OFFLINE
ora.evmd
           1                 ONLINE ONLINE oracle-dev

  • ora.ons is the resource name for ONS (Oracle Notification Server), this is a publish and subscribe service for communicating Fast Application Notification (FAN) events.
  • ora.cssd is the resource name for CSS (Cluster Synchronization Services), this managed the cluster configuration.
  • ora.evmd is the resource name for EVM (Event Management), this is background process that publishes events that Oracle Clusterware creates.
  • ora.diskmon, honestly not very sure about this but from the result of googling I think this is only needed when working with Exadata. Even my RAC cluster do not have this.

Now moving on to registering the database to Oracle Restart or Oracle HAS…

To register database, you use “srvctl” command.

Reference for SRVCTL command can be found here

When configuring and managing database service, you need to use SRVCTL from oracle database home. Only when you are configuring and managing Oracle ASM, Listener (if run from Grid Home), disk group, ons, etc you will use SRVCTL from the oracle grid home.

To do this you need to use “oracle” user, if you use “root” you’ll get the following error


-bash-3.2# srvctl add database -d PLAYPEN -o /oracle/product/11.2.0.3
PRCD-1025 : Failed to create database PLAYPEN
PRKH-1014 : Current user "root" is not the oracle owner user "oracle" of oracle home "/oracle/product/11.2.0.3"

-bash-3.2# su - oracle
Oracle Corporation SunOS 5.10 Generic Patch January 2005

bash-3.2$ which srvctl

/oracle/product/11.2.0.3/bin/srvctl
bash-3.2$ srvctl add database -d PLAYPEN -o /oracle/product/11.2.0.3
bash-3.2$

To check the details Oracle Restart configuration for the database

bash-3.2$ srvctl config database -d PLAYPEN
Database unique name: PLAYPEN
Database name:
Oracle home: /oracle/product/11.2.0.3
Oracle user: oracle
Spfile:
Domain:
Start options: open
Stop options: immediate
Database role: PRIMARY
Management policy: AUTOMATIC
Database instance: PLAYPEN
Disk Groups:
Services:

Database instance will be registered as Cluster Resource in HAS, you can check again using “crsctl status resource -t” command as “root” user.

Testing Oracle Restart

To test that Oracle Restart will monitor and re-start database instance when there’s an instance failure, let’s kill the pmon process of the instance

bash-3.2$ srvctl status database -d PLAYPEN
Database is running.
bash-3.2$ ps -ef|grep pmon
 oracle 7592 1 0 Jul 20 ? 7:38 asm_pmon_+ASM
 oracle 8933 8924 0 10:51:12 pts/1 0:00 grep pmon
 oracle 8738 1 0 10:49:05 ? 0:00 ora_pmon_PLAYPEN
bash-3.2$ kill -9 8738
bash-3.2$ ps -ef|grep pmon
 oracle 7592 1 0 Jul 20 ? 7:38 asm_pmon_+ASM
 oracle 8937 8924 0 10:51:20 pts/1 0:00 grep pmon

I wait about 3 seconds…

bash-3.2$ ps -ef|grep pmon
 oracle 7592 1 0 Jul 20 ? 7:38 asm_pmon_+ASM
 oracle 8985 8924 0 10:51:29 pts/1 0:00 grep pmon
 oracle 8950 1 0 10:51:26 ? 0:00 ora_pmon_PLAYPEN

Here’s the content of the alert log.

Wed Aug 01 10:51:19 2012
Shutting down instance (abort)
License high water mark = 16
USER (ospid: 8935): terminating the instance
Instance terminated by USER, pid = 8935
Wed Aug 01 10:51:21 2012
Instance shutdown complete
Wed Aug 01 10:51:22 2012
Starting ORACLE instance (normal)
LICENSE_MAX_SESSION = 0
LICENSE_SESSIONS_WARNING = 0
Picked latch-free SCN scheme 3

==snipped==

Completed: ALTER DATABASE OPEN /* db agent *//* {0:4:23} */

Nikolay Manchev wrote a great article about this topic too, to see more of demonstration of Oracle Restart features look at his blog http://manchev.org/2012/03/keeping-a-single-instance-database-up-with-oracle-restart/

About these ads

About Yoel Susanto

Oracle Specialist

Discussion

No comments yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

Join 34 other followers

%d bloggers like this: