Twitter

svc-show-config.sh: Show your Oracle services configuration

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 ! and to be able to use it efficiently, you first need to know the current configuration of your services so I wrote this script to nicely show this:
[root@exadb01 ~]# ./svc-show-config.sh
2021-02-18_084413 [INFO] It may be slow if you have many services as srvctl is slow when a database has many services.
2021-02-18_084416 [INFO] Database: PROD
------------------------------------------------------------------------------
| Service name |  Pref instances  |  Avail instances | Failback |    Role    |
------------------------------------------------------------------------------
|PROD_APP1     |   PROD1          |      PROD2       |  false   |   Primary  |
|PROD_APP2         PROD2          |      PROD1       |  false   |   Primary  |
|PROD_REPORTING|   PROD1,PROD2    |                  |  true    |   Primary  |
|PROD_BATCH    |   PROD2          |      PROD1       |  true    |   Primary  |
------------------------------------------------------------------------------
. . .
First of all, I show a warning saying that it may be slow if you have many services; indeed, srvctl is slow of you have many services (crsctl as well by the way).
I based it on oratab (and not on CRS which I could also have queried to see what databases are supposed to run on a server) because oratab is supposed to be up to date -- if not, I strongly recommend to keep it updated, it is very easy and very handy.
With no option, it will show the services configuration of all the databases defined in /etc/oratab (ASM, agent and MGMTDB are ignored).
With -d option, you can choose a specific database:
$ ./svc-show-config.sh -d DB_PROD
You can also grep a pattern in /etc/oratab like this:
$ ./svc-show-config.sh -g PROD
This will show the services configuration to 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-set-failback-yes, 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 !

2 comments:

Some bash tips -- 17 -- SECONDS

Reinventing the wheel is rooted deep inside our DNA. I really try to never reinvent the wheel but I recently got caught (!). Indeed, wh...