diff --git a/client/controller/build.gradle b/client/controller/build.gradle index 703db99..2c898d0 100644 --- a/client/controller/build.gradle +++ b/client/controller/build.gradle @@ -52,6 +52,7 @@ dependencies { // For Oracle, create the directory client/controller/libs and copy the driver // (e.g., ojdbc8.jar) into it. The driver must be manually downloaded from Oracle. + dependencies {compile files('lib/ojdbc8.jar')} } run { diff --git a/client/driver/driver_config.py b/client/driver/driver_config.py index f8fa089..d17f60b 100644 --- a/client/driver/driver_config.py +++ b/client/driver/driver_config.py @@ -68,6 +68,10 @@ PG_DATADIR = '/var/lib/postgresql/9.6/main' # ORACLE-SPECIFIC OPTIONS >>> ORACLE_AWR_ENABLED = False +ORACLE_FLASH_BACK = True +RESTORE_POINT = 'tpcc_point' +RECOVERY_FILE_DEST = '/opt/oracle/oradata/ORCL' +RECOVERY_FILE_DEST_SIZE = '15G' #========================================================== diff --git a/client/driver/fabfile.py b/client/driver/fabfile.py index a579d6c..65678e6 100644 --- a/client/driver/fabfile.py +++ b/client/driver/fabfile.py @@ -415,15 +415,23 @@ def upload_batch(result_dir=None, sort=True, upload_code=None): @task def dump_database(): dumpfile = os.path.join(dconf.DB_DUMP_DIR, dconf.DB_NAME + '.dump') - if file_exists(dumpfile): + if not dconf.ORACLE_FLASH_BACK and file_exists(dumpfile): LOG.info('%s already exists ! ', dumpfile) return False - LOG.info('Dump database %s to %s', dconf.DB_NAME, dumpfile) + if dconf.ORACLE_FLASH_BACK: + LOG.info('create restore point %s for database %s in %s', dconf.RESTORE_POINT, + dconf.DB_NAME, dconf.RECOVERY_FILE_DEST) + else: + LOG.info('Dump database %s to %s', dconf.DB_NAME, dumpfile) if dconf.DB_TYPE == 'oracle': - run_sql_script('dumpOracle.sh', dconf.DB_USER, dconf.DB_PASSWORD, - dconf.DB_NAME, dconf.DB_DUMP_DIR) + if dconf.ORACLE_FLASH_BACK: + run_sql_script('createRestore.sh', dconf.RESTORE_POINT, + dconf.RECOVERY_FILE_DEST_SIZE, dconf.RECOVERY_FILE_DEST) + else: + run_sql_script('dumpOracle.sh', dconf.DB_USER, dconf.DB_PASSWORD, + dconf.DB_NAME, dconf.DB_DUMP_DIR) elif dconf.DB_TYPE == 'postgres': run('PGPASSWORD={} pg_dump -U {} -h {} -F c -d {} > {}'.format( @@ -434,19 +442,28 @@ def dump_database(): return True +@task +def clean_recovery(): + run_sql_script('removeRestore.sh', dconf.RESTORE_POINT) + cmds = ("""rman TARGET / <= 0, \ '{} wrong metric type: {} (start={}, end={}, diff={})'.format( met_name, MetricType.name(met_info.metric_type), start_val,