Benefits of Test-SPContentDatabase Powershell Command, while a powerful command for upgrade it’s not just for upgrade. It’s a new tool in your SharePoint toolbox used in all phases of a SharePoint deployment.
1. Content database insight from SharePoint 2010 – You can run the test-spcontentdatabase at any time to get insight on your content databases, and hence not only benefits your ability to discover issues before upgrade, but also after upgrade and should be used as a commandlet that you use for validation for both database attach and in place as a post upgrade validation.
2. Complements pre-upgrade checker report – PreUpgradeCheck is an awesome command. It should be used on all 2007 farms as often as you can, but once the data is on 2010 you don’t have that command. The Test-SPContentDatabase gives you the ability to check against the servers in the new farm and can be used to identitify unique issues to the each of the servers in the farm. It definitely can be used in compliment with preupgradecheck and should be. Any database attach commands should include both preupgrade check on the source and test-spcontentdatabase on the destination. There’s nothing keeping you from running this command and preupgrade check and to compare results.
3. Reports data from server/database pairing – Not only do you get farm level information, but you get much more specific stats about the status of individual servers when running the test-spcontentdatabase on each server in the farm. The output is specific to the server.
4. Compares against a specific web application – When preparing to attach a database you want to know the specifics to the features that may have been added to a specific web application and test-spcontentdatabase gives you that insight.
5. Identifies current or potential issues - Data orphans, Missing site definitions, Missing features, Missing assemblies
6. Can show table sizing metrics – Get metrics used for planning
7. Scans WSS 3.0, SharePoint 2007 and SharePoint Foundation, SharePoint 2010 content databases - Can be used to scan both SharePoint 2007 databases and 2010 database, so don’t throw away this command. This commandlet should be part of any troubleshooting around issues that involve 2010.
8. Makes no changes to the database – It’s a read only operation. Don’t be afraid of it trying to set flags or flipping bits. There’s no changes… same with preupgradecheck.
9. Schedule it to monitor for problems – If you are trying to keep on top of issues related to files, orphans or other issues, you can schedule this commandlet to run on a recurring basis and review the reports.
10. Test Upgrade without running Upgrade – Without running the actual upgrade you can use the command to get a heads up way before hand, and since it’s read only, you can make changes to be better prepared and run it again and again as you fix and address issues.
Sample Results:
Syntax and Usage
You can get more information on the command in the help and usage including syntax.
Quoted from the beta 2 powershell commandlet help files for Test-SPContentDatabase
“NAME
Test-SPContentDatabase
SYNOPSIS
Tests a content database.
SYNTAX
Test-SPContentDatabase -Name -WebApplication [-AssignmentCollection ] [-DatabaseCredentials ] [-ServerInstance ]
DESCRIPTION
The Test-SPContentDatabase cmdlet tests a content database.
PARAMETERS
-Name
Specifies the existing content database to test.
The type must be a valid name of a SharePoint content database; for example, SPContentDB1.
-WebApplication
Specifies the SharePoint Web application to use to test the content database.
The type must be a valid GUID, in the form 12345678-90ab-cdef-1234-567890bcdefgh; or a valid name of SharePoint Web application (for example,
MyOfficeApp1); or an instance of a valid SPWebApplication object.
-AssignmentCollection
PShell_param_AssignmentCollection
PShell_param_AssignmentCollection_Note
-DatabaseCredentials
Specifies the PSCredential object that contains the user name and password to be used for database SQL authentication.
The type must be a valid PSCredential object.
-ServerInstance
Specifies the instance of the database service to use to test the specified content database.
The type must be a valid GUID, such as 12345678-90ab-cdef-1234-567890bcdefgh; a valid name of a SQL Server instance (for example, DBSvrInstance1); or an instance of a valid SPDatabaseServiceInstance object.
–
This cmdlet supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction, WarningVariable, OutBuffer and OutVariable. For more information, type, "get-help about_commonparameters".
Add code example
REMARKS
To see the examples, type: "get-help Test-SPContentDatabase -examples".
For more information, type: "get-help Test-SPContentDatabase -detailed".
For technical information, type: "get-help Test-SPContentDatabase -full".”
Closed Quote
Additional info and resources on Test-SPContentDatabase on SharePointJoel.com
Posted
Tue, Jan 12 2010 4:55 PM
by
Joel Oleson