达梦归档定时备份和定时删除

达梦归档定时备份和定时删除

1 配置归档

alter database mount;
alter database add archivelog 'dest=C:\dmdbms\data\dmarch ,TYPE=local,FILE_SIZE=1024,SPACE_LIMIT=40000';
alter database archivelog;
alter database open;

2 打开代理

--归档备份(每天凌晨一点备份归档文件)
call SP_CREATE_JOB('archbak',1,0,'',0,0,'',0,'归档备份');

call SP_JOB_CONFIG_START('archbak');

call SP_ADD_JOB_STEP('archbak', 'archbak01', 6, '32000000C:\dmdbms\data\dmarchbak', 1, 1, 0, 0, NULL, 0);

call SP_ADD_JOB_SCHEDULE('archbak', 'archbak02', 1, 1, 1, 0, 0, '01:00:00', NULL, '2024-12-11 08:57:13', NULL, '');

call SP_JOB_CONFIG_COMMIT('archbak');


--归档备份定期删除(每天凌晨两点删除归档文件)
call SP_CREATE_JOB('delarchbak',1,0,'',0,0,'',0,'归档备份定期删除');

call SP_JOB_CONFIG_START('delarchbak');

call SP_ADD_JOB_STEP('delarchbak', 'delarchbak01', 0, 'SF_BAKSET_BACKUP_DIR_ADD(''DISK'',''C:\dmdbms\data\dmarchbak'');
CALL SP_ARCH_BAKSET_REMOVE_BATCH(''DISK'', NOW()-30);', 1, 1, 0, 0, NULL, 0);

call SP_ADD_JOB_SCHEDULE('delarchbak', 'delarchbak02', 1, 1, 1, 0, 0, '02:00:00', NULL, '2024-12-11 09:05:12', NULL, '');

call SP_JOB_CONFIG_COMMIT('delarchbak');

 

 

 

 

 

 

 

 

posted @ 2024-12-11 11:45  xuchuangye  阅读(2)  评论(0编辑  收藏  举报