在整理手上幾臺(tái)SQL SERVER 2000的數(shù)據(jù)庫(kù)備份時(shí),一方面為了方便快速還原數(shù)據(jù)庫(kù),另外一方面為了備份冗余、備份方式統(tǒng)一(先備份到本地,然后收上磁帶),將以前通過(guò)Symantec Backup Exec直接備份上帶的作業(yè)改成了如下方式:
Step 1: 通過(guò)數(shù)據(jù)庫(kù)維護(hù)計(jì)劃將備份生成在本地磁盤(pán)M,完整備份保留2天,事務(wù)日志備份保留3天
M:/DB_BACKUP/FULL_BACKUP
M:/DB_BACKUP/LOG_BACKUP
Step 2: 備份完成后通過(guò)Symantec Backup Exec將備份文件收上磁帶。
但是發(fā)現(xiàn)即使SQL SERVER 2000的數(shù)據(jù)庫(kù)維護(hù)計(jì)劃設(shè)置了刪除幾天前的備份文件,但是發(fā)現(xiàn)根本沒(méi)有刪除過(guò)期備份。于是只好使用dos命令來(lái)處理。剛開(kāi)始想用forfiles命令,結(jié)果我搜索的時(shí)候,發(fā)現(xiàn)Windows 2000下沒(méi)有forfiles命令,后來(lái)通過(guò)從第三方復(fù)制過(guò)來(lái),發(fā)現(xiàn)Windows 2000下也可以使用forfiles(如果不借助于forfiles命令,直接用批處理命令完成這個(gè),那簡(jiǎn)直痛苦死了)
關(guān)于forfiles命令的語(yǔ)法如下所示
C:/>forfiles /?
FORFILES [/P pathname] [/M searchmask] [/S]
[/C command] [/D [+ | -] {yyyy-MM-dd | dd}]
Description:
Selects a file (or set of files) and executes a
command on that file. This is helpful for batch jobs.
Parameter List:
/P pathname Indicates the path to start searching.
The default folder is the current working
directory (.).
/M searchmask Searches files according to a searchmask.
The default searchmask is '*' .
/S Instructs forfiles to recurse into
subdirectories. Like "DIR /S".
/C command Indicates the command to execute for each file.
Command strings should be wrapped in double
新聞熱點(diǎn)
疑難解答