Table of Contents
SQLSERVER压缩数据文件的用处有多大
Home Database Mysql Tutorial SQLSERVER压缩数据文件的用处有多大

SQLSERVER压缩数据文件的用处有多大

Jun 07, 2016 pm 03:45 PM
sqlserver compression data document usefulness

SQLSERVER压缩数据文件的用处有多大 前奏: 前些天因为客户那边的问题(其实是盗版问题),只能使用免费的SQLSERVER EXPRESS版本 SQLSERVER2005 的express版本的SQLSERVER的整个数据库的数据文件大小限制为4GB(SQLSERVER2012 express版本限制是10G ),就是

SQLSERVER压缩数据文件的用处有多大

前奏:

前些天因为客户那边的问题(其实是盗版问题),只能使用免费的SQLSERVER EXPRESS版本

SQLSERVER2005 的express版本的SQLSERVER的整个数据库的数据文件大小限制为4GB(SQLSERVER2012express版本限制是10G),就是说不管你用多少个文件组,多少个辅助数据文件ndf

所有加起来都不能超过4GB(mdf+ndf)

事务日志文件大小没有限制

因为我们的数据库只是使用了一个主数据文件GPOS.mdf和一个事务日志文件GPOS.ldf

 

本人的解决思路:

本人在想如果是这样,到时候就收缩数据库呗

在网上查了一下资料:由于DBCC SHRINKDATABASE一次运行会同时影响所有的文件(包括数据文件和日志文件),使用者不能

指定每个文件的目标大小,其结果可能不能达到预期的要求。所以建议先做好规划,对每个文件确定预期目标,然后使用DBCC SHRINKFILE

来一个文件一个文件地做比较稳妥

本来很开心的,网上资料都说使用DBCC SHRINKFILE来收缩文件,那这样就不怕拉 (我不怕不怕拉~)

但是,往下看那个资料:

1、首先了解数据文件当前的使用情况

收缩量的大小不可能超过当前文件的空闲空间的大小。如果想要压缩数据库的大小,首先要确认数据文件里的确有相应未被使用的空间。如果空间都在

使用中,那就要确认大量占用空间的对象(表格或索引)。然后通过归档历史数据,先把空间释放出来

 

2、主数据文件(primary file)是不能被清空的。能被完全清空的只有辅助数据文件

 

3、如果要把一个文件组整个清空,要删除分配在这个文件组上的对象(表格或索引),或者把他们移到其他文件组上。
DBCC SHRINKFILE不会帮你做这个工作

把数据文件里面数据和对象清除完、确认数据文件(组)有足够的空闲空间后,管理员就可以使用DBCC SHRINKFILE来缩小或清空指定文件了。

如果要缩小文件,就填上需要的target_size,如果要清空文件,就选择EMPTYFILE

 

根据上面资料所说,本人的解决思路是:

1、确认大量占用空间的对象(表格或索引)。然后通过归档历史数据,先把空间释放出来再压缩数据文件

2、重建索引,把一些数据页面重排一次,原先的页面被释放,所占用的分区也被释放,再去DBCC SHRINKFILE

如果你们有其他解决方法希望你们告诉我,谢谢您们了!!

 

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

How to import mdf file into sqlserver How to import mdf file into sqlserver Apr 08, 2024 am 11:41 AM

The import steps are as follows: Copy the MDF file to SQL Server's data directory (usually C:\Program Files\Microsoft SQL Server\MSSQL\DATA). In SQL Server Management Studio (SSMS), open the database and select Attach. Click the Add button and select the MDF file. Confirm the database name and click the OK button.

How to solve the problem that the object named already exists in the sqlserver database How to solve the problem that the object named already exists in the sqlserver database Apr 05, 2024 pm 09:42 PM

For objects with the same name that already exist in the SQL Server database, the following steps need to be taken: Confirm the object type (table, view, stored procedure). IF NOT EXISTS can be used to skip creation if the object is empty. If the object has data, use a different name or modify the structure. Use DROP to delete existing objects (use caution, backup recommended). Check for schema changes to make sure there are no references to deleted or renamed objects.

What to do if the sqlserver service cannot be started What to do if the sqlserver service cannot be started Apr 05, 2024 pm 10:00 PM

When the SQL Server service fails to start, here are some steps to resolve: Check the error log to determine the root cause. Make sure the service account has permission to start the service. Check whether dependency services are running. Disable antivirus software. Repair SQL Server installation. If the repair does not work, reinstall SQL Server.

How to check sqlserver port number How to check sqlserver port number Apr 05, 2024 pm 09:57 PM

To view the SQL Server port number: Open SSMS and connect to the server. Find the server name in Object Explorer, right-click it and select Properties. In the Connection tab, view the TCP Port field.

How to recover accidentally deleted database in sqlserver How to recover accidentally deleted database in sqlserver Apr 05, 2024 pm 10:39 PM

If you accidentally delete a SQL Server database, you can take the following steps to recover: stop database activity; back up log files; check database logs; recovery options: restore from backup; restore from transaction log; use DBCC CHECKDB; use third-party tools. Please back up your database regularly and enable transaction logging to prevent data loss.

Slow Cellular Data Internet Speeds on iPhone: Fixes Slow Cellular Data Internet Speeds on iPhone: Fixes May 03, 2024 pm 09:01 PM

Facing lag, slow mobile data connection on iPhone? Typically, the strength of cellular internet on your phone depends on several factors such as region, cellular network type, roaming type, etc. There are some things you can do to get a faster, more reliable cellular Internet connection. Fix 1 – Force Restart iPhone Sometimes, force restarting your device just resets a lot of things, including the cellular connection. Step 1 – Just press the volume up key once and release. Next, press the Volume Down key and release it again. Step 2 – The next part of the process is to hold the button on the right side. Let the iPhone finish restarting. Enable cellular data and check network speed. Check again Fix 2 – Change data mode While 5G offers better network speeds, it works better when the signal is weaker

How to delete sqlserver if the installation fails? How to delete sqlserver if the installation fails? Apr 05, 2024 pm 11:27 PM

If the SQL Server installation fails, you can clean it up by following these steps: Uninstall SQL Server Delete registry keys Delete files and folders Restart the computer

How to change sqlserver English installation to Chinese How to change sqlserver English installation to Chinese Apr 05, 2024 pm 10:21 PM

SQL Server English installation can be changed to Chinese by following the following steps: download the corresponding language pack; stop the SQL Server service; install the language pack; change the instance language; change the user interface language; restart the application.

See all articles