Rem **************
Echo ===================================================== ================================>> backup. log
Echo start database backup time: % date % time %> Backup. Log
Rem backup database 2
Exp easyssh/easyssh @ 148 orcl file = D: \ backup \ dbbak \ vehes _ % Date :~ 0, 10%. dmp log = D: \ backup \ dbbak \ easyssh _ % Date :~ 8092. Log compress = n buffer = 10000 consistent = y direct = n constraints = y feedback = grants = y record = y indexes = y triggers = y rows = y
Rem ******** compressing Database Backup *************
Rem compression vehes Database Backup
C: \ progra ~ 1 \ WinRAR \ winrar.exe A-ibck D: \ backup \ rarbak \ easyssh _ % Date :~ 0, 102.16.rar D: \ backup \ dbbak \ easyssh _ % Date :~ 0, 10%. dmp D: \ backup \ dbbak \ easyssh _ % Date :~ 0, 10%. Log> Backup. Log
Rem *************
Del/f d: \ backup \ dbbak \ easyssh _ % Date :~ 0, 10%. dmp
Del/f d: \ backup \ dbbak \ easyssh _ % Date :~ 0, 10%. Log
Echo end database backup time: % date % time %> Backup. Log
Rem obtains the date of the previous 7 days.
Echo wscript. Echo dateadd ("D",-7, date)> % TMP % \ TMP. vbs
For/F "tokens = 1, 2, 3 delims =/-" % I in ('cscript/nologo % TMP % \ TMP. vbs ') do set Y = % I
For/F "tokens = 1, 2, 3 delims =/-" % I in ('cscript/nologo % TMP % \ TMP. vbs ') do set M = % J
For/F "tokens = 1, 2, 3 delims =/-" % I in ('cscript/nologo % TMP % \ TMP. vbs ') do set D = % K
If % m % LSS 9 set M = 0% M %
If % d % LSS 9 set D = 0% d %
Set deldate = % Y %-% m %-% d %
Rem deletes program backup seven days ago
Echo starts deleting D: \ backup \ rarbak \ * _1_deldate0000.rar at: % date % time %> Backup. Log
Del/f d: \ backup \ rarbak \ * _1_deldate0000.rar
Echo ends deleting D: \ backup \ rarbak \ * _1_deldate0000.rar at: % date % time %> Backup. Log
Rem starts to use the FTP client to connect and execute the script
@ Echo off
Echo open 10.131.98.80> backup_ftp.log
Echo XK> backup_ftp.log
Echo XK> backup_ftp.log
Echo send D: \ backup \ rarbak \ easyssh _ % Date :~ 0, 102.16.rar> backup_ftp.log
Echo bye> backup_ftp.log
FTP-S: backup_ftp.log
Rem Delete temporary files
Del/F backup_ftp.log
Rem **************
Echo ===================================================== ================================>> backup. log
Echo start database backup time: % date % time %> Backup. Log
Rem backup database 2
Exp vehes_admin/Oracle @ orcl92 file = D: \ backup \ dbbak \ vehes _ % Date :~ 0, 10%. dmp log = D: \ backup \ dbbak \ vehes _ % Date :~ 8092. Log compress = n buffer = 10000 consistent = y direct = n constraints = y feedback = grants = y record = y indexes = y triggers = y rows = y
Rem ******** compressing Database Backup *************
Rem compression vehes Database Backup
C: \ progra ~ 1 \ WinRAR \ winrar.exe A-ibck D: \ backup \ rarbak \ vehes _ % Date :~ 0, 102.16.rar D: \ backup \ dbbak \ vehes _ % Date :~ 0, 10%. dmp D: \ backup \ dbbak \ vehes _ % Date :~ 0, 10%. Log> Backup. Log
Rem *************
Del/f d: \ backup \ dbbak \ vehes _ % Date :~ 0, 10%. dmp
Del/f d: \ backup \ dbbak \ vehes _ % Date :~ 0, 10%. Log
Echo end database backup time: % date % time %> Backup. Log
Rem obtains the date of the previous 7 days.
Echo wscript. Echo dateadd ("D",-7, date)> % TMP % \ TMP. vbs
For/F "tokens = 1, 2, 3 delims =/-" % I in ('cscript/nologo % TMP % \ TMP. vbs ') do set Y = % I
For/F "tokens = 1, 2, 3 delims =/-" % I in ('cscript/nologo % TMP % \ TMP. vbs ') do set M = % J
For/F "tokens = 1, 2, 3 delims =/-" % I in ('cscript/nologo % TMP % \ TMP. vbs ') do set D = % K
If % m % LSS 9 set M = 0% M %
If % d % LSS 9 set D = 0% d %
Set deldate = % Y %-% m %-% d %
Rem deletes program backup seven days ago
Echo starts deleting D: \ backup \ rarbak \ * _1_deldate0000.rar at: % date % time %> Backup. Log
Del/f d: \ backup \ rarbak \ * _1_deldate0000.rar
Echo ends deleting D: \ backup \ rarbak \ * _1_deldate0000.rar at: % date % time %> Backup. Log
Rem starts to use the FTP client to connect and execute the script
@ Echo off
Echo open 127.0.0.1> backup_ftp.log
Echo XK> backup_ftp.log
Echo XK> backup_ftp.log
Echo send D: \ backup \ rarbak \ vehes _ % Date :~ 0, 102.16.rar> backup_ftp.log
Echo bye> backup_ftp.log
FTP-S: backup_ftp.log
Rem Delete temporary files
Del/F backup_ftp.log
Note: You must manually create two folders, D: \ backup \ dbbak and D: \ backup \ rarbak, on disk D ..