Friday, 3 February 2012

SQL SharePoint Cheap tricks

The following stuff to set max Memory that my local SQL on SharePoint Dev VM box can consume

----------SetSqlMemory.sql-----------------
USE master
EXEC sp_configure 'show advanced options', 1
RECONFIGURE WITH OVERRIDE

USE master
EXEC sp_configure 'max server memory (MB)', 600
RECONFIGURE WITH OVERRIDE

USE master
EXEC sp_configure 'show advanced options', 0
RECONFIGURE WITH OVERRIDE

-- osql -E -S .\SharePoint -i Path\SetSqlMemory.sql
---------------------------------------

Use the following to put a particular SharePoint Content DB into Read Only mode

---------------------------------------------------
USE master;
GO
ALTER DATABASE SharePoint_Content_80
SET SINGLE_USER
WITH ROLLBACK IMMEDIATE;
GO

ALTER DATABASE  SharePoint_Content_80
SET READ_ONLY; 
-- SET READ_WRITE

GO
ALTER DATABASE  SharePoint_Content_80
SET MULTI_USER;
GO
-----------------------------------------------------------