Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

Where can I shrink database directly from Central admin (SharePoint2010)

share|improve this question
add comment

2 Answers 2

up vote 4 down vote accepted

You can't shrink your database directly from the central administration UI.

You need to use SSMS (SQL Server Management Studio) to shrink your database.

I found a nice automated solution (SQL script) to shrink all your Sharepoint related DBs: Keeping your SHarepoint 2010 Development Databases small

USE [master]
GO

DECLARE @dbname SYSNAME
DECLARE @altercmd NVARCHAR(1000)
DECLARE @shrinkcmd NVARCHAR(1000)

DECLARE [dbcursor] CURSOR FOR SELECT [name] FROM sysdatabases

OPEN [dbcursor]
FETCH NEXT FROM [dbcursor] INTO @dbname

WHILE
    @@FETCH_STATUS = 0
BEGIN
    IF
        (SELECT DATABASEPROPERTYEX(@dbname, 'RECOVERY')) != 'SIMPLE'
        AND
        @dbname != 'tempdb'
    BEGIN
        SET @altercmd = 'ALTER DATABASE "' + @dbname
                                               + '" SET RECOVERY SIMPLE'
        EXEC (@altercmd)

        SET @shrinkcmd = 'DBCC SHRINKDATABASE ("' + @dbname + '")'
        EXEC (@shrinkcmd)

        PRINT @dbname
    END

    FETCH NEXT FROM [dbcursor] INTO @dbname
END

CLOSE [dbcursor]
DEALLOCATE [dbcursor]

A different shorter method is explained here: Sharepoint: shrink database on a fast way

USE MyDatabase

GO

BACKUP LOG MyDatabase WITH TRUNCATE_ONLY

GO

DBCC SHRINKFILE (MyDatabase_log, 1)

GO
share|improve this answer
    
@moontear: Generally you can reproduce content here as long as you follow licenses. For example, Stack Overflow require you give attribution if the content was originally posted there. A link to the original content will be fine in most cases. Thanks for asking! –  Alex Angas Jan 18 '11 at 22:32
add comment

I think, you can't... You need to do that in the SQL Mgmt Studio.

Here is a WhitePaper about DB Management in SharePoint, its also about shrinking DBs. http://go.microsoft.com/fwlink/?LinkID=178357&clcid=0x409

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.