Database Reference
In-Depth Information
emcli create_blackout -name="${BO_NAME}"
-add_targets=${thisTARGET}:oracle_database
-schedule="duration::360;tzinfo:specified;tzregion:America/Los_Angeles"
-reason="Scripted blackout for maintenance or refresh"
}
function EndBlackout {
echo "\n\nStopping blackout '${BO_NAME}' ...\n"
emcli stop_blackout -name="${BO_NAME}"
echo "\n\nDeleting blackout '${BO_NAME}' ...\n"
emcli delete_blackout -name="${BO_NAME}"
}
Once the library is created, you're free to leverage these same functions across all of your scripts, even at the
command line. For instance, let's say you need to blackout the databases on a particular server for operating system
patches. At the command, you'd source the function library and then call the functions as needed. Files are sourced
by typing a period, a space, and then the file name. For instance, when you log into a Unix/Linux server, your user
profile will source the .bashrc and .bash_profile (if Bash is your shell of choice) to load your environment variables
into memory. When you type the env command, it will reflect those values. Sourcing other files, like a function library,
loads paths, values, functions, or aliases from the new file into memory to supplement or replace the environment
variables already in place:
. /script/oem/emcli_functions.lib
for thisSID in suzie, sally, betty, veronica; do
BO_NAME=os_patch_blackout_${thisSID}
echo "Starting the blackout for ${thisSID}"
CreateBlackout ${BO_NAME}
done
You'd reverse this using a similar process when the work is done:
. /script/oem/emcli_functions.lib
for thisSID in suzie, sally, betty, veronica; do
BO_NAME=os_patch_blackout_${thisSID}
EndBlackout ${BO_NAME}
done
In addition to the simplicity of your run-time environment, either at the command line or in a script, you can
be assured that the code in the function library has been tested in other use cases. The function library also removes
opportunities for mistyped commands and forgotten steps.
 
Search WWH ::




Custom Search