dos下关于按照日期格式导出数据库dmp文件

Enn的数据库 2014-01-23

set /A dt=%date:~0,4%%date:~5,2%%date:~8,2%-10
set expdt=%DATE:~0,4%%DATE:~5,2%%DATE:~8,2%%TIME:~0,2%%TIME:~3,2%

del *%dt%*

exp lg_dbwizard/lg1qaz@oanet_172.23.8.37 file=d:\dmp\am\lg_dbwizard_%expdt%.dmp log=d:\dmp\am\lg_dbwizard_%expdt%.log
exp lg_base/lg1qaz@oanet_172.23.8.37 file=d:\dmp\am\lg_base_%expdt%.dmp log=d:\dmp\am\lg_base_%expdt%.log
exp lg_stpublish/lg1qaz@oanet_172.23.8.37 file=d:\dmp\am\lg_stpublish_%expdt%.dmp log=d:\dmp\am\lg_stpublish_%expdt%.log
exp lg_queue/11@oanet_172.23.8.37 file=d:\dmp\am\lg_queue_%expdt%.dmp log=d:\dmp\am\lg_queue_%expdt%.log

注释:

%date:~0,4%取date文件,从第0位开始往后取4位,即年份的阿拉伯数字;

%date:~5,2%从第5位开始往后取2位,即月份;

%date:~8,2%从第8位开始往后取2位,即当月的第几天。

相关推荐