手机看片精品高清国产日韩,色先锋资源综合网,国产哺乳奶水91在线播放,乱伦小说亚洲色图欧洲电影

幫助中心 >  技術知識庫 >  數據庫 >  相關技術支持 >  Windows系統下Oracle數據庫每天自動備份

Windows系統下Oracle數據庫每天自動備份

2017-02-07 09:54:57 10170

Windows系統下Oracle數據庫每天自動備份


linux和unix下面使用shell可以很方便實現,如果windows環境下可以結合計劃任務實現

1.創建備份目錄d:ackup, 創建批處理命令Bak.bat,編寫備份腳本

exp user/passwd@orcl DIRECT=Y BUFFER=100000 FILE=D:ackupscdd%date:~0,10% OWNER=('scdd') LOG=D:ackupdata.log 
forfiles /p "D:ackup" /s /m *.dmp /d -3 /c "cmd /c del @path"

說明:

exp命令是oracle提供的dump備份命令,其中的%date:~0,10%是DOS里取日期的命令,例如:C:Usersqyy>echo %date:~0,10%得到2016-11-30

forfiles是windows的文件查找命令,查找在backup,dmp后綴產生三天的文件,找到后執行刪除操作

2.Windows定時任務每日自動執行批處理文件 3.保留最近三天的文件,自動刪除以前日期的備份文件

forfiles參數說明:

/P 可是搜索的路徑。在我們這里就是要在哪個目錄尋找要刪除的文件

/M 根據搜索掩碼搜索文件。默認為*,如果要找備份處dump文件,格式為*.dmp

/D 文件修改時間在某個時間之前或者之后。-3 表示3天之前的文件。

/s 包含子目錄

/C 表示為每個文件執行的命令,如果要刪除該文件可以為"cmd /c del /F /s /q @file"。其中變量@file表示該文件名 f s q表示強制靜默刪除可以不用;cmd /c表示執行字符串指定的命令然后終斷

其中@file可以返還如下結果,我們這里用@path


@file - returns the name of the file.

@fname - returns the file name without extension.

@ext - returns only the extension of the file.

@path - returns the full path of the file.

@relpath - returns the relative path of the file.

@isdir - returns "TRUE" if a file type is a directory, and "FALSE" for files. @fsize - returns the size of the file in bytes.

@fdate - returns the last modified date of the file.

@ftime - returns the last modified time of the file


以上就是介紹Windows系統下Oracle數據庫每天自動備份,希望對大家有所幫助。


提交成功!非常感謝您的反饋,我們會繼續努力做到更好!

這條文檔是否有幫助解決問題?

非常抱歉未能幫助到您。為了給您提供更好的服務,我們很需要您進一步的反饋信息:

在文檔使用中是否遇到以下問題: