How can I check whether the data file or Log file has grown?

Source: Internet
Author: User

I saw a post in the Forum, saying that the database slowed down for a while and found that the last modification time of the database file was the same as that of the slow world. I want to know if the file actually increased during this time.

In fact, SQL Server provides an Event for data growth, which is recorded in the Default Trace.

In the following test, I created a new database, created a table, and inserted data:

Createtabletest (testvarchar (100 ))

Go

Insertintotestvalues (replicate ('A', 100 ))

Go 100000

 

Query the Default Trace:

Declare @ TraceFileasvarchar (max)

Select @ TraceFile = path fromsys. traces

 

SelectDatabaseName, FileName, StartTime

From: fn_trace_gettable (@ TraceFile, default) -- replace your own Trace file address

WhereEventClass = 92 or EventClass = 93 andStartTime> '2017-06-2013: 09: 66661'

 

Explanations of Event 92 and 93:

 

Select * fromsys. trace_eventswheretrace_event_id = 92 or trace_event_id = 93

650) this. width = 650; "title =" 1.png" style = "float: left;" src = "http://www.bkjia.com/uploads/allimg/131228/22232330O-0.png"/>

 

The result is as follows:

 

650) this. width = 650; "title =" 2.png" style = "float: left;" src = "http://www.bkjia.com/uploads/allimg/131228/2223235305-1.png"/>

 

 

 

 

 

 

 

 

 

 

 

 

 

 

You can see the database growth records.

This article is from the "follow SQL Server Technology" blog, please be sure to keep this source http://lzf328.blog.51cto.com/1196996/1231688

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.