How to check DBs Used space and row counts

SQL Report to check the DBs used space and row counts

For smooth migration it’s always recommended to go through the environment validation and part of prerequisite is to check the SharePoint Content DB size and row counts which may interrupt the migration also check out SharePoint boundaries and limits.

https://docs.microsoft.com/en-us/sharepoint/install/software-boundaries-and-limits-0

SQL Command:
(To avoid any support from MS, I strongly recommend you to run below command in the non-production environment)

DECLARE c CURSOR READ_ONLY FAST_FORWARD FOR
SELECT [TABLE_NAME]
FROM INFORMATION_SCHEMA.TABLES
WHERE TABLE_TYPE = ‘BASE TABLE’
DECLARE @tableName varchar(100)
OPEN c
FETCH NEXT FROM c INTO @tableName
WHILE (@@FETCH_STATUS = 0)
BEGIN
exec sp_spaceused @tableName
FETCH NEXT FROM c into @tableName
END
CLOSE c
DEALLOCATE c

Reference: http://blogs.msdn.com/b/sowmyancs/archive/2012/06/29/alldocversions-amp-alldocstreams-table-size-after-upgrading-to-sharepoint-2010.aspx

Issue: Missing v4.master file during migration

While doing the upgrade of SharePoint 2013, recently I am facing the issue when mounting DB with SharePoint 2010 environment that v4.master file is missing in sites and subsites, workaround solution as mentioned below that either copy manually using SharePoint Designer on each location or run the Power Shell command as shown below:

PS Script to copy v4.master file.

$filepath=”c:\v4.master”
$doclibname=”Master Page Gallery”
$webUrl = “http://yoursiteurl”
UploadFileInLibrary $webUrl $DocLibName $filePath

The issue only raise in the next migration cycle when I normally do the actual migration, the reason is during first cycle it automatically copy the v4.master file where it was missing and save the GUID in the table but in the 2nd cycle mountdb assume that his site already migrated and hence do not copy the file on the missing location.

Solution:

There are two solutions:

1. During production cycle, do not remove test web application directly, follow the below steps:
•Delete site collection
•Run job forcefully this is scheduled for cleaning deleted site collections
•Delete web application

2. User -AssignNewDatabaseId parameter in the Mount-SPContentDatabase, it will “Creates a new database ID automatically when the content database is attached.”