Oracle Golden Gate Cheat Sheet
This blog contains some random scripts or infos regarding Oracle Golden Gate.
Extending the inactive session timeout
Sometimes the default timeout of a browser connection to the Administration Service or to the Service Manager seems to be a little low (30 minutes) and you want to increase it. Since it is currently not so easy to configure the timeout (I am using Oracle Golden Gate 23.5), I will provide some code to perform the changes. I will make some assumptions (protocol/Service Manager port/Service Manager username/Service Manager password) based on a default GoldenGate Installation. Feel free to change them for your environment. We will use the Golden Gate REST API to perform the changes. The new timeout will be 14400 seconds or 4 hours.
# run as root or another user
dname='depl1'
timeout=14400
hn=`hostname`
sm_url='https://'$hn':9000/services/v2/deployments/ServiceManager/services/ServiceManager'
as_url='https://'$hn':9000/services/v2/deployments/'$dname'/services/adminsrvr'
### Configure Admin Server ###
# get the current config and make the changes
curl -u ggma:changeme -k --progress-bar -H "Content-Type: application/json" -H 'Accept: application/json' -X GET $as_url |
# restart the AdminServer after making the changes
jq '.response|{config} + {"enabled": true} + {"status": "restart"}'|
# we will add the parameter sessionInactiveSecs and set it to the supplied value
jq '.config.authorizationDetails = .config.authorizationDetails + {"sessionInactiveSecs": '$timeout'}'|
# adjust the existing parameter sessionDurationSecs from 3600 to the supplied value
jq '.config.authorizationDetails.sessionDurationSecs = '$timeout >/tmp/j.json
# apply the config and restart the Admin Server
curl -u ggma:changeme -k --progress-bar -L -X PATCH $as_url \
-H 'Content-Type: application/json' -H 'Accept: application/json' -d @/tmp/j.json|jq
### Configure Service Manager ###
# get the current config and make the changes
curl -u ggma:changeme -k --progress-bar -H "Content-Type: application/json" -H 'Accept: application/json' -X GET $sm_url |
# restart the AdminServer after making the changes
jq '.response|{config} + {"status": "restart"}'|
# we will add the parameter sessionInactiveSecs and set it to the supplied value
jq '.config.authorizationDetails = .config.authorizationDetails + {"sessionInactiveSecs": '$timeout'}'|
# adjust the existing parameter sessionDurationSecs from 3600 to the supplied value
jq '.config.authorizationDetails.sessionDurationSecs = '$timeout >/tmp/j.json
# apply the config
curl -u ggma:changeme -k --progress-bar -L -X PATCH $sm_url \
-H 'Content-Type: application/json' -H 'Accept: application/json' -d @/tmp/j.json|jq
We can use the following REST calls to get the current settings of the 2 modified parameters.
dname='depl1'
hn=`hostname`
sm_url='https://'$hn':9000/services/v2/deployments/ServiceManager/services/ServiceManager'
as_url='https://'$hn':9000/services/v2/deployments/'$dname'/services/adminsrvr'
get_config() {
echo $2
curl -u ggma:changeme -k -s -H "Content-Type: application/json" -H 'Accept: application/json' -X GET $1 |
jq | egrep 'sessionInactiveSecs|sessionDurationSecs';
}
# Admin Server
get_config $as_url "Admin Server:"
# Service Manager
get_config $sm_url "Service Manager:"
Leave a Reply