Protect single instance with GI (without RAC-One-Node)

This is my first post since I meet Martin Nash in London 2 years ago on a Storage seminar with James Morle. He invited me on ORAganism blog and since then I wanted to start blogging but didn’t take the time to do so.
I spent one year working as a Consultant for a company called Digora where I have had great time and learnt a lot with all the different consultants, Laurent Leturget made me felt guilty not to blog ( laurent-leturgez.com ) !

Anyway, I discovered lately that it is now really simple to protect a single instance with “Cold failover” technique  through the Grid Infrastructure. Before discovering this technique, it was not this easy. There was an article on Oracle blogs talking about an equivalent technique :
https://blogs.oracle.com/xpsoluxdb/entry/clusterware_11gr2_setting_up_an_activepassive_failover_configuration

Compared to this post, the new technique can’t be much easier, there are 2 commands :

- Check the current properties of your database - dbtest here
 crsctl status resource ora.dbtest.db -p
- Change the placement to FAVORED for your database
 crsctl modify resource ora.dbtest.db -attr "PLACEMENT=favored"
- Change the list of HOSTs that can receive the instance of your database (here host1 or host2)
 crsctl modify resource ora.dbtest.db -attr "HOSTING_MEMBERS=host1 host2"
- Check back the new properties of your database - dbtest here
 crsctl status resource ora.dbtest.db -p

If you want your client connection to be handle the failover automatically and the SCAN listener to be aware of the host change, you need to modify your remote_listener parameter so that it points to the SCAN address of our GI setup

sqlplus / as sysdba 
alter system set remote_listener="host-scan:1521" scope=both;

That’s it !!

You now have a single-instance database that is protected again hardware failure. So next question is why using this technique when you can use the RAC-One Node and what are the differences ?

- Reason – Cost
This is no additional cost and no extra licence compared to the RAC-One Node solution and moreover, you can use this technique with a Standard Edition database.

- Difference 1 – No RAC feature

Compared to the RAC-One Node solution, the database cannot failover smoothly to the other host (online failover). When you use RAC-One Node, if you choose in advance that you want to failover to another host (host2), you can use the following command :

srvctl relocate database -d dbtest -n host2 -v

When you launch this command, while they are some active transactions on the first host, the instance will be up and one second instance will start on the future host, so you are in the case of RAC features since both instances are up at the time, that’s why we have 2 redolog threads and 2 undo on RAC-One Node configuration.

If you want to learn more on RAC One Node, Marcin Przepiorowski has a serie on the subject (http://oracleprof.blogspot.fr/2009/12/oracle-rac-one-node-part-1.html)

If you try to use the relocate command with “poor’s man” failover solution, you’ll get this error :
   PRCD-1027 : Failed to retrieve database orcltest
   PRCD-1146 : Database orcltest is not a RAC One Node database

- Difference 2 – No native support in Cloud Control 12c

If you want to add this database to your beloved Cloud Control, you will need to add a wee extra script in case of failover so that CC12c can know it has to connect to the new host, here is an example below. If needed I wrote a script which handle this automatically (ask for it).

- Step 1 : create blackout (better but not compulsary)

emcli create_blackout -name="relocating active passive targets" -add_targets=${DB_NAME}_${INSTANCE_NAME}:oracle_database -schedule="frequency:once;duration:0:30" -reason="DB relocate"

- Step 2 – relocate the target from host1 to host2

emcli relocate_targets -src_agent=${SERVER_SOURCE}:3872 -dest_agent=${SERVER_DEST}:3872 -target_name=${DB_NAME}_${INSTANCE_NAME} -target_type=oracle_database -copy_from_src -force=yes -changed_param=MachineName:${VIP_NAME}

- Step 3 : stop blackout

emcli stop_blackout -name="relocating active passive targets"

- Difference 3 – No “Omotion like” relocation

At the beginning, RAC-One Node was named “Omotion“, it could be used almost as “Vmotion” from Vsphere. In the configuration using the Grid Infrastructure, you can only failover if you shutdown the host or shutdown the instance down on host1 and start it again on the second host :

-- From Host 1
srvctl stop database -d dbtest
-- From Host 2
srvctl start database -d dbtest -n host2

You are now ready to test this out !! This is amazing how Oracle handle this configuration, even if you delete the spfile from host1, the GI will recreate it automatically.

Hope this helps. I did not find any blog article talking about this type of configuration so this is my first contribution to the Oracle community from which I learned so much.

 

 

 

 

About these ads

3 thoughts on “Protect single instance with GI (without RAC-One-Node)

  1. Hello Jean-Christophe,

    thank you for sharing this information.

    I’ve tested solution in 12cR1 GI and noticed that I cannot failover instance to another node using srvctl command.
    It appears that in 12cR1 this option is only reserved for RAC One Node databases.

    From srvctl help:
    -node Node on which to start the database (only for RAC One Node databases)

    I’ve performed shutdown on first node and startup on another with -n option, but database starts only on the first node.

    Best regards,
    Marko

  2. Which command do you try, I haven’t tested on RAC 12gR1, it was tested on 11.2.0.4 GI, but if you try the following command :
    srvctl relocate database -d dbtest -n host2 -v

    It does not work, this is normal, not sure it was clear on my entry. This command is only available for RON.

    Could you post the commands you are performing (setup + tests).
    Thanks

  3. Hello,

    I’ve tried this:

    (on first host)

    $ ./srvctl stop database -d orcl

    $ ./crsctl stat res ora.orcl.db
    NAME=ora.orcl.db
    TYPE=ora.database.type
    TARGET=OFFLINE
    STATE=OFFLINE

    (on second host)

    $ ./srvctl start database -d orcl -n host2

    $ ./crsctl stat res ora.orcl.db
    NAME=ora.orcl.db
    TYPE=ora.database.type
    TARGET=ONLINE
    ====> STATE=ONLINE on host1

    For setup I’ve added database to GI with:

    $ ./srvctl add database -db orcl -oraclehome /u01/app/orcl/product/12.1.0/dbhome_1 -dbtype SINGLE -node host1

    From resource attributes:

    PLACEMENT=favored
    HOSTING_MEMBERS=host1 host2
    DATABASE_TYPE=SINGLE

    When I simulate node crash database starts on host2 as expected. But cannot relocate database manually with srvctl.

    This setup is created in test/virtual environment so If you need more information I can provide/test it easily.

    Regards,
    Marko

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