A detailed tutorial on how to use some borrowed/modified scripts for making this task very simple
These scripts were stolen from SharepointBlogs.com and have been modified just a little to get some different functionality, I want them to take 95% of the credit... the rest is MINE! (Thanks guys!)
These scripts were almost exactly what we needed, but we needed each content database to have custom names. So I twisted the code around a bit and here is a detailed tutorial of what we did.
**IMPORTANT - do this ONLY after you have made your initial web application.
Make the Databases
-
Make a new database named temp_db_builder
-
Make a table in temp_db_builder with this:
CREATE TABLE create_dbs(
id INT NOT NULL PRIMARY KEY IDENTITY,
db_name VARCHAR(MAX)
);
-
Fill that table with the trailing end of your content db names- EX: WSS_Content_SomeSite : 'SomeSite' = trailing end
-
Edit make_dbs.sql (from the zip below):
-
Change @ServiceIdentity and @AppPoolIdentity to the proper accounts
-
Change the X in WHILE @Number <= X to the number of entries you added in the create_dbs table
-
Change @DataFile and @LogFile to the proper destinations
-
That is all that is needed, change the other properties if your situation requires
-
Run that file, or run the query text in SQL Server Management Studio
-
Databases are made
Produce the Batch file:
- Edit the file make_db_batch_file.vbs (from the zip below):
- edit NUMBER_OF_DATABASES to the number of names you added in the create_dbs table above
- edit SQL_SERVER_NAME to your SQL Server
- for however many databases you specified in #1, add the names to dbArray(x) from 0 to NUMBER_OF_DATABASES - these HAVE TO match the names in the table create_dbs
- edit DBnameconv to what the prefix of the databases is
- edit SiteURL to your site url
- Copy that file to your Sharepoint Admin Server to C:\Add_ContentDB_Script\
- Go in to your command prompt and run cscript make_db_batch_file.vbs from the C:\Add_ContentDB_Script\
- Batch File is made
Attach Content Databases to Sharepoint
- On your Sharepoint admin server, run a command prompt as the Sharepoint admin account (runas /user:domain\username cmd)
- Navigate to C:\Add_ContentDB_Script\ and run AddDBAContentDB.bat
And you should be all done.