You are on page 1of 2

JOB_Rollback_EDW

Try -->WF_EDW_Rollback
Script:Rollback_LoadEDW
###################################################################################
########
###
### Rollback changes to the EDW tables
###
###################################################################################
########

#Passing null, null includes all tables in rollback

if (BF_GetGWCRFlag() = 'Y')
begin

PRINT('Begin EDW Rollback');

IF (upper(BF_GetDatabaseTypeDW( )) = 'SQL')
BEGIN
sql('EDW_DS', 'exec GP_ROLLBACK_ALL null, null;');
END

IF (upper(BF_GetDatabaseTypeDW( )) = 'ORACLE')
BEGIN
sql('EDW_DS', 'CALL PKG_GWCR_UTILS.GP_ROLLBACK_ALL(null, null)');
END

PRINT('End EDW Rollback');

end

FUNCTIONS:
BF_GetGWCRFlag()
## Function: BF_GetGWCRFlag
## Purpose: Get ROLLBACK_FL from ETL_USER_CONFIGS file
## Parameters: none
## Returns: 'Y' or 'N'
## Notes:
##
## History: 09.Dec.2013 Initial Creation

$GWCR_FL = upper(
lookup_ext([ODS_DS.ODS.ETL_USER_ETL_CONFIG,'PRE_LOAD_CACHE','MAX'], [ROLLBACK_FL],
['Y'],[CONFIG,'=',current_system_configuration()]) SET
("run_as_separate_process"='no', "output_cols_info"='<?xml version="1.0"
encoding="UTF-8"?><output_cols_info><col index="1" expression="no"/>
</output_cols_info>' ));

IF ($GWCR_FL ='Y')
$GWCR_FL =
ifthenelse( upper(lookup_ext([ODS_DS.ODS.ETL_ODS_CYCLE_CONTROL_PARM,'PRE_LOAD_CACHE
','MAX'], [BYPASS_ROLLBACK_FL],['Y'],[CONFIG,'=',current_system_Configuration()])
SET ("run_as_separate_process"='no', "output_cols_info"='<?xml version="1.0"
encoding="UTF-8"?><output_cols_info><col index="1" expression="no"/>
</output_cols_info>' )) = 'Y','N','Y');
IF (not $GWCR_FL in ( 'Y', 'N'))
BF_LogError('Invalid ROLLBACK_FL OS on ETL_USER_ETL_CONFIG', 50001);

RETURN
$GWCR_FL;

Function:BF_GetDatabaseTypeDW( )
## Function: BF_GetDatabaseTypeDW
## Purpose: Get DW Database Type
## Parameters: none
## Returns: 'ORACLE' or 'SQL'
## Notes:
##
## History: 15.Dec.2012 Millbrook Base Version (Initial Comment)

$DWDatabaseType = upper(
lookup_ext([ODS_DS.ODS.ETL_USER_ETL_CONFIG,'PRE_LOAD_CACHE','MAX'],
[DW_DATABASE_TYPE],[NULL],[CONFIG,'=',current_system_configuration()]) SET
("run_as_separate_process"='no', "output_cols_info"='<?xml version="1.0"
encoding="UTF-8"?><output_cols_info><col index="1" expression="no"/>
</output_cols_info>' ));

if ($DWDatabaseType is null)
begin
$DWDatabaseType = datastore_field_value('ODS_DS', 'database_type');
if ($DWDatabaseType = 'Microsoft_SQL_Server')
$DWDatabaseType = 'SQL' ;
else
$DWDatabaseType = 'ORACLE' ;
end

IF (not $DWDatabaseType in ( 'ORACLE', 'SQL'))


BF_LogError('Invalid Database on ETL_USER_ETL_CONFIG {$DWDatabaseType}',
50001);

RETURN
$DWDatabaseType ;

You might also like