Archives For SharePoint


Truncate Log Files for All the database in SQL Server

1. Perform full backup of all your database
2. Open your SQL Management Studio

3. Click on New Query
4. Insert the code and click Execute

clip_image002


SQL 2008

use master
DECLARE @Statement varchar (4000)
SELECT @Statement = ”
SELECT @Statement = @Statement + ‘USE [?];’
SELECT @Statement = @Statement + ‘DECLARE @Log_Logical_FileName varchar (100);’
SELECT @Statement = @Statement + ‘SELECT @Log_Logical_FileName = rtrim(name) FROM dbo.sysfiles WHERE fileid = 2; ‘
SELECT @Statement = @Statement + ‘ALTER DATABASE [?] SET RECOVERY SIMPLE WITH NO_WAIT;’
SELECT @Statement = @Statement + ‘DBCC SHRINKFILE(@Log_Logical_FileName,1);’
SELECT @Statement = @Statement + ‘ALTER DATABASE [?] SET RECOVERY FULL WITH NO_WAIT;’
EXEC sp_MSforeachdb @command1=@Statement
GO

SQL 2005

use master
DECLARE @Statement varchar (4000)
SELECT @Statement = ”
SELECT @Statement = @Statement + ‘USE [?]; ‘
SELECT @Statement = @Statement + ‘DECLARE @Log_Logical_FileName varchar (100); ‘
SELECT @Statement = @Statement + ‘SELECT @Log_Logical_FileName = rtrim(name) FROM dbo.sysfiles WHERE fileid = 2; ‘
SELECT @Statement = @Statement + ‘BACKUP LOG [?] WITH TRUNCATE_ONLY; ‘
SELECT @Statement = @Statement + ‘DBCC SHRINKFILE(@Log_Logical_FileName,1); ‘
EXEC sp_MSforeachdb @command1=@Statement
GO

Running this will truncate all your log file


Publishing Portal Missing Team Site Template

Cannot find the “Team Site” template when I try to create a new site in SharePoint 2010
I checked Site Collection Administration | Features and all the features I needed are active

clip_image002

Went to Site Settings | Features and Team Collaboration Lists are active

clip_image004

Still when I try to create new site, I don’t see any Team Site templates

clip_image006

Solution:

Go to Site Action | Site Settings | Page Layouts and Site Templates

clip_image008

Select Team Site (ALL) and Add. Click OK below to add all the Team Sites

clip_image010

Now if you go to create sites, you will see the team sites template

clip_image012