bat批處理實現資料庫備份、壓縮、刪除
在專案運營的過程中,為保證資料庫能及時備份,我們一般啟動系統的定時任務來進行備份。以下bat指令碼實現刪除1天前的壓縮備份檔案,同時生成新的備份壓縮檔案
@echo off
rem 刪除1天前的資料庫備份
forfiles /m *.rar /d -1 /c "cmd /c del @file /f"
rem 生成備份資料庫
cd /d C:\Program Files\MySQL\MySQL Server 5.6\bin
SET filePath=D:\databackup\db\%date:~0,4%%date:~5,2%%date:~8,2%%time:~0,2%%time:~3,2%
SET sqlPath=%filePath%.sql
SET rarPath=%filePath%.rar
mysqldump.exe dbname -P 3306 -uroot -proot > %sqlPath%
rem 壓縮備份的資料庫檔案
"D:\Program Files (x86)\WinRAR\WinRAR.exe" a -ibck -m5 %rarPath% %sqlPath%
rem 刪除資料加檔案
del %sqlPath%
相關推薦
bat批處理實現資料庫備份、壓縮、刪除
在專案運營的過程中,為保證資料庫能及時備份,我們一般啟動系統的定時任務來進行備份。以下bat指令碼實現刪除1天前的壓縮備份檔案,同時生成新的備份壓縮檔案 @echo off rem 刪除1天前的資料庫備份 forfiles /m *.rar /d -1 /c
windows下bat批處理實現數據庫備份、壓縮、刪除
rar 備份數據庫 data game -i 批處理 android backup files @echo off rem 刪除7天前的數據庫備份 cd D:\db_bak\qd_web_project\dumpforfiles /m *.sql.gz /d -7 /c
dos.bat 批處理檔案的應用——批量壓縮
我經常在電腦上看漫畫,自從用了MangaMeeya後,通常都把下載下來的漫畫壓縮為rar檔案。這樣有幾個好處,一是節省空間,二是在電腦中,對一個檔案的處理速度要快於多個檔案,複製貼上就是一個例子,很多人應該都是感受,明明所複製的檔案容量不大,只是數量很多,速度卻比容量大一些,
使用bat批處理進行程式備份
@echo off rem 獲取當前資料夾的名字 set "lj=%~p0" set "lj=%lj:\= %" for %%a in (%lj%) do set wjj=%%a rem 建立一個版本的說明文件 cd.>README.txt rem 生
用計劃任務和批處理程式實現資料庫備份的自動異地儲存
第一步,在備份目的電腦上建立一個共享資料夾(需要密碼保護),並且將共享資料夾對映成本地磁碟(這裡映射出Z盤,後面程式碼中會出現)。 第二步,資料庫定期備份(以SQL2008舉例) 1、開啟SQL Server Management Studio,在物件資源管理器中依次點開l
SC命令---安裝、開啟、配置、關閉windows服務 bat批處理(轉載)
csdn 運行 call 命令 www. 刪除服務 net href onf 轉載:http://www.jb51.net/article/49627.htm 轉載:http://blog.csdn.net/c1520006273/article/details/50539
windows下使用bat批處理文件定時自動備份oracle數據庫並上傳ftp服務器
upd 使用 pup bye upload ora file ftp服務器 .bat 使用bat批處理文件備份oracle(前提是配置好oracle數據庫客戶端)在D盤目錄下創建個dbbackup目錄建個dbbak.bat @echo off echo ======
批處理實現mysql的備份
數據 www. sql數據庫 mysq mysqld nsa 備份命令 echo dbn 腳本 @echo off echo. echo MySQL數據庫備份 echo ***************************** echo. echo 今天是
BAT批處理修改MSDOS視窗標題、大小、字型及背景顏色
通過批處理Bat,可修改MSDOS視窗標題、大小、字型及背景顏色等,下面逐一為你介紹。 下面的方法,可在MSDOS視窗中直接使用程式碼,也可以將程式碼寫入BAT檔案中使用。 ①改變視窗大小 mode con cols=30 lines=20 ②設定cmd視窗的標題
Windows使用批處理實現備份機制
版本資訊 windows 7、windows server 2012 cwRsync_4.1.0_Installer.exe cwRsyncServer_4.1.0_Installer.exe winrar-x64-550sc.exe 獲取安裝包方法,文章結尾有說明!
用批處理檔案自動備份檔案及資料夾,並自動刪除n天前的檔案_DOS/BAT
下是備份的批處理,新增到”計劃任務”中,設定時間自動執行 程式碼如下: @echo off rem 格式化日期 rem date出來的日期是"2006-02-22 星期三",不能直接拿來使用,所以應該先格式化一下 rem 變成我們想要的。date
BAT批處理獲取IP、MAC
@echo off & setlocal enabledelayedexpansion echo =-----------------------------------------= echo = 本BAT只列出一個有
myeclipse匯出可執行jar包、bat批處理檔案雙擊執行jar包
一、myeclipse匯出可執行jar包: 右鍵專案->Export->選擇runnable jar file,下一步-> 點選finish完成。 說明: 1、Extract required libraries into generated JAR 選
使用批處理實現解析文字資料檔案寫入資料庫表
本文例項講述通過批處理解析文字資料檔案寫入資料庫表的實現方法。分享給大家供大家參考。具體實現方法如下: @echo off & setlocal enabledelayedexpansion :param set data_path=
bat批處理修改cmd視窗大小、標題、字型、背景顏色
通過批處理Bat,可修改cmd視窗標題、大小、字型及背景顏色等,下面逐一為你介紹。 下面的方法,可在cmd視窗中直接輸入程式碼命令,也可以將程式碼命令寫入bat檔案中使用。 ===============================================
Windows下通過bat批處理檔案和vbs指令碼實現守護程序
set _task=ISMClient.exeset _svr=C:\ISMClient\ISMClient.exeset _des=start1.bat :checkstartSET status=1 (TASKLIST|FIND /I "%_task%"||SET status=0) 2>nul 1
利用bat批處理啟動MongoDB資料庫
如: choice /c:dme defrag,mem,end 將顯示 defrag,mem,end[D,M,E]? Sample: Sample.bat的內容如下: @echo off choice /c:dme defrag,mem,end if errorlevel
用shell實現bat批處理的pause命令-追加改進
height pause continue brush ash cti linux 重定向 () 我參考了這個文章:用shell實現bat的pause http://linux-wiki.cn/wiki/zh-hans/%E7%94%A8shell%E5%AE%9E%E7
【沫沫金原創】Bat批處理完成Oracle數據庫7天備份自動刪除
存儲 images 問題 兩個 vpd 批處理 windows oss 使用 導讀 數據庫的備份是古老而不可忽視的話題,完成備份,隨著時間的推移,將會占用大量的空間,這是個問題?解決有兩個選項,1、增加存儲空間 2、保留最近備份。本篇重點介紹方案2 方案2 編寫bat腳本,
bat批處理文件運行時隱藏cmd窗口
wds 彈出 bsp 打開 close 窗口彈出 bject win 批處理 想讓bat運行時隱藏cmd窗口,最好的方法是使用vbs文件實現, 1、新建一個文本文檔,改名為123.vbs,編輯內容: set ws=WScript.CreateObject("WScript.