共需要创建两个文件在同一个目录下: 一: 文件oracle_cool_backup.bat,内容如下: Remark 定义时间日期变量 set date=%date:~0,10% set h=%time:~0,2% set m=%time:~3,2% set s=%time:~6,2% set tempvar=%date%-%h%-%m%-%s% md "c:/temp/%tempvar%/" echo %tempvar% sqlplus /nolog @oracle_cool_backup.sql %tempvar% call oracle_cool_backup_spool.bat pause 二:文件oracle_cool_backup.sql,内容如下: Remark oracle_cool_backup.sql Remark 冷备份脚本 Remark 设置SQL*Plus环境变量 conn sys/sunny as sysdba; set feedback off heading off verify off trimspool off set pagesize 0 linesize 200 Remark 设置用户变量 define spoolfile = 'oracle_cool_backup_spool.bat' prompt *** spooling to &spoolfile Remark 创建包含备份命令的脚本文件 spool &spoolfile Remark 下面的e:/temp/&1后必须加"/" 不然提示还是目录名(F = 文件,D = 目录)? select 'copy ' || name || ' c:/temp/&1/' from v$datafile; select 'copy ' || name || ' c:/temp/&1/' from v$controlfile; select 'copy ' || member || ' c:/temp/&1/' from v$logfile; select 'copy ' || name || ' c:/temp/&1/' from v$tempfile; spool off; Remark 关闭数据库 shutdown immediate; exit;