windows 脚本备份kingbasev8
时间: 2023-05-24 09:02:36 浏览: 298
.0数据库
可以使用以下脚本备份Kingbase数据库:
```
@echo off
set "backup_dir=C:\backup"
set "kingbase_dir=C:\Program Files (x86)\kingbase8.0"
set "backup_file=%backup_dir%\kingbase8.0_db_backup_%date:~-4%_%date:~4,2%_%date:~7,2%.backup"
set "cmd_file=%backup_dir%\kingbase_backup.cmd"
echo backup > %cmd_file%
echo init > %cmd_file%
echo connect -user system -password kingbase123 >> %cmd_file%
echo set backup mode to file >> %cmd_file%
echo set controlfile autobackup on >> %cmd_file%
echo set controlfile autobackup format for device type disk to '%backup_dir%\kingbase8.0_controlfile_%date:~-4%_%date:~4,2%_%date:~7,2%.backup' >> %cmd_file%
echo backup database plus archivelog tag 'kingbase_backup_%date:~-4%_%date:~4,2%_%date:~7,2%' format '%backup_file%' >> %cmd_file%
echo exit >> %cmd_file%
cd /d "%kingbase_dir%\bin"
kbackup @%cmd_file%
echo Backup finished.
```
这段脚本会将Kingbase 8.0数据库备份至C:\backup文件夹下,并使用当前日期作为备份文件名的一部分。在备份过程中还会自动备份控制文件。备份完成后,会在控制台输出“Backup finished.”的提示信息。
阅读全文