1

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

4

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
1
  • @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
1

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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