Share via


Managed Data Hosting::RestoreCustomerDbFromDisk

This procedure performs a full restore of a specified database from disk. Simple pass-through method to the SQL Admin Provider with an additional security check.

Note

You cannot immediately restore a database from backup over an existing database. Wait at least five minutes before attempting the restore procedure.

Arguments

Argument Required Description

<orgLdapPath>

Yes

LDAP path of the owning organization.

<databaseName>

Yes

The name of the database to be modified.

<preferredDomainController>

Yes

<filePath>

Yes

The full file path to the file to retrieve the backup from.

<serverName>

Yes

Server name where SQL database resides.

<dataRootShare>

Yes

Share to write log and data files.

<position>

No

The instance (if necessary) of the backup within the backup file. This is necessary if a particular file contains multiple backups.

<sqlUserName>

No

User name for connecting to the SQL server via SQL Authentication. If this node is present, the connection will be made via SQL Authentication rather than Windows Authentication. The existence of this node also requires that the <sqlUserPass/> node exist.

<sqlUserPass>

No

The password for connecting to the SQL server via SQL Authentication, using the username indicated by <sqlUserName/>. If the <sqlUserName/> node is not present, this node is ignored.

Remarks

Method

public string   RestoreCustomerDbFromDisk( 
                                        string orgLdapPath,  
                                        string databaseName,  
                                        string preferredDomainController, 
                                        string filePath,  
                                        string serverName,  
                                        string dataRootShare, 
                                        string position,  
                                        string sqlUserName,  
                                        string sqlUserPass, 
                                        bool sendCredentials) 

Sample Code

Typical C# Usage

//Get user name and password.    
        string userName = this.Request.ServerVariables.Get("AUTH_USER"); 
        string pass = this.Request.ServerVariables.Get("AUTH_PASSWORD"); 
        //Set credentials. 
        sqlAdminWS.PreAuthenticate = true; 
        sqlAdminWS.Credentials = new NetworkCredential(userName,pass); 
 
        lblMsg.InnerHtml = mpsResponseHeaderLabel; 
        //Display response. 
        this.mpsResponse.DocumentSource = ""; 
        response = sqlAdminWS. RestoreCustomerDbFromDisk(orgLdapPath,databaseName,  
preferredDomainController,filePath, position, sqlUserName, sqlUserPass, sendCredentials); 
                         
        // set the response XML to match the return from MPF 
        responseXml.LoadXml(response); 
        this.mpsResponse.Document = responseXml; 
lblDone.InnerText = successMsg; 

Applies To

Managed Data Hosting Web Service for:

  • Hosted Messaging and Collaboration version 4.0

  • Hosted Messaging and Collaboration version 3.5

  • Hosted Messaging and Collaboration version 3.0

  • Windows-based Hosting version 4.5

  • Windows-based Hosting version 4.0

  • Windows-based Hosting version 3.5

  • Windows-based Hosting for Applications version 1.0

See also

Tasks

Managed Data Hosting::BackupCustomerDbToDisk