SPContentDatabase.CreateUnattachedContentDatabase method (String, String, String, String)
Creates a content database object, by using the specified connection information, without registering it in the configuration database of the farm.
Namespace: Microsoft.SharePoint.Administration
Assembly: Microsoft.SharePoint (in Microsoft.SharePoint.dll)
Syntax
'Declaration
Public Shared Function CreateUnattachedContentDatabase ( _
databaseInstanceServer As String, _
databaseName As String, _
username As String, _
password As String _
) As SPContentDatabase
'Usage
Dim databaseInstanceServer As String
Dim databaseName As String
Dim username As String
Dim password As String
Dim returnValue As SPContentDatabase
returnValue = SPContentDatabase.CreateUnattachedContentDatabase(databaseInstanceServer, _
databaseName, username, password)
public static SPContentDatabase CreateUnattachedContentDatabase(
string databaseInstanceServer,
string databaseName,
string username,
string password
)
Parameters
databaseInstanceServer
Type: System.StringThe name of the database instance, such as Server/Microsoft##SSEEMirror, not the name of the physical server that is hosting it.
databaseName
Type: System.StringThe name of the database.
username
Type: System.StringThe user name that will login to the database.
password
Type: System.StringThe password of the user.
Return value
Type: Microsoft.SharePoint.Administration.SPContentDatabase
The content database.
Remarks
Typically, unattached content databases are used for data recovery scenarios and to get orphaned site collections and sites.
If SQL authentication is not being used, then username and password can be a null reference (Nothing in Visual Basic) or empty strings.
See also
Reference
CreateUnattachedContentDatabase overload
Microsoft.SharePoint.Administration namespace