SQL Server 2008 R2 - database file is 10GB, can't shrink it - sql-server

I've got a database on SQL Server 2008 R2 that has grown to 10GB (log file is tiny). Users cannot work because they get the message about not being able to allocate space, filegroup PRIMARY being full.
Database is in simple mode, the .mdf file is set to unlimited growth, the initial size says 10240MB and when I change it trough the manager it just goes back up.
Naturally shrinking trough Manager or T-SQL DBCC SHRINKFILE or SHRINKDATABASE does not work because of that (IIRC, shrink cannot go below minimal size).
What are my options now?
Create a new filegroup?
Why can't I reduce initial size?
SEE IMAGE

Related

Shrinking database in SQL Server

I have shrink the large database. I have shrink the database log using SSMS and by query both way. on the properties it is showing the reduced size. But on the drive where it is mounted showing the previous size. What can I do to release the space after shrink of database?
After you shrink database and see the database size is reduced to release the unused empty space to file system, you can execute DBCC SHRINKDATABASE command with TRUNCATEONLY option once more

Log file for ReportServerTempDB growing unexpectedly

The transaction log file for the ReportServerTempDB database (database installed with Reporting Services) is has grown to over 100GB. And I'm not sure why.
Here are the file sizes:
D:\SQLDatabases\ReportServer.mdf - 0.7GB
G:\SQLDatabases\ReportServer.ldf - 1.8GB
E:\SQLDatabases\ReportServerTempDB.mdf - 5GB
G:\SQLDatabases\ReportServerTempDB.ldf - 107.6GB
Recovery mode for all these database is SIMPLE.
We are using SQL Server 2008 R2 Standard Edition.
EDIT: Something that is unique to the reporting services databases:
The collation for these databases is Latin1_General_CI_AS_KS_WS. But for all other database it is Latin1_General_CI_AS.
I don't want to just shink the log files and carry on, because they might just grow again. And I can't see why they should be so large.
Does anyone know what could cause the log file (and the data file) for the ReportServerTempDB database to grow so much
And what I should do about it?
Could this indicate a problem with our Report Server?
You are sure that your temp DB is on recovery model - simple as well?
At least you can shrink the database so you get your disk space back using SHRINK DBCC, check this link for more details: http://msdn.microsoft.com/en-us//library/ms190488.aspx
We had renamed SSRS, but the cleanup / archive procs were still trying to cleanup the old database names. When we changed that, out problem stopped.

How reduce the growth of a database in SQL Server CE?

I have a database with 468 MB.
I deleted all tables and the size of this database is the same.
Why size of this database is the same?
You need to Shrink or Compact the database to reclaim the empty space in the database file.
See this blog post: SqlCeEngine/ISSCEEngine: Shrink Vs Compact

DBCC SHRINKFILE operation increases data usage instead

First of all, I know it's better not shrink database. But in our situation we had to shrink the data file to claim more space back.
Environment: SQL Server 2005 x64 SP3 Ent running on Windows Server 2003 Enterprise x64.
The database has one single data file and one log file. Before we run DBCC SHRINKFILE, the data file has 640GB, in which 400GB is free, so the data is about 240GB. To speed up the shrink process,we had to defrag the database first then we shrink data file.
However, after we shrinked the database data file using DBCC SHRINKFILE, the data changed to 490GB. How could it happen?
I asked around include Paul Randal. Here's the possible reason:
When I rebuild indexes for those indexes that were dropped, the indexes would not physically removed from data file, they would be put in deferred drop queue, instead they would stay there and would be dropped in batch.

Discrepency in the size of mdf files in SQL server

I am having 2 .bak files for the same database in MSSQL Server. One is the test snapshot and the other is the production snapshot. The test one is about 500 MB and the production one is about 10 GB. This is because the Test one has many tables truncated. When I restore them in sql server a .mdf file is created at \Microsoft SQL Server\MSSQL.1\MSSQL\Data folder. But I see that the sze of the .mdf file is about 10 GB even when I restore only the test snapshot. Since the test snapshot has many tables truncated and data is less, I would assume that the the size of the .mdf file should be less than that for production snapshot. But that is not the case. Does sql server reserve space in the mdf file and hence it is the same size for both the versions?
Yes it does reserve space. You can see this in the create database page and later in the properties pages.
MDF = space reserved
bak = 8k pages with data
When the database is restored, it reads the size from sys.database_files. The pages are put back into the same relative place.
Unless you are really short of disk space, I'd leave it... but you can shrink the files if it makes you feel better
You are using (ballpark figures) 64,000 pages but have reserved 12,800,000
i think you need to run the following on your DB.
DBCC SHRINKDATABASE (UserDB, 10);

Resources