ansible-oracle-modules icon indicating copy to clipboard operation
ansible-oracle-modules copied to clipboard

oracle_services: Unlucky RAC-like calls to srvctl on Single Server

Open jschampera opened this issue 3 years ago • 2 comments

oracle_services module may return unsuccessfully with

"msg": "Error modifying service. Command: /u01/app/oracle/product/19.3.0.0/db19300_prod/bin/srvctl modify service -d XD002A -s PROFAHR_ADMIN -modifyconfig -preferred None, stdout: PRKO-2002 : Invalid command line option: -modifyconfig\nPRKO-2002 : Invalid command line option: -preferred\n, stderr: "

After a bit of a research I found that the module automatically detects a GI by stating /etc/oracle/olr.loc and then uses srvctl to manage services. If GI is not detected, it uses DBMS_SERVICE package from within the database.

The calls to srvctl use parameters that look like it's designed for RAC usage (-preferred, -available, -modifyconfig, probably more). The problem here is that those options are unavailable on a non-RAC installation (tested only with 19c, so that's an assumption I can't verify at the moment - below is my srvctl modify service -h output).

A workaround might be to force the module to use DBMS_SERVICE, but there's no interface parameter for that. Will check how I can currently continue by a quick and dirty module modification for now.

I can't suggest a real fix since I don't know how to autodetect this.

srvctl modify service -h Modifies the configuration for the service.

Usage: srvctl modify service -db <db_unique_name> -service <service_name> [-role [PRIMARY][,PHYSICAL_STANDBY][,LOGICAL_STANDBY][,SNAPSHOT_STANDBY]] [-policy {AUTOMATIC | MANUAL}] [-notification {TRUE | FALSE}] [-clbgoal {SHORT | LONG}] [-rlbgoal {NONE | SERVICE_TIME | THROUGHPUT}] [-failovertype {NONE | SESSION | SELECT | TRANSACTION | AUTO}] [-failovermethod {NONE | BASIC}] [-failoverretry ] [-failoverdelay ] [-failover_restore {NONE | LEVEL1}] [-edition ] [-pdb <pluggable_database>] [-sql_translation_profile <sql_translation_profile>] [-commit_outcome {TRUE | FALSE}] [-retention ] [replay_init_time <replay_initiation_time>] [-tablefamilyid <table_family_id>] [-drain_timeout ] [-stopoption <stop_option>] [-session_state {STATIC | DYNAMIC}] [-global_override] -db <db_unique_name> Unique name for the database -service Service name -role Role of the service (primary, physical_standby, logical_standby, snapshot_standby) -policy Management policy for the service (AUTOMATIC or MANUAL) -failovertype (NONE | SESSION | SELECT | TRANSACTION | AUTO) Failover type -failovermethod (NONE | BASIC) Failover method -failoverdelay <failover_delay> Failover delay (in seconds) -failoverretry <failover_retries> Number of attempts to retry connection -failover_restore <failover_restore> Option to restore initial environment for Application Continuity and TAF (NONE or LEVEL1) -edition Edition (or "" for empty edition value) -pdb <pluggable_database> Pluggable database name -clbgoal (SHORT | LONG) Connection Load Balancing Goal. Default is LONG. -rlbgoal (SERVICE_TIME | THROUGHPUT | NONE) Runtime Load Balancing Goal -global_override <global_override> Override value to modify the global service attributes. Used with -role, -policy, -notification, -failovertype, -failovermethod, -failoverdelay, -failoverretry, -failover_restore, -edition, -maxlag and -gsmflags. Ignored for a non-global service. -notification (TRUE | FALSE) Enable Fast Application Notification (FAN) for OCI connections -sql_translation_profile <sql_translation_profile> Specify a database object for SQL translation profile -commit_outcome (TRUE | FALSE) Commit outcome -retention Specifies the number of seconds the commit outcome is retained -replay_init_time <replay_initiation_time> Seconds after which replay will not be initiated -session_state <session_state> Session state consistency (STATIC or DYNAMIC) -tablefamilyid <table_family_id> Set table family ID for a given service -drain_timeout <drain_timeout> Service drain timeout specified in seconds -stopoption <stop_options> Options to stop service (e.g. TRANSACTIONAL or IMMEDIATE) -verbose Verbose output -help Print usage

jschampera avatar Mar 24 '21 13:03 jschampera

I already mentioned this in issue #141. But it seems development on this great work has almost come to a halt.

matthiaslink77 avatar Jun 15 '21 18:06 matthiaslink77

Seems like this is caused by wrong/unfavourable initialization of 2 lists. In the end this leads to srvctl commands with "-preferred" and "-available" to be built also in non-RAC environments.

Modified oracle_services in a fork: https://github.com/mapausch/ansible-oracle-modules/blob/master/oracle_services

On my Single Instance environment this works, but don't have a RAC environment where I can test if it still works on RAC. So for now I don't want to go for a PR.

mapausch avatar Mar 05 '24 10:03 mapausch