sqlserver study notes (three: clean up the database log files and setting the timing for the job execution)

A: log cleaning sql statement

USE [master]
GO
ALTER DATABASE YNYY SET RECOVERY SIMPLE WITH NO_WAIT
GO
ALTER DATABASE YNYY SET RECOVERY SIMPLE --简单模式
GO

The USE YNYY
the GO
the DBCC SHRINKFILE (N ' LXCX_log ',. 1, the TRUNCATEONLY) - logical name of the log file, click Database -> Properties -> File View
the GO

the USE [Master]
the GO
the ALTER DATABASE YNYY the SET the WITH FULL NO_WAIT the RECOVERY
the GO
the ALTER DATABASE YNYY SET RECOVERY fULL - revert to full mode
GO

 

Two: Set regular cleaning jobs

(A), right-click SQLserver proxy, select New Job;

 

(B), fill in the job name and description in the General tab, select the owner and categories;

 

(Three), click on the steps, conventional step in to fill in the name of cleaning up the log to copy sql command bar, click on the analysis;

 

(Four), and the next step to select the successful operation fails to be executed in step advanced, because the job is only a step, were to opt out;

 

(五)、点击计划,填写计划名称,选择执行的频率,时间等,点击确定,作业设置成功;

 

(六)、在SQLserver代理处找到该计划,可试着手动执行一次,查看执行结果;

提示:SQL语句或作业执行前后,可找到数据库日志所在文件,观察文件执行前后的大小验证清理成功与否。

Guess you like

Origin www.cnblogs.com/oraclelast/p/11314710.html
Recommended