日志太大了,想清除,谢谢高手指点!
---------------------------------------------------------------
1.USE SP_DBOPTION 'DATABASENAME','AUTOSHRINK','TRUE'
2.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
good luck!!!
/* Run "select * from sysfiles to get fileid you want to shrink"*/
use northwind
go
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
INSERT INTO T1 VALUES ('A')
SELECT @I=@I+1
END
TRUNCATE table T1
BACKUP LOG northwind with truncate_only
end
go
---------------------------------------------------------------
1.
backup log DBNAME with no_log
2.
select fileid,filename from sysfiles
3.
USE DBNAME
DBCC SHRINKFILE (2,10) -- 把fileid=2 的文件收缩到 10 MB