DM备份还原笔记
还原
备份文件拆分(Linux)
当库体积太大时, 需要对备份文件进行拆分
# -b 输出文件大小
# -d 使用数字命名尾缀
# -a 尾椎的长度(默认2)
split -b 1G -d DB_DAMENG1_FULL_2023_09_23_01_00_22.bak DB_DAMENG1_FULL_2023_09_23_01_00_22.bak.
合并备份文件并解压(Windows)
d:
cd dm
copy /b DB_DAMENG1_FULL_2023_09_23_01_00_22.bak.* DB_DAMENG1_FULL_2023_09_23_01_00_22.bak
补充(Linux环境下打包后进行拆分)
tar -zcvf dmbak.tar.gz DB_DAMENG1_FULL_2023_09_16_01_00_53.bak | split -b 1G -d -a 2 - dmbak.tar.gz.
DM备份还原
backup database backupset '/data/dmbak/BACKUP_FILE_01';
--还原
./dmrman CTLSTMT="RESTORE DATABASE '/data/dmdata/DAMENG1/dm.ini' FROM BACKUPSET '/data/dmbak/BACKUP_FILE_01'"
--恢复
./dmrman CTLSTMT="RECOVER DATABASE '/data/dmdata/DAMENG1/dm.ini' FROM BACKUPSET '/data/dmbak/BACKUP_FILE01'"
--更新魔术
./dmrman CTLSTMT="RECOVER DATABASE '/data/dmdata/DAMENG1/dm.ini' UPDATE DB_MAGIC"
备份
-- 清理备份
SF_BAKSET_BACKUP_DIR_ADD('DISK','/data/dmbak');
CALL SP_DB_BAKSET_REMOVE_BATCH('DISK',SYSDATE-30);