1.收缩数据库
USE[master]
GO
ALTER DATABASE qdjimo SET RECOVERY SIMPLE WITH NO_WAIT
GO
ALTER DATABASE qdjimo SET RECOVERY SIMPLE --简单模式,只有在这个模式下才行
GO
USE qdjimo
GO
DBCC SHRINKFILE (N'qdjimo_log' ,1024, TRUNCATEONLY) --设置压缩后的日志大小为1024M,可以自行指定
GO
USE[master]
GO
ALTER DATABASE qdjimo SET RECOVERY FULL WITH NO_WAIT
GO
ALTER DATABASE qdjimo SET RECOVERY FULL --还原为完全模式,否则影响数据库备份
GO
2.显示正在恢复
USE master
GO
ALTER DATABASE qdjimo SET SINGLE_USER
GO
ALTER DATABASE qdjimo SET EMERGENCY
GO
DBCC CHECKDB(qdjimo,REPAIR_ALLOW_DATA_LOSS)
go
ALTER DATABASE qdjimo SET ONLINE
GO
ALTER DATABASE qdjimo SET MULTI_USER
GO
3.备份和删除
declare @name varchar(250)
set @name='D:\database\数据库\qdjimo'+rtrim(convert(varchar,getdate(),112))+'.bak'
BACKUP DATABASE[qdjimo] TO
DISK=@name
WITH NOFORMAT, NOINIT,
NAME = N'qdjimo-完整 数据库 备份',
SKIP, NOREWIND, NOUNLOAD
go
declare @cmd varchar(60)
set @cmd='del D:\database\数据库\qdjimo'+rtrim(convert(varchar,getdate()-7,112))+'.bak'
exec xp_cmdshell @cmd
go
4.iis网站日志路径:C:\inetpub\logs\LogFiles\W3SVC2