Sybase automatic backup method

xiaoxiao2021-03-06  83

Procedure on the database server: 1. Create a folder F: / dbak2. Inf: / dbbak, create two text files dump.sql, dump.bat3. Set dump.bat as planned task, execute 3:00 daily

--------------------------- Dump.sql content is as follows: Use mastergodump database report to 'f: /dbbak/report.dat' / * You can add multiple backup statements * / go --------------------------- Dump.bat contents as follows:

@echo offfor / f "tokens = 1-3 delims = -" %% I in ('Date / T') do set date = %% i - %% J - %% Kisql -udumper -sdbsvr -if: / dbak /Dump.sql -dmaster -ppasswordif not exist% DATE% / NUL MD% DATE% MOVE * .DAT% DATE% To increase the function of automatically deleting old files, you can:

1. Create a text file f: /dbbak/mydel.vbs The content is as follows: DIM FS, F, F1, FC, S set fs = createObject ("scripting.filesystemObject") set f = fs.getfolder ("f: / dbbak" ) SET FC = F.Subfolders for Each F1 in FC if Datediff ("D", F1.DateLastmodified, Date ())> 10 TENF: / DBBAK / "& F1.NAME END IF NEXT

2. Last increase in dump.bat file: CScript f: /dbbak/mydel.vbs

If you modified above, F: / dbbak / next file only saves the files that automatically backed up in the last 11 days. If you need to save more, modify Datediff ("D", f1.datelastmodified, Date ())> 10 is changed, can

转载请注明原文地址:https://www.9cbs.com/read-107158.html

New Post(0)