|
如何修复SQLSERVER 数据库置疑之(二)(3) sp_dboption 'databasename','trunc. log on chkpt.',true sp_dboption 'databasename','autoshrink',true c.通过每日备份将日志收缩: BACKUP DATABASE DATABASE_NAME TO BACKUP_DEVICES BACKUP LOG DATABASE_NAME TO LOG_DEVICES OR BACKUP LOG DATABASE_NAME with truncate_only **检查日志的容量:DBCC SQLPERF (LOGSPACE) 这时日志并没有收缩! d.每天在备份数据库完成之后,重新启动MS SQLSERVER SERVICE. USE DATABASE_NAME go DBCC SHRINKFILE(2,truncateonly) **检查日志的容量:DBCC SQLPERF (LOGSPACE) 这时日志已经收缩! e.手动快速收缩日志: / *run below script,you will shrink you database log files immediately, in my eXPerience,you need to run the script for 3 or 4 minutes before stopping it manually */ use databasename dbcc shrinkfile(2,notruncate) dbcc shrinkfile(2,truncateonly) create table t1(char1 char(4000)) go declare @i int select @i=0 while(1=1) begin while(@i<100) begin
|