def main(): Instance_line={} params = parametertools.parse_dma_params() install_path = params['Install Path'] db2_install = db2tools.DB2Installation(install_path) db2_install.find_instances_and_das() ## Extract the instance details found on the target machine ## Instance_line = db2_install.instances ## First Instance in the instances found on the target ## if Instance_line: first_inst_name = Instance_line.keys()[0] instance_to_set = first_inst_name steplog.debug(first_inst_name) if instance_to_set: ## Setup the default DB2 Instance on target machine environment ## os.environ["DB2INSTANCE"] = instance_to_set.strip() steplog.debug(os.environ["DB2INSTANCE"]) inst_fix_pack = get_installed_fixpack_version(install_path) media_fixpack = get_db2_binary_fixpack_version(params['Stage Archive']) if not int(media_fixpack) > int(inst_fix_pack): steplog.error("A greater version or same version of Fix pack %s is already installed" % inst_fix_pack) sys.exit(1) states = get_software_states(db2_install) shutdown_software(db2_install, states) for key, value in states.items(): if isinstance(value, list): params[key] = ','.join(value) else: params[key] = value parametertools.print_header(params)
def print_header(): parametertools.print_header({ 'Archive Lag Target': ARCHIVE_LAG_TARGET, 'Change Remote Login Passwordfile on Primary': CHG_REMOTE_LOGIN_PSWDFILE, 'DB File Name Convert': DB_FILE_NAME_CONVERT, 'Data Guard Standby Type': DG_STANDBY_TYPE, 'Database Protection Mode': DB_PROTECTION_MODE, 'Listener File Location': LISTENER_FILE_LOCATION, 'Location for Controlfiles on Standby Server': STANDBY_CTL_FILE_LOCATION, 'Log Archive Dest 1': LOG_ARCHIVE_DEST_1, 'Log File Name Convert': LOG_FILE_NAME_CONVERT, 'Number of RMAN Auxiliary Channels': NUM_RMAN_AUX_CHANNELS, 'Number of RMAN Primary Channels': NUM_RMAN_PRIMARY_CHANNELS, 'Oracle Home': oracle_home, 'Oracle OS User': ORACLE_OS_USER, 'Oracle User': ORACLE_USER, 'Oracle sys Password': ORACLE_SYS_PASSWORD, 'Oratab File Location': ORATAB_LOCATION, 'Primary DB Instance Name': PRIMARY_DB_INSTANCE_NAME, 'Primary DB Listener Port Number': PRIMARY_DB_LISTENER_PORT, 'Primary Database Name': PRIMARY_DB_NAME, 'Primary Node Hostnames': ",".join(PRIMARY_NODE_HOSTNAMES), 'Standby DB Listener Port Number': STANDBY_DB_LISTENER_PORT, 'Standby DB Prefix Name': STANDBY_PREFIX, 'Standby Node Hostnames': ",".join(STANDBY_NODE_HOSTNAMES), 'Standby Service Name': standby_svc_name, 'Tnsnames File Location': TNSNAMES_FILE_LOCATION, 'Update oratab file on Standby Servers': UPDATE_STANDBY_ORATAB_FILE, })
def main(): steplog.info("------------------------------------------------------") steplog.info("Shutting down the DB2 Instances to patch fixpack") steplog.info("------------------------------------------------------") Instance_line={} # params = parametertools.parse_dma_params() install_path = params['Install Path'] db2_install = db2tools.DB2Installation(install_path) db2_install.find_instances_and_das() ## Extract the instance details found on the target machine ## Instance_line = db2_install.instances ## First Instance in the instances found on the target ## if Instance_line: first_inst_name = Instance_line.keys()[0] instance_to_set = first_inst_name steplog.debug(first_inst_name) if instance_to_set: ## Setup the default DB2 Instance on target machine environment ## os.environ["DB2INSTANCE"] = instance_to_set.strip() steplog.debug(os.environ["DB2INSTANCE"]) inst_fix_pack = get_installed_fixpack_version(install_path) media_fixpack = get_db2_binary_fixpack_version(params['Stage Archive']) custom_fixpack = params['If Custom Fixpack'] custom_fixpack = custom_fixpack.strip() print custom_fixpack if custom_fixpack== "true" or custom_fixpack == "yes" or custom_fixpack == "y": steplog.info("The current version of fixpack determined from the binary is of the same version as of on the target. Custom fixpack will be installed") inst_fix_build_num = get_installed_fixpack_build(params['Install Path']) print "Installed fixpack build : %s" % inst_fix_build_num media_build_num = get_db2_binary_build_version(params['Stage Archive']) if not media_build_num or inst_fix_build_num: if not int(media_build_num) > int(inst_fix_build_num): steplog.error("A greater version or same version of Fixpack build %s is already installed" % inst_fix_build_num) sys.exit(1) else: if not int(media_fixpack) > int(inst_fix_pack): steplog.error("A greater version or same version of Fix pack %s is already installed" % inst_fix_pack) sys.exit(1) states = get_software_states(db2_install, install_path) shutdown_software(db2_install, states) for key, value in states.items(): if isinstance(value, list): params[key] = ','.join(value) else: params[key] = value parametertools.print_header(params)
def print_header(): system_password = default_system_password if not pythontools.is_dma_param_null(DBCA_PASSWORD_ALL): system_password = DBCA_PASSWORD_ALL elif not pythontools.is_dma_param_null(DBCA_PASSWORD_SYSTEM): system_password = DBCA_PASSWORD_SYSTEM parametertools.print_header({ 'DBCA Response File': response_dbca.encode('ascii'), 'System Password': system_password, 'System Username': '******', 'FRA Location': FRA_LOC, })
def main(): steplog.info('Setup Network Configuration on Primary and Standby Servers') set_defaults() get_listener_ports() steplog.info("ORACLE_HOME : %s" % ORACLE_HOME) steplog.info("tnsnames file location: %s" % tns_file_location) steplog.info("listener file location: %s" % lsnr_file_location) primary_hosts = PRIMARY_NODE_HOSTNAMES standby_hosts = STANDBY_NODE_HOSTNAMES # prime the status dict with True values status = {} # key by host, boolean value for host in primary_hosts + standby_hosts: status[host] = True is_valid = update_tnsnames_all_nodes(primary_hosts, standby_hosts, status) if not is_valid: steplog.error('Error updating tnsnames on some host(s)') sys.exit(1) is_valid = update_listenerora_all_nodes(primary_hosts, standby_hosts, status) if not is_valid: steplog.error('Error updating listener.ora on some standby host(s)') sys.exit(1) # now, exit with a success code, if and only if there aren't any # False entries for any host in the status dict failures = [host for host in status.keys() if status[host] != True] if len(failures) > 0: sys.exit(1) set_params(params, standby_hosts[0]) parametertools.print_header(params) steplog.info( 'Setup Network Configuration on Primary and Standby Servers successful. You may proceed.' ) sys.exit(0)
def print_header(params): print threading.currentThread().getName(), 'Starting' parametertools.print_header(params)