SELECT NAME, database_id,create_date 创建时间,is_auto_shrink_on 自动收缩,state_desc 状态,recovery_model_desc 恢复模式,is_published 是否发布库,log_reuse_wait_desc日志重用状态 FROM sys.databases--修改数据库日志模式:Simple,Full,BULK_LOGGEDALTER DATABASE [数据库名] SET RECOVERY SIMPLE --设置自动收缩ALTER DATABASE [数据库名] SET AUTO_SHRINK ON WITH NO_WAIT
SELECT NAME, database_id,create_date 创建时间,is_auto_shrink_on 自动收缩,state_desc 状态,recovery_model_desc 恢复模式,is_published 是否发布库,log_reuse_wait_desc日志重用状态 FROM sys.databases--修改数据库日志模式:Simple,Full,BULK_LOGGEDALTER DATABASE [数据库名] SET RECOVERY SIMPLE --设置自动收缩ALTER DATABASE [数据库名] SET AUTO_SHRINK ON WITH NO_WAIT--收缩日志DBCC SHRINKFILE (N'DNName_Log' , 1)--重建索引USE DNName;DECLARE @name varchar(100)DECLARE authors_cursor CURSOR FOR Select [name] from sysobjects where xtype='u' order by idOPEN authors_cursorFETCH NEXT FROM authors_cursor INTO @nameWHILE @@FETCH_STATUS = 0 BEGIN DBCC DBREINDEX (@name, '', 90) FETCH NEXT FROM authors_cursor INTO @name ENDdeallocate authors_cursor