<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Shared Points for SharePoint : Content Database</title><link>http://blogs.msdn.com/mcsnoiwb/archive/tags/Content+Database/default.aspx</link><description>Tags: Content Database</description><dc:language>en-US</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><item><title>How to create Site Collection in a specific content dateabase part 2</title><link>http://blogs.msdn.com/mcsnoiwb/archive/2008/09/29/how-to-create-site-collection-in-a-specific-content-dateabase-part-2.aspx</link><pubDate>Mon, 29 Sep 2008 13:07:45 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8968674</guid><dc:creator>Stian Kirkeberg</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/mcsnoiwb/comments/8968674.aspx</comments><wfw:commentRss>http://blogs.msdn.com/mcsnoiwb/commentrss.aspx?PostID=8968674</wfw:commentRss><description>&lt;p&gt;Following up on Thomas' post on &lt;a href="http://blogs.msdn.com/mcsnoiwb/archive/2007/08/20/how-to-create-site-collection-in-a-specific-content-database.aspx"&gt;how to create a site collection in a specific content database&lt;/a&gt;: &lt;/p&gt; &lt;p&gt;You can also use the STSADM command &lt;a href="http://technet.microsoft.com/en-us/library/cc262407.aspx"&gt;CreateSiteInNewDB&lt;/a&gt;&lt;/p&gt; &lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/mcsnoiwb/WindowsLiveWriter/HowtocreateSiteCollectioninaspecificcont_A741/image_2.png"&gt;&lt;img style="border-right: 0px; border-top: 0px; border-left: 0px; border-bottom: 0px" height="275" alt="image" src="http://blogs.msdn.com/blogfiles/mcsnoiwb/WindowsLiveWriter/HowtocreateSiteCollectioninaspecificcont_A741/image_thumb.png" width="584" border="0"&gt;&lt;/a&gt;&lt;/p&gt; &lt;p&gt;&amp;nbsp;&lt;/p&gt; &lt;p&gt;&amp;nbsp;&lt;/p&gt; &lt;p&gt;However this does not quite cut it. You would like to decide on which content database each time. To do that, you could use stsadm extensions. It will require some codewriting and testing, though. Luckily, a MVP, &lt;a href="http://www.blogger.com/profile/17179058880525562116"&gt;Gary Lapointe&lt;/a&gt;, has already made it for you. A "&lt;a href="http://stsadm.blogspot.com/2008/01/create-site-in-database.html"&gt;Create site in database&lt;/a&gt;" is available in his stsadm custom extension kit:&lt;/p&gt; &lt;ul&gt; &lt;li&gt;&lt;a href="http://stsadm.blogspot.com/2007/08/stsadm-commands_09.html"&gt;Commands&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="http://www.thelapointes.com/blog/stsadm.zip"&gt;Source&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="http://www.thelapointes.com/blog/Lapointe.SharePoint.STSADM.Commands.wsp"&gt;MOSS WSP&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="http://www.thelapointes.com/blog/Lapointe.SharePoint.STSADM.Commands.WSS.wsp"&gt;WSS WSP&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt; &lt;p&gt;There are also other STSADM extensions available. If you have used or made one you would like to share, &lt;a href="mailto:stiank@microsoft.com"&gt;please send me an mail.&lt;/a&gt;&lt;/p&gt; &lt;p&gt;&amp;nbsp;&lt;/p&gt; &lt;h6&gt;Please be aware that some of his extensions are made by use of reflection on MOSS assemblies, so take whaterever precautions you need in regard to this.&lt;/h6&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=8968674" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/mcsnoiwb/archive/tags/developer/default.aspx">developer</category><category domain="http://blogs.msdn.com/mcsnoiwb/archive/tags/MOSS/default.aspx">MOSS</category><category domain="http://blogs.msdn.com/mcsnoiwb/archive/tags/Content+Database/default.aspx">Content Database</category></item><item><title>Lots of databases, full recovery model, low disk space...what to do?</title><link>http://blogs.msdn.com/mcsnoiwb/archive/2008/05/22/lots-of-databases-full-recovery-model-low-disk-space-what-to-do.aspx</link><pubDate>Thu, 22 May 2008 18:26:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8531931</guid><dc:creator>Stian Kirkeberg</dc:creator><slash:comments>1</slash:comments><comments>http://blogs.msdn.com/mcsnoiwb/comments/8531931.aspx</comments><wfw:commentRss>http://blogs.msdn.com/mcsnoiwb/commentrss.aspx?PostID=8531931</wfw:commentRss><description>&lt;P&gt;I do not much care for having my development databases set to Recovery modell = full. There is really no need for that. The day I need to restore a logfile the environmnet better be a production environment. &lt;/P&gt;
&lt;P&gt;Unfortunatly SQL 2005 let me set the Recovery model on a global level (Please tell me how if it really does - I'm no core SQL guy.). I know it let's you set default file locations etc. and that is good.&lt;/P&gt;
&lt;P&gt;The problems starts when SharePoint creates the db's for you, because you never remember to go in to the SQL server and change the recovery model to simple. Then shrink the log file to save the space... It is simply to unconvenient.&lt;/P&gt;
&lt;P&gt;Running low on disk space, this problem had to dealt with. But to change some hundred databases manually is of course out of the question. So I wrote a small script to take care of it. &lt;/P&gt;
&lt;P&gt;The Script first alters the recovery model, then shrinks the file. Remember to set the starting point for your databases. In my example I have 7 system databases and the rest is SharePoint db's. Be carefull not to make changes to any database not used for development only. &lt;/P&gt;
&lt;P&gt;Do a check on&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;select name, database_id from sys.databases order by database_id&lt;/P&gt;&lt;/BLOCKQUOTE&gt;
&lt;TABLE class="" cellSpacing=0 cellPadding=2 width=1015 border=1&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD class="" vAlign=top width=1013&gt;
&lt;P&gt;USE [master]&lt;/P&gt;
&lt;P&gt;GO&lt;/P&gt;
&lt;P&gt;DECLARE @dbname nvarchar(128)&lt;/P&gt;
&lt;P&gt;DECLARE @filename nvarchar(128)&lt;/P&gt;
&lt;P&gt;DECLARE @cmd nvarchar(500)&lt;/P&gt;
&lt;P&gt;DECLARE @SQLString NVARCHAR(500)&lt;/P&gt;
&lt;P&gt;DECLARE @ParmDefinition NVARCHAR(500)&lt;/P&gt;
&lt;P&gt;DECLARE @getdbnames CURSOR&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; SET @getdbnames = CURSOR FOR&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; select name from sys.databases where database_id &amp;gt; 7 order by database_id&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;OPEN @getdbnames&lt;/P&gt;
&lt;P&gt;FETCH NEXT&lt;/P&gt;
&lt;P&gt;FROM @getdbnames INTO @dbname&lt;/P&gt;
&lt;P&gt;WHILE @@FETCH_STATUS = 0&lt;/P&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;BEGIN&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;SET @cmd = N'ALTER DATABASE "' + @dbname + '"&lt;/P&gt;
&lt;P&gt;SET RECOVERY SIMPLE WITH NO_WAIT' + CHAR(13)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; + N'ALTER DATABASE "' + @dbname&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; + '" SET RECOVERY SIMPLE '&lt;/P&gt;
&lt;P&gt;EXECUTE sp_executesql @cmd&lt;/P&gt;
&lt;P&gt;SET @SQLString =N'select @filenameOUT = name FROM "' + @dbName + '".sys.database_files where type_desc = ''Log'''&lt;/P&gt;
&lt;P&gt;SET @ParmDefinition = N'@filenameOUT&lt;/P&gt;
&lt;P&gt;varchar(300) OUTPUT'&lt;/P&gt;
&lt;P&gt;EXECUTE sp_executesql @SQLString, @ParmDefinition, @filenameOUT=@filename OUTPUT&lt;/P&gt;
&lt;P&gt;SELECT @filename&lt;/P&gt;
&lt;P&gt;SET @cmd = N'USE "' + @dbname + '" DBCC SHRINKFILE (N''' + @filename +''' , 0, TRUNCATEONLY)'&lt;/P&gt;
&lt;P&gt;EXECUTE sp_executesql @cmd&lt;/P&gt;
&lt;P&gt;FETCH NEXT FROM @getdbnames INTO @dbname&lt;/P&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;END&lt;/P&gt;
&lt;P&gt;CLOSE @getdbnames&lt;/P&gt;
&lt;P&gt;DEALLOCATE @getdbnames&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;
&lt;P&gt;&lt;EM&gt;Please note that this approach is not recommended to test and production environments. Leave SharePoint databases to their default settings there. &lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;The change run supprisingly fast (there is a lot of disk I/O here) and I got a lot of free space on the server again! :)&lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Edit:&lt;/P&gt;
&lt;P&gt;Just got a reply from Michael in Austria. He says:&lt;/P&gt;
&lt;P class=MsoPlainText style="MARGIN: 0cm 0cm 0pt"&gt;&lt;FONT face=Consolas&gt;&lt;EM&gt;Everytime you create a new database SQL Server "clones" its "Model" database. So by setting your appreciate recovery model at this database, it will be default for every new one.&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoPlainText style="MARGIN: 0cm 0cm 0pt"&gt;&lt;FONT face=Consolas&gt;&lt;EM&gt;I have tested it for SQL Server 2000 but it should be the same for all other editions.&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoPlainText style="MARGIN: 0cm 0cm 0pt"&gt;&lt;FONT face=Consolas&gt;&lt;EM&gt;You can get more information about the model database here: &lt;/EM&gt;&lt;/FONT&gt;&lt;A href="http://msdn.microsoft.com/en-us/library/ms186388.aspx" mce_href="http://msdn.microsoft.com/en-us/library/ms186388.aspx"&gt;&lt;FONT face=Consolas color=#0000ff&gt;&lt;EM&gt;http://msdn.microsoft.com/en-us/library/ms186388.aspx&lt;/EM&gt;&lt;/FONT&gt;&lt;/A&gt;&lt;/P&gt;
&lt;P class=MsoPlainText style="MARGIN: 0cm 0cm 0pt" mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class=MsoPlainText style="MARGIN: 0cm 0cm 0pt"&gt;Thanks, Michael! :)&lt;/P&gt;
&lt;P class=MsoPlainText style="MARGIN: 0cm 0cm 0pt" mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class=MsoPlainText style="MARGIN: 0cm 0cm 0pt" mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=8531931" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/mcsnoiwb/archive/tags/Sharepoint/default.aspx">Sharepoint</category><category domain="http://blogs.msdn.com/mcsnoiwb/archive/tags/SharePoint+development/default.aspx">SharePoint development</category><category domain="http://blogs.msdn.com/mcsnoiwb/archive/tags/Content+Database/default.aspx">Content Database</category><category domain="http://blogs.msdn.com/mcsnoiwb/archive/tags/Upgrade/default.aspx">Upgrade</category><category domain="http://blogs.msdn.com/mcsnoiwb/archive/tags/SQL/default.aspx">SQL</category></item><item><title>How to create Site Collection in a specific Content Database?</title><link>http://blogs.msdn.com/mcsnoiwb/archive/2007/08/20/how-to-create-site-collection-in-a-specific-content-database.aspx</link><pubDate>Mon, 20 Aug 2007 15:56:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:4479643</guid><dc:creator>Thomas Læhren</dc:creator><slash:comments>1</slash:comments><comments>http://blogs.msdn.com/mcsnoiwb/comments/4479643.aspx</comments><wfw:commentRss>http://blogs.msdn.com/mcsnoiwb/commentrss.aspx?PostID=4479643</wfw:commentRss><description>&lt;P mce_keep="true"&gt;This is an easy, straight forward procedure to make sure your Site Collection is added to the Content Database of your preference.&lt;/P&gt;
&lt;P&gt;Add a new Content Database using Central Administration &amp;gt; Application Management &amp;gt; Content Databases &amp;gt; Add Content Database: 
&lt;P&gt;&lt;A href="http://blogs.msdn.com/blogfiles/mcsnoiwb/WindowsLiveWriter/HowtocreateSiteCollectioninaspecificCont_D1D7/1%5B6%5D.jpg" atomicselection="true" mce_href="http://blogs.msdn.com/blogfiles/mcsnoiwb/WindowsLiveWriter/HowtocreateSiteCollectioninaspecificCont_D1D7/1%5B6%5D.jpg"&gt;&lt;IMG height=435 src="http://blogs.msdn.com/blogfiles/mcsnoiwb/WindowsLiveWriter/HowtocreateSiteCollectioninaspecificCont_D1D7/1_thumb%5B4%5D.jpg" width=500 mce_src="http://blogs.msdn.com/blogfiles/mcsnoiwb/WindowsLiveWriter/HowtocreateSiteCollectioninaspecificCont_D1D7/1_thumb%5B4%5D.jpg"&gt;&lt;/A&gt; 
&lt;P&gt;NOTE! Make sure ”Maximum numbers of sites that can be created in this database”&amp;nbsp;minus ”Current number of Sites”&amp;nbsp;equals the largest number in which you want to add the new Site Collection: 
&lt;P&gt;&lt;A href="http://blogs.msdn.com/blogfiles/mcsnoiwb/WindowsLiveWriter/HowtocreateSiteCollectioninaspecificCont_D1D7/2%5B7%5D.jpg" atomicselection="true" mce_href="http://blogs.msdn.com/blogfiles/mcsnoiwb/WindowsLiveWriter/HowtocreateSiteCollectioninaspecificCont_D1D7/2%5B7%5D.jpg"&gt;&lt;IMG height=178 src="http://blogs.msdn.com/blogfiles/mcsnoiwb/WindowsLiveWriter/HowtocreateSiteCollectioninaspecificCont_D1D7/2_thumb%5B5%5D.jpg" width=500 mce_src="http://blogs.msdn.com/blogfiles/mcsnoiwb/WindowsLiveWriter/HowtocreateSiteCollectioninaspecificCont_D1D7/2_thumb%5B5%5D.jpg"&gt;&lt;/A&gt; 
&lt;P&gt;Go ahead and create a new Site Collection: 
&lt;P&gt;&lt;A href="http://blogs.msdn.com/blogfiles/mcsnoiwb/WindowsLiveWriter/HowtocreateSiteCollectioninaspecificCont_D1D7/3%5B3%5D.jpg" atomicselection="true" mce_href="http://blogs.msdn.com/blogfiles/mcsnoiwb/WindowsLiveWriter/HowtocreateSiteCollectioninaspecificCont_D1D7/3%5B3%5D.jpg"&gt;&lt;IMG height=356 src="http://blogs.msdn.com/blogfiles/mcsnoiwb/WindowsLiveWriter/HowtocreateSiteCollectioninaspecificCont_D1D7/3_thumb%5B1%5D.jpg" width=500 mce_src="http://blogs.msdn.com/blogfiles/mcsnoiwb/WindowsLiveWriter/HowtocreateSiteCollectioninaspecificCont_D1D7/3_thumb%5B1%5D.jpg"&gt;&lt;/A&gt; 
&lt;P&gt;Go back to the Content Database overview to see that the new Site Collection has been created in the new Content Database: 
&lt;P&gt;&lt;A href="http://blogs.msdn.com/blogfiles/mcsnoiwb/WindowsLiveWriter/HowtocreateSiteCollectioninaspecificCont_D1D7/4%5B3%5D.jpg" atomicselection="true" mce_href="http://blogs.msdn.com/blogfiles/mcsnoiwb/WindowsLiveWriter/HowtocreateSiteCollectioninaspecificCont_D1D7/4%5B3%5D.jpg"&gt;&lt;IMG height=156 src="http://blogs.msdn.com/blogfiles/mcsnoiwb/WindowsLiveWriter/HowtocreateSiteCollectioninaspecificCont_D1D7/4_thumb%5B1%5D.jpg" width=500 mce_src="http://blogs.msdn.com/blogfiles/mcsnoiwb/WindowsLiveWriter/HowtocreateSiteCollectioninaspecificCont_D1D7/4_thumb%5B1%5D.jpg"&gt;&lt;/A&gt; 
&lt;P&gt;Adjust “Number of sites before a warning event is generated” and “Maximum number of sites that can be created in this database” to make sure new Site Collections are added to the correct content database: 
&lt;P&gt;&lt;A href="http://blogs.msdn.com/blogfiles/mcsnoiwb/WindowsLiveWriter/HowtocreateSiteCollectioninaspecificCont_D1D7/5%5B3%5D.jpg" atomicselection="true" mce_href="http://blogs.msdn.com/blogfiles/mcsnoiwb/WindowsLiveWriter/HowtocreateSiteCollectioninaspecificCont_D1D7/5%5B3%5D.jpg"&gt;&lt;IMG height=156 src="http://blogs.msdn.com/blogfiles/mcsnoiwb/WindowsLiveWriter/HowtocreateSiteCollectioninaspecificCont_D1D7/5_thumb%5B1%5D.jpg" width=500 mce_src="http://blogs.msdn.com/blogfiles/mcsnoiwb/WindowsLiveWriter/HowtocreateSiteCollectioninaspecificCont_D1D7/5_thumb%5B1%5D.jpg"&gt;&lt;/A&gt; 
&lt;P&gt;After making this adjustment, new Site Collections are added to the WSS_SharePoint_Content database. 
&lt;P&gt;If you already have a Site Collection and you want to move it to its own Content Database you can use the following stsadm commands: 
&lt;P&gt;stsadm -o backup -url http://server/sites/sitename -filename c:\sitename.bak 
&lt;P&gt;stsadm -o deletesite -url http://server/sites/sitename 
&lt;P&gt;stsadm -o restore -url http://server/sitename -filename c:\sitename.bak 
&lt;P&gt;Make sure the sum between “Current Number of Sites” and “Maximum Number of Sites” is the largest in the content database you want to use before you run the stsadm –o restore command. &lt;/P&gt;
&lt;P&gt;Thomas Læhren, Consultant, MCS Norway&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=4479643" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/mcsnoiwb/archive/tags/Sharepoint/default.aspx">Sharepoint</category><category domain="http://blogs.msdn.com/mcsnoiwb/archive/tags/Site+Collection/default.aspx">Site Collection</category><category domain="http://blogs.msdn.com/mcsnoiwb/archive/tags/Content+Database/default.aspx">Content Database</category><category domain="http://blogs.msdn.com/mcsnoiwb/archive/tags/Governance/default.aspx">Governance</category></item></channel></rss>