`

按日期区分exp导出的文件名称

阅读更多

方法一、通过数据库查询获取日期

 

1、创建expbydt.sql脚本

 

column today new_val dt
select to_char(sysdate,'yyyymmdd') today from dual;
host exp userid=test/test@acf file=d:\exp_test_&dt..dmp log=d:\exp_test_&dt..log
exit

 

2、创建startbak.bat批处理文件

 

echo off
sqlplus test/test@acf @expbydt.sql

 

3、通过命令运行startbak.bat执行逻辑备份

 

4、可以通过Window上的定时任务来定时执行这个任务了

 

 

方法二、通过操作系统获取日期

 

1、创建startbak.bat批处理文件

 

echo off
exp userid=test/test@acf full=y file=d:\exp_test_%date:~0,10%.dmp log=d:\exp_test_%date:~0,10%.log

 

3、通过命令运行startbak.bat执行逻辑备份

 

4、可以通过Window上的定时任务来定时执行这个任务了

 

说明:

在linux/unix 上的时间定义就显得更为简单

[oracle@jumper oracle]$ exp test/test file=test_'date+%Y%M%d'

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics