Follow PFE on Facebook
SharePoint 2010, with all of its new service applications and social features, just LOVES databases. I don't know the actual count, but I think I've heard as many as a possible 15+ databases if you light up every feature... and that's before you create any actual content! Anyone that has then popped open SQL Management Studio afterward and tried to figure out which database relates to which feature in which environment and which site has probably already run out of hair to pull out. We are CLEARLY in need of a solid naming convention... and I don't mean a GUID!
So... in coming up with a standard, we need to consider some things...
Here's how I've standardized on addressing as many problems as possible. (Note that this isn't exactly carved in stone... so if something doesn't work for you, then don't do it. :)). The components listed are IN ORDER of appearance in the naming convention, separated by underscores for readability. So, just go down the list and you should be able to stick to an easy to use and understand standard.
Environment Name
Almost all of my customers continually use a common set of names for their environments. Some are more common than others, but on the whole they're very similar and serve purposes. I suggest we condense each down to a 3 digit code. Here's my go-to list for now:
Examples: "PRD_...", "SBX_...", "UAT_..."
Database Type
Most databases in SharePoint can fall into one of 3 broad categories: It is either related to the Farm as a whole, is a content database, or is related to a service application. So, the following would be next in line:
Third party customizations or functionality are up to you. If you can fit them into this model then that's fantastic... but that's beyond the scope of this article.
Examples: "PRD_Farm_...", "SBX_Content_...", "UAT_SA_..."
Context
Now things get more fuzzy. As we get more specific, the kind of database should get taken into account and the naming strategy changes slightly. For "Farm" databases, simply listing the database context, content, or purpose works fine. For example "Config" or "Configuration" or "Usage" make perfect sense when reading the database names.
Example: "PRD_Farm_Config" (are you seeing how you can now look at this database and know EXACTLY what it relates to? It's a good thing! )
Content Databases are the next easiest - They should have the hostname (and port number, but only if necessary) followed by a 2- or 3-digit number, starting at "00". This means that we can always associate a content database with the web application it is associated with (it can only be associated to one), we have a running count of how many content databases are on that web application, and we can generally see the order they were created in. There's the natural question of "but how do I know which database a site was in?" here... but I'm happy to respond to that in the comments if someone asks the question. Simple answer: with rare exception, I don't actually care which DB contains which site.
Example: "SBX_Content_MySite_00", "SBX_Content_MySite_01"
Service Applications are a bit more tricky, because each one is different and they have differing numbers of databases. Generally though, I focus on the Proxy Group (and in my world, EVERY application belongs to a proxy group... "custom" is not an option), the service application name (without redundancy), and any additional qualifiers. Because there can be a lot of permuations of this, I'll give several examples...
Examples: "UAT_SA_Default_Metadata", "UAT_SA_Default_Profiles", "UAT_SA_Default_Profiles_Sync", "UAT_SA_Default_Profiles_Social", "UAT_SA_Internet_Search", "UAT_SA_Internet_Search_CrawlStore", "UAT_SA_Internet_Search_PropertyStore"
In these examples (though I'll bet it's obvious... again, it's a good thing!), "Default" and "Internet" are Service Application Proxy Groups (Default being the "default" proxy group in SharePoint), "Metadata", "Profiles", and "Search" are the kind of service application, and any extra parameters the differentiate the different types of DB that may be required.
This is only intended to be a good baseline idea, and is widely applicable to many, many users exactly as it is listed. However, it is not sufficient to solve every customer's needs. For example, hosting providers may need to include a section that focuses on the target customer (though I would bet that could be mostly satisfied with the proxy group). If you see that this doesn't meet your needs, then feel free to modify this method into something that does. I would incourage that you follow some basic rules though:
SharePoint may occasionally be unhelpful when trying to conform to a naming strategy... but you were looking for an excuse to dig deeper into PowerShell anyway, weren't you? :)
Yes, it's worth it. If nothing else, your DB will call you good names instead of bad ones, and may even include you on their holiday card list. Any day that a DBA says I have the best naming strategy in the company is a VERY good day. :)