溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點(diǎn)擊 登錄注冊 即表示同意《億速云用戶服務(wù)條款》

服務(wù)器常用批處理代碼是什么

發(fā)布時(shí)間:2021-09-29 13:58:58 來源:億速云 閱讀:80 作者:iii 欄目:開發(fā)技術(shù)

這篇文章主要講解了“服務(wù)器常用批處理代碼是什么”,文中的講解內(nèi)容簡單清晰,易于學(xué)習(xí)與理解,下面請大家跟著小編的思路慢慢深入,一起來研究和學(xué)習(xí)“服務(wù)器常用批處理代碼是什么”吧!

將下面的內(nèi)容保存為sqlreboot.bat,然后添加到計(jì)劃任務(wù)里,就可以實(shí)現(xiàn)一段時(shí)間后重啟sqlserver服務(wù)器了,防止sqlserver經(jīng)常占用內(nèi)存過高,導(dǎo)致網(wǎng)頁無法打開數(shù)據(jù)。

代碼如下:

net stop sqlserveragent 
net stop mssqlserver 
echo.wscript.sleep(50000)>s.vbs 
cscript //nologo s.vbs 
del s.vbs 
net start mssqlserver
net start sqlserveragent  


收縮sqlserver數(shù)據(jù)庫,清空日志文件

代碼如下:

DUMP TRANSACTION [數(shù)據(jù)庫名] WITH NO_LOG
BACKUP LOG [數(shù)據(jù)庫名] WITH NO_LOG
DBCC SHRINKDATABASE([數(shù)據(jù)庫名])



mysql數(shù)據(jù)庫下實(shí)現(xiàn)自動(dòng)備份并用winrar壓縮實(shí)現(xiàn)的批處理和php文件

代碼如下:

FOR /D %%i IN (*) DO D:\php\php5\php.exe -q D:\php\php5\backup.php %%i 


backup.php

代碼如下:

<?php 
if ($argc != 2 || in_array($argv[1], array('--help', '-?'))) { 
?> 
backup Ver 0.01, for Win95/Win98/WinNT/Win2000/WinXP on i32 
Copyright (C) 2000 ptker All rights reserved. 
This is free software,and you are welcome to modify and redistribute it 
under the GPL license 
PHP Shell script for the backup MySQL database. 
Usage: <?php echo $argv[0]; ?> <option> 
<option> can be database name you would like to backup. 
With the --help, or -? options, you can get this help and exit. 
<?php 
} else { 
$dbname = $argv[1]; 
$dump_tool = "D:\\php\\mysql\\bin\\mysqldump.exe"; 
$rar_tool = "D:\\program\\winrar\\rar.exe"; 
$dateml=date("Ymd");
$yesday=date('Ymd' , strtotime('-6 day'));
@exec("md F:\\sqldata\\mysqlbak\\$dateml");
@rmdir("F:\\sqldata\\mysqlbak\\$yesday"); 
//@exec("$dump_tool --single-transaction --opt -u root -pxzqcABCD986 $dbname > ./$dbname.sql"); 
//@exec("$rar_tool a -ag_yyyy_mm_dd_hh_mm F:\\sqldata\\mysqlbak\\{$dateml}\\$dbname.rar $dbname.sql"); 
@exec("$rar_tool a -ag_yyyy_mm_dd_hh_mm F:\\sqldata\\mysqlbak\\{$dateml}\\$dbname.rar D:\\php\\mysql\\data\\$dbname"); 
@rmdir($dbname); 
echo "Backup complete!"; 

?>

感謝各位的閱讀,以上就是“服務(wù)器常用批處理代碼是什么”的內(nèi)容了,經(jīng)過本文的學(xué)習(xí)后,相信大家對服務(wù)器常用批處理代碼是什么這一問題有了更深刻的體會,具體使用情況還需要大家實(shí)踐驗(yàn)證。這里是億速云,小編將為大家推送更多相關(guān)知識點(diǎn)的文章,歡迎關(guān)注!

向AI問一下細(xì)節(jié)

免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。

php
AI