批处理文件:backup.bat
set expfile=%date:~0,4%%date:~5,2%%date:~8,2%
sqlplus aaaa/111111 as sysdba @D:\expbak\aaaa.sql
expdp aaaa/111111@orcl dumpfile=aaaa%expfile%.dmp directory=expdir
"D:\Program Files\WinRAR\rar.exe" a d:\expbak\aaaa%expfile%.rar d:\expbak\aaaa%expfile%.dmp -r
aaaa.sql
set echo on
create or replace directory expdir as 'D:/expbak';
grant read,write on directory expdir to aaaa;
set echo off
exit
还原脚本
drop user zfmi cascade;
drop tablespace zfmi including contents and datafiles cascade onstraints;
create tablespace aaaa datafile 'D:\app\Administrator\oradata\orcl\aaaa.dbf' size 100m autoextend on next 50m maxsize unlimited extent management local;
create user aaaa identified by 111111 default tablespace aaaa temporary tablespace temp;
grant connect,resource,dba to aaaa;
create or replace directory impdir as 'D:/app/expbak';
grant read,write on directory impdir to aaaa;