title test1-更新数据库
@echo off
(
echo set feedback off heading off term off
echo set pages 0 trim on trims on lines 32767 long 999999
echo set echo off
echo spool test1_dropTable.sql
echo select 'Alter table '^|^|TABLE_NAME^|^|' '^|^|'drop constraint'^|^|' '^|^| CONSTRAINT_NAME^|^|';' from user_constraints where CONSTRAINT_TYPE ^='R';
echo select 'drop table ' ^|^| TABLE_NAME ^|^| ' ' ^|^| ';' from user_tables;
echo spool off
echo exit
) > test1_delTableTmp.sql
sqlplus test1/test1@192.168.0.22:1521/vonda @"%~dp0test1_delTableTmp.sql"
del "%~dp0test1_delTableTmp.sql"
echo exit >> test1_dropTable.sql
sqlplus test1/test1@192.168.0.22:1521/vonda @"%~dp0test1_dropTable.sql"
del "%~dp0test1_dropTable.sql"
echo test1/test1@192.168.0.22:1521/vonda 删除完成
timeout 1
set /a t1=%time:~0,2%
if %t1% LSS 10 set t1=0%t1%
timeout 1
set dmpFilePath=C:\oracle\backups\oracle_test1_%date:~0,4%-%date:~5,2%-%date:~8,2%_%t1%%time:~3,2%%time:~6,2%.dmp
exp test1/test1@192.168.0.17:1521/vonda file=%dmpFilePath% log=%dmpFilePath%.exp.log direct=y owner=test1
timeout 5
imp test1/test1@192.168.0.22:1521/vonda file=%dmpFilePath% log=%dmpFilePath%.imp.log full=y ignore=y
::完
::注 需要sys给用户赋予dba权限grant dba to test1;
::如果需要每天定时更新
::开始-所有程序-管理工具-任务计划程序
::创建基本任务-名称-(按需求)下一步-启动程序-浏览上面的信息保存的bat-下一步-完成