Get the App
SLTechnology News&Howtos  ›  Database  › 

Batch scripts that automatically back up mssql server databases and compress them

Shulou Source: shulou.com Published: 2022-05-31 18:06:17 10月29日 Update

This article introduces the relevant knowledge of "realizing automatic backup of mssql server database and compressed batch script". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!

The copy code is as follows:

@ ECHO ON set dongs% daterius 0Magnesia 10% set dudes% dvubs% set tweets% timeparts 0cover8% set tweets% tours% tours% set stamp=%p%%d%%t% set bakupfolder=F:\ backup\ rem 1 saves backup files by subdirectory 0 do not press set lay_in_subfolder=1 call: backupone foo call: backupone foo2 call: backupone foo3 call: backupone foo4 goto: EOF @ ECHO OFF: backupone setlocal echo% 1 set dbname=%1 if not exist% bakupfolder%%dbname% mkdir% bakupfolder%%dbname% if% lay_in_subfolder%==1 (set subfolder=%dbname%\) else set subfolder= rem echo% bakupfolder%%subfolder%%dbname%%stamp%.bak sqlcmd-U sa-P "sa"-S localhost-Q "backup database% dbname% to disk='%bakupfolder % subfolder%%dbname%%stamp%.bak' "" C:\ Program Files\ WinRAR\ RAR.exe "a-ep1-r-o +-M5-s-df"% bakupfolder%%subfolder%%dbname%%stamp% ".rar"% bakupfolder%%subfolder%%dbname%%stamp%.bak "endlocal&goto: EOF" batch script for automatic backup of mssql server database and compression "ends here Thank you for your reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!

Tags: Backup data database script code content more knowledge practicality achievement next dilemma subdirectory actual situation file article case tape Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Microsoft Huawei Shulou Tech Info NVidia OPPO Reno