SQL server space size Query

Source: Internet
Author: User

1. What is the database size?

Exec sp_helpdb

Select * From sysfiles

2. query a database space

Use dbname

Sp_spaceused

3. query a tablespace

Sp_spaceused tablename

4. view the log file content

DBCC log (dbname, type = 4)

Syntax:

DBCC log ({dbid | dbname}, [, type = {-1 | 0 | 1 | 2 | 3 | 4}])


Parameters:
Dbid or dbname-enter either the dbid or the name of the database
In question.

Type-is the type of output:

0-minimum information (operation, context, transaction ID)

1-more information (plus flags, tags, row length, description)

2-very detailed information (plus Object Name, index name,
Page ID, slot ID)

3-full information about each operation

4-full information about each operation plus hexadecimal dump
Of the current transaction log's row.

-1-full information about each operation plus hexadecimal dump
Of the current transaction log's row, plus checkpoint begin,
DB version, Max xdesid

By default type = 0

To view the transaction log for the master database, you can run
Following command:

DBCC log (master)

Related Article

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.