BACKUP SQL BAT

回覆文章
yehlu
Site Admin
文章: 3245
註冊時間: 2004-04-15 17:20:21
來自: CodeCharge Support Engineer

BACKUP SQL BAT

文章 yehlu »

代碼: 選擇全部

@FOR /F "tokens=1-3 delims=/ " %%a IN ("%date%") DO (SET _MyDate=%%a%%b%%c)
@FOR /f "tokens=1-2 delims=: " %%a in ("%time%") DO (set _Mytime=%%a%%b)
SQLCMD -U sa -P amigo -S ERP2012 -Q "BACKUP DATABASE OMISYS TO DISK='C:\上華備份\%_MyDate%_%_Mytime%_sqlSYS.bak'"
SQLCMD -U sa -P amigo -S ERP2012 -Q "BACKUP DATABASE OMISQL01 TO DISK='C:\上華備份\%_MyDate%_%_Mytime%_sql01.bak'"
SQLCMD -U sa -P amigo -S ERP2012 -Q "BACKUP DATABASE OMISQL06 TO DISK='C:\上華備份\%_MyDate%_%_Mytime%_sql06.bak'"
SQLCMD -U sa -P amigo -S ERP2012 -Q "BACKUP DATABASE OMISQL07 TO DISK='C:\上華備份\%_MyDate%_%_Mytime%_sql07.bak'"
回覆文章

回到「SQL Server」