日韩无码专区无码一级三级片|91人人爱网站中日韩无码电影|厨房大战丰满熟妇|AV高清无码在线免费观看|另类AV日韩少妇熟女|中文日本大黄一级黄色片|色情在线视频免费|亚洲成人特黄a片|黄片wwwav色图欧美|欧亚乱色一区二区三区

RELATEED CONSULTING
相關(guān)咨詢
選擇下列產(chǎn)品馬上在線溝通
服務(wù)時間:8:30-17:00
你可能遇到了下面的問題
關(guān)閉右側(cè)工具欄

新聞中心

這里有您想知道的互聯(lián)網(wǎng)營銷解決方案
SQLServer數(shù)據(jù)庫日志清除

SQL Server數(shù)據(jù)庫日志清除的兩個方法:

創(chuàng)新互聯(lián)自2013年起,先為嵩明等服務(wù)建站,嵩明等地企業(yè),進(jìn)行企業(yè)商務(wù)咨詢服務(wù)。為嵩明企業(yè)網(wǎng)站制作PC+手機(jī)+微官網(wǎng)三網(wǎng)同步一站式服務(wù)解決您的所有建站問題。

方法一

一般情況下,SQL數(shù)據(jù)庫的收縮并不能很大程度上減小數(shù)據(jù)庫大小,其主要作用是收縮日志大小,應(yīng)當(dāng)定期進(jìn)行此操作以免數(shù)據(jù)庫日志過大。

1、設(shè)置數(shù)據(jù)庫模式為簡單模式:打開SQL企業(yè)管理器,在控制臺根目錄中依次點開microsoft SQL Server-->SQL Server組-->雙擊打開你的服務(wù)器-->雙擊打開數(shù)據(jù)庫目錄-->選擇你的數(shù)據(jù)庫名稱(如論壇數(shù)據(jù)庫forum)-->然后點擊右鍵選擇屬性-->選擇選項-->在故障還原的模式中選擇“簡單”,然后按確定保存。

2、在當(dāng)前數(shù)據(jù)庫上點右鍵,看所有任務(wù)中的收縮數(shù)據(jù)庫,一般里面的默認(rèn)設(shè)置不用調(diào)整,直接點確定

3、收縮數(shù)據(jù)庫完成后,建議將您的數(shù)據(jù)庫屬性重新設(shè)置為標(biāo)準(zhǔn)模式,操作方法同***點,因為日志在一些異常情況下往往是恢復(fù)數(shù)據(jù)庫的重要依據(jù)。

方法二

以下為引用的內(nèi)容:

set nocount on
declare @logicalfilename sysname,
@maxminutes int,
@newsize int

use tablename
-- 要操作的數(shù)據(jù)庫名
select @logicalfilename = 'tablename_log',
-- 日志文件名
@maxminutes = 10,
-- limit on time allowed to wrap log.
@newsize = 1
-- 你想設(shè)定的日志文件的大小(m)

-- setup / initialize
declare @originalsize int
select @originalsize = size
from sysfiles
where name = @logicalfilename
select 'original size of ' + db_name() + ' log is ' +
convert(varchar(30),@originalsize) + ' 8k pages or ' +
convert(varchar(30),(@originalsize*8/1024)) + 'mb'
from sysfiles
where name = @logicalfilename
create table dummytrans
(dummycolumn char (8000) not null)

declare @counter int,
@starttime datetime,
@trunclog varchar(255)
select @starttime = getdate(),
@trunclog = 'backup log '
+ db_name() + ' with truncate_only'

dbcc shrinkfile (@logicalfilename, @newsize)
exec (@trunclog)
-- wrap the log if necessary.
while @maxminutes > datediff
(mi, @starttime, getdate()) -- time has not expired
and @originalsize =
(select size from sysfiles where name = @logicalfilename)
and (@originalsize * 8 /1024) > @newsize
begin -- outer loop.
select @counter = 0
while ((@counter < @originalsize / 16) and (@counter < 50000))
begin -- update
insert dummytrans values ('fill log')
delete dummytrans
select @counter = @counter + 1
end
exec (@trunclog)
end
select 'final size of ' + db_name() + ' log is ' +
convert(varchar(30),size) + ' 8k pages or ' +
convert(varchar(30),(size*8/1024)) + 'mb'
from sysfiles
where name = @logicalfilename
drop table dummytrans
set nocount off

上文介紹了SQL Server數(shù)據(jù)庫日志清除的兩種方法,如果大家有更多的好方法,歡迎那出來與我們一起分享。


網(wǎng)站欄目:SQLServer數(shù)據(jù)庫日志清除
瀏覽路徑:http://m.5511xx.com/article/cocghcc.html