Twitter

svc-set-failback-yes.sh: Make your Orace services to automatically failback to the preferred nodes

A very cool feature has been released with Oracle 19c: the -failback yes option to make your services to automatically failback to the preferred node ! I then wrote this script to easily set that up:
[root@exadb01 ~]# ./svc-set-failback-yes.sh -d PROD
2021-02-18_084727 [QUESTION] You are about to modify your system (failback = yes to your databases services), are you sure you want to proceed ? [y/n] (yes/exit)
y
2021-02-18_084728 [INFO] It may be slow if you have many services as srvctl is slow when a database has many services.
2021-02-18_084729 [INFO] Database: PROD
2021-02-18_084736 [INFO] Succesfully set the service PROD_APP1 in failback mode.
2021-02-18_084736 [INFO] Succesfully set the service PROD_APP2 in failback mode.
2021-02-18_084736 [INFO] Service PROD_REPORTING is already in failback mode.
2021-02-18_084736 [INFO] Service PROD_BATCH is already in failback mode.
[root@exadb01 ~]#
You will first note that I ask for a confirmation before setting that up as it will modify your settings so better being sure in case of you start this script by mistake. You can suppress this message by using the -y option.
Then a warning that it can be slow as srvctl is slow when managing many services so it can take some time.
With no option, it will set the services with failback yes of all the databases defined in /etc/oratab (ASM, agent and MGMTDB are ignored).
With -d option, you can choose a specific database:
$ ./svc-set-failback-yes.sh -d PROD
You can also grep a pattern in /etc/oratab like this:
$ ./svc-set-failback-yes.sh -g PROD
This will set the services configuration on all the *PROD* databases. The default greps "19" in oratab as it is a 19c feature.
Use -h option for help and example as usual.
Used in coordination with svc-show-config.sh, you can easily check your config, set up -failback yes and check again to verify:
$./svc-show-config.sh
$./svc-set-failback-yes.sh
$./svc-show-config.sh
Also note that i works as root and as oracle. You can download it here, enjoy !

No comments:

Post a Comment

Some bash tips -- 18 -- paste

This blog is part of a shell tips list which are good to know -- the whole list can be found here. I really like finding a real usage for...