Tuesday, November 22, 2005

SQL Server 2000 数据库日志

SQL Server 2000 数据库对数据的事务会记录日志,并且能够根据日志回滚数据库操作,这个想必大家都知道。不过,如果日志变得很大,或者达到了限定的日志文件上限,就会对数据库产生较大的影响。

先来看看 SQL Server 2000 数据库日志文件的两种设定方式。


右下角可以设置日志文件的大小,上面一个选项是可以无限增大,后面一个选项是可以指定一个允许的最大值。数据库在运行过程中,这个日志文件会不断的增大,增大的速度视提供服务的压力而定。当这个文件达到预设的最大值时,任何数据库操作都会失败,会提示“无法写入日志”之类的报错信息;也可以允许这个文件无限增大,不过,当文件大到一定的程度,写入的效率会很低。笔者曾经遇到这个文件涨到 2.5 GB,在查明原因以前,整个系统莫名其妙效率降低很多,最后查到瓶颈在数据库。各种优化手段用上未果,最后发现日志是设置成无限增长的。把日志删除并把日志文件缩减后,问题解决。

因此,无论是让文件无限增长,还是设置文件最大值,都不可避免的遇到日志的删除和缩减问题。要缩减数据库日志,可以用查询分析工具 (SQL Query Analyzer) 运行如下命令:
DUMP TRANSACTION [db_name] WITH NO_LOG

然后如下图用“收缩数据库”(Shrink Database) 工具将删除后留下的空白空间收回。具体的:




然后选择“Files...”:


在“Database file”中选择日志对应的文件,一般是“[db_name]_Log”,“Shrink action”选择的第 4 项,将缩减的值设定为目前允许的最小值,然后点击“OK”即可。

13 comments:

飞 said...

非常感谢

Anonymous said...

lz在么,咨询一个问题
这个操作结束后,在系统日志中,出现
红色的记录,内容是18278,数据库日志已截断
是正常的么
在线等

Gregory said...

不好意思,因为没有遇到过类似的问题,所以不太清楚。

mao yun said...

8
timberland boots
nhl jerseys
ed hardy t-shirts
swarovski outlet
abercrombie
longchamp sale
hollister shirts
timberland outlet
coach factory outlet
iphone 6 cases
salvatore ferragamo
swarovski crystal
ray ban uk
abercrombie
louis vuitton handbags
herve leger sale
louis vuitton outlet
kate spade outlet
lebron 10,lebron 11,lebron 12
michael kors outlet
tod's shoes
jordan shoes
asics shoes
michael kors outlet
mont blanc
tory burch handbags
nfl jerseys wholesale
kobe 9 elite
converse shoes
prada handbags
mcm handbags
cheap nba jerseys
louis vuitton outlet uk
ray ban
christian louboutin outlet
air jordan concord
ray ban outlet
coach outlet online
mont blanc pens
cheap ray ban sunglasses
20150330maoqiuyun

Guo Guo said...

air max 90
bottega veneta outlet
nike air max uk
nike huarache
custom mlb jerseys
surpa sneakers
coach outlet
seattle seahawks jerseys
the north face uk
kansas city chiefs jerseys
nike outlet store
atlanta falcons jersey
chanel handbags
green bay packers jerseys
michael kors uk
los angeles clippers jerseys
burberry outlet
dallas cowboys jersey
nike running shoes
arizona cardinals jerseys
oakley sunglasses canada
the north face outlet
oakley sunglasses
real madrid jersey
cleveland cavaliers jersey
pittsburgh steelers jersey
north face jackets
soccer shoes
mizuno running
san francisco 49ers jerseys
dansko outlet
new orleans saints jerseys
new york jets jerseys
air jordan shoes
los angeles lakers jerseys
north face outlet
mulberry uk
hermes belt
stuart weitzman boots
washington redskins jerseys
wei20150610

oakleyses said...

oakley sunglasses, longchamp outlet, ugg boots, chanel handbags, nike air max, longchamp, christian louboutin outlet, michael kors outlet, oakley sunglasses, tiffany and co, replica watches, tory burch outlet, nike air max, ray ban sunglasses, michael kors outlet, louboutin shoes, jordan shoes, louis vuitton outlet, louis vuitton, ray ban sunglasses, longchamp outlet, polo ralph lauren outlet, replica watches, kate spade outlet, oakley sunglasses, polo ralph lauren outlet, cheap oakley sunglasses, ugg boots, nike free, tiffany jewelry, michael kors outlet, uggs on sale, louis vuitton outlet, michael kors, oakley sunglasses, louboutin, louis vuitton, michael kors outlet, ray ban sunglasses, prada handbags, louis vuitton, burberry, burberry outlet online, gucci outlet

oakleyses said...

