How to manually grow log files and data files in SQL Server

Source: Internet
Author: User
Tags file size log

Manually grow the log file, which is actually modifying the size of the log file in megabytes

The log file size below is set to 2048MB

ALTERDATABASE[GPOSDB] MODIFY FILE (name=gposdb_log,size=2048)

EXEC sys. [sp_helpdb] @dbname = [GPOSDB]--sysname

--Shrink log file use 
[Gposdb] Go 
ALTER DATABASE [gposdb] SET RECOVERY simple;
Go
--Set the simple recovery model 
DBCC shrinkfile (Gposdb_log, 1); 
Go 
--revert to original mode
ALTER DATABASE [Gposdb] SET RECOVERY full;
Go

--Manually grow the data file, which is actually modifying the size of the data file in megabytes. Set the log file size to be 2048MB

ALTERDATABASE[GPOSDB] MODIFY FILE (name=gposdb_data,size=2048)

EXEC sys. [sp_helpdb] @dbname = [GPOSDB]--sysname

--Shrink data file shrink to 2MB

Use [Gposdb] 
go 
DBCC shrinkfile (N ' Gposdb_data ', 2) 
go

See more highlights of this column: http://www.bianceng.cnhttp://www.bianceng.cn/database/SQLServer/

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.