private JobInfoObject CreateBackupJob(RecoveryOperation opContext) { JobInfoObject infoObject = null; RecoveryJobBase dataJob = null; RecoveryJobBase opLogJob = null; #region BackupJob SubmitBackupOpParams bckpParam = (SubmitBackupOpParams)opContext.Parameter; // create handler object infoObject = new JobInfoObject(opContext.JobIdentifer, _context.LocalShardName, _context.LocalAddress.ip, _context.ClusterName, RecoveryJobType.DataBackup, bckpParam.PersistenceConfiguration.FilePath); foreach (string db in bckpParam.PersistenceConfiguration.DbCollectionMap.Keys) { //assuming one database is sent dataJob = new DatabaseBackupJob(opContext.JobIdentifer, _context, db, bckpParam.PersistenceConfiguration.DbCollectionMap[db][db].ToList(), infoObject.RecoveryPersistenceManager, _context.ClusterName); dataJob.RegisterProgressHandler(this); infoObject.AddJob(dataJob); // set persistence configuration if (bckpParam.PersistenceConfiguration.FileName == null) { bckpParam.PersistenceConfiguration.FileName = new List <string>(); bckpParam.PersistenceConfiguration.FileName.Add(db);//add name of all databases for shard level job } infoObject.RecoveryPersistenceManager.SetJobConfiguration(RecoveryJobType.DataBackup, bckpParam.PersistenceConfiguration, db, 1); } #endregion return(infoObject); }
static void Main(string[] args) { //1. Back up Employee Table DatabaseBackupJob.BackUp(); //2. Drop Employee Table & Create it again DatabaseCreateJob.Create(); //3. Read the Employees.csv using CSVHelper EmployeeReader reader = new EmployeeReader(); List <Employee> employees = reader.Read(ConfigurationManager.AppSettings["DataFile"]); //4. Insert each Employee into EmployeeTable SqlBulkCopyJob.Copy(employees); //5. Run All PLSQLs /* * CALCULATED TABLES * * STORED PROCEDURE * CALCULATE_HEADCOUNT_BY_DEMOGRAPHICS * * * * * */ }