nike blazer, michael kors, nike free run uk, nike air max, true religion jeans, true religion jeans, air jordan pas cher, nike air max, ralph lauren uk, timberland, air max, nike roshe, tn pas cher, louboutin pas cher, true religion outlet, vans pas cher, coach outlet, hermes, ralph lauren pas cher, nike free, coach purses, michael kors, oakley pas cher, mulberry, hollister pas cher, lacoste pas cher, new balance pas cher, ray ban pas cher, vanessa bruno, burberry, hollister, michael kors, kate spade handbags, coach outlet, abercrombie and fitch, lululemon, coach factory outlet, nike roshe run, north face, nike air max, ray ban uk, michael kors, true religion jeans, converse pas cher, north face, air force, hogan, sac longchamp, longchamp pas cher, sac guess

oakleyses said...

ferragamo shoes, iphone 6s plus cases, babyliss, longchamp, reebok shoes, nike trainers, asics running shoes, oakley, iphone 5s cases, celine handbags, hollister, nfl jerseys, jimmy choo shoes, birkin bag, iphone 6s cases, iphone cases, mcm handbags, bottega veneta, giuseppe zanotti, iphone 6 plus cases, abercrombie and fitch, p90x workout, beats by dre, herve leger, north face outlet, instyler, louboutin, soccer jerseys, lululemon, nike roshe, s5 cases, timberland boots, mac cosmetics, soccer shoes, valentino shoes, insanity workout, vans shoes, hollister, ralph lauren, wedding dresses, ipad cases, chi flat iron, north face outlet, iphone 6 cases, nike air max, ghd, mont blanc, baseball bats, new balance, nike huarache

oakleyses said...

ugg pas cher, vans, moncler, moncler, canada goose, louis vuitton, ugg boots uk, canada goose, toms shoes, doudoune canada goose, moncler, louis vuitton, louis vuitton, ugg australia, juicy couture outlet, moncler, supra shoes, doke gabbana outlet, gucci, karen millen, moncler outlet, hollister, moncler, hollister, canada goose, louis vuitton, ray ban, marc jacobs, pandora jewelry, michael kors outlet online, moncler, swarovski crystal, pandora jewelry, wedding dresses, thomas sabo, moncler, bottes ugg, sac louis vuitton pas cher, nike air max, barbour, barbour jackets, pandora charms, canada goose outlet, canada goose uk, michael kors outlet, converse outlet, links of london, canada goose outlet, pandora charms, canada goose

mmjiaxin said...

black friday deals
discount oakley sunglasses
oakley sunglasses wholesale
designer handbags,handbags outlet,cheap handbags,purses and handbags,wholesale handbags,designer bags,bags outlet,handbags wholesale,cheap purses,discount handbags,handbags sale,wholesale purses,handbags and purses,designer purses
mont blanc pens
swarovski outlet
camisetas futbol baratas
mulberry uk
valentino outlet
michael kors online outlet
fitflops sale
cheap wedding dresses
mlb jerseys
giuseppe zanotti outlet
converse shoes
soccer jerseys wholesale
tiffany and co
ferragamo outlet
true religion jeans
oakley sunglasses wholesale
mm1205

chenlili said...

chenlili20160629
air force 1
louboutin shoes
oakley vault
michael kors handbags
retro 11
ray ban sunglasses outlet
michael kors outlet
polo ralph lauren
coach outlet store online
adidas originals
tory burch handbags
coach outlet
louis vuitton purses
michael kors handbags
ray ban sunglasses outlet
coach outlet store online
rolex watches
designer handbags
louis vuitton bags
nike sb dunks
louis vuitton outlet stores
rolex watches
louis vuitton outlet
giuseppe zanotti outlet
ray ban sunglasses
nike blazers uk
ray ban sunglasses
coach outlet
nike store
ray ban sunglasses outlet
coach outlet
ghd hair straighteners
jordan retro 4
louis vuitton purses
coach outlet store online clearances
asics outlet
polo ralph lauren
nike sb janoski
jordan 3 white cenment

van tuan said...

dự án chung cư vinhomes nguyễn trãi là một quần thể đô thị hiện đại chung cu vinhomes nguyen trai được trang bị nội thất tinh tế thiết kế vinhomes nguyễn trãi sang trọng vinhomes nguyen trai đẳng cấp kết hợp cùng tiện nghi vinhome nguyen trai cao cấp vinhome nguyễn trãi là điểm đến lý tưởng vincom nguyen trai đầy đủ cho người tiêu dùng vincom nguyễn trãi có bán giày nam các loại giày công sở nam đẹp nhất, giày lười nam đẹp.Công ty thiết kế nội thất hàng đầu tại hà nội, chuyên thiet ke noi that

shengda xu said...

louboutin pas cher
polo ralph lauren outlet
ralph lauren outlet
michael kors outlet clearance
longchamp outlet store
birkenstocks
yeezy boost 350 v2
kate spade handbags
valentino
nike roshe
xsuhengda0609