srvctl config service -d cmdbut
[dev-oragrid-ux01]cmdbut_01 (P):/devoragridcn_01/app/oracle> srvctl config service -d cmdbut
Service name: boms10.world
Service is enabled
Server pool: cmdbut_boms10.world
Cardinality: 1
Disconnect: false
Service role: PRIMARY
Management policy: AUTOMATIC
DTP transaction: false
AQ HA notifications: false
Failover type: NONE
Failover method: NONE
TAF failover retries: 0
TAF failover delay: 0
Connection Load Balancing Goal: LONG
Runtime Load Balancing Goal: NONE
TAF policy specification: NONE
Edition:
Preferred instances: cmdbut_01
Available instances: cmdbut_02
Service name: boms_cmdbut_01.world
Service is enabled
Server pool: cmdbut_boms_cmdbut_01.world
Cardinality: 1
Disconnect: false
Service role: PRIMARY
Management policy: AUTOMATIC
DTP transaction: false
AQ HA notifications: false
Failover type: NONE
Failover method: NONE
TAF failover retries: 0
TAF failover delay: 0
Connection Load Balancing Goal: LONG
Runtime Load Balancing Goal: NONE
TAF policy specification: NONE
Edition:
Preferred instances: cmdbut_01
Available instances: cmdbut_02
This is supposed to give values as shown in the output and I need distinct values for Preferred instances: and Available instances: which means that all distinct values of Preferred instances and all distinct values of Available instances .Here ,Preferred instances: distinct value is cmdbut_01 and Available instances is cmdbut_02
Please help me in writing a script on this.
Best regards,
Vishal
awk -F: ' # Set colon (:) as field separator
# Checking if pattern: Preferred instances exists in current record
/Preferred instances/ {
# Add last field value ($NF) to index of associative array: P
P[$NF]
}
# Checking if pattern: Available instances exists in current record
/Available instances/ {
# Add last field value ($NF) to index of associative array: A
A[$NF]
}
# END Rule
END {
# Print Preferred instances
printf ( "%s:", "Preferred instances" )
# For each key in array: P
for ( k in P )
# Print key (k)
printf ( "%s ", k )
# Print Available instances
printf ( "\n%s:", "Available instances" )
# For each key in array: A
for ( k in A )
# Print key (k)
printf ( "%s ", k )
printf "\n"
}
'
Preferred instances is still coming as empty.How to display PREFERRED now by matching PREF pattern and also I want to put this whole string to a variable which would contain both preferred and available instances and later on want to segregate preferred and available from that variable and assign that to 2 variables one for preferred and other for available