Readme for Backup and Restore Sample
The Backup and Restore sample lets you use Analysis Management Objects (AMO) to connect to a server that is running Microsoft SQL Server 2005 Analysis Services (SSAS). The sample creates a new empty database, completes a backup of that database, deletes the database, restores the database from the backup, and deletes that database.
This sample shows you how to back up and restore your Analysis Services databases programmatically.
The Analysis Services sample uses the following items.
Before you run this sample, you should have the following software installed:
- .NET Framework SDK 2.0 or Microsoft Visual Studio 2005. You can obtain .NET Framework SDK free of charge. See Installing the .NET Framework SDK in SQL Server 2005 Books Online.
- An updated version of AdventureWorks database is also available for download on the SQL Server Developer Center Web page.
- An updated version of the SQL Server 2005 Database Engine samples is also available for download on the SQL Server Developer Center Web page.
After your sample has been successfully compiled, you have to access one of the SQL Server 2005 Analysis Services (SSAS) databases to test your program. We recommend that you use the AdventureWorks sample database that is provided with SQL Server 2005.
SQL Server 2005 Business Intelligence Development Studio is not supported on computers that run the Itanium-based platform; the 64-bit development environment is supported on x64-based platforms. SQL Server 2005 samples can be modified and run on computers that run either x86 or x64-based platforms when databases used by the samples are deployed on an Itanium-based platform.
Building the Sample
If you have not already created a strong name key file, generate the key file using the following instructions.
To generate a strong name key file
Open a Microsoft Visual Studio 2005 command prompt. Click Start, point to All Programs, point to Microsoft .NET Framework SDK 2.0, and then click SDK Command Prompt.
-- or --
Open a Microsoft .NET Framework command prompt. Click Start, point to All Programs, point to Microsoft .NET Framework SDK 2.0, and then click SDK Command Prompt.
Use the change directory command (CD) to change the current directory of the command prompt window to the folder where the samples are installed.
To determine the folder where samples are located, click the Start button, point to All Programs, point to Microsoft SQL Server, point to Documentation and Tutorials, and then click Samples Directory. If the default installation location was used, the samples are located in <system_drive>:\Program Files\Microsoft SQL Server\100\Samples.
At the command prompt, run the following command to generate the key file:
sn -k SampleKey.snk
For more information about the strong-name key pair, see "Security Briefs: Strong Names and Security in the .NET Framework" in the .NET Development Center on MSDN.
To build the Backup and Restore sample
Build the sample by using Visual Studio 2005 and the provided Visual Studio solution.
— or —
Build the sample using Microsoft MSBuild, which is included in the .NET Framework SDK 2.0, and executing a command similar to the following at a command prompt:
msbuild /nologo /verbosity:quiet /property:Configuration=Debug CS/BackupAndRestore.sln
Other Microsoft MSBuild build options can be used depending on your needs.
Running the Sample
To run the Backup and Restore sample
In Visual Studio 2005, press F5.
— or —
In Visual Studio 2005, click Start on the Debug menu
— or —
At a command prompt, run a command similar to the following:
The path might vary depending on the options that were used to compile the sample and the starting folder when at command prompt.
After you run the sample, the backup file of the temporary database created by the sample will be located at <system_drive>:\backup_file_generated_by_amo_sample_code.abf.
Help and Information
17 July 2006
5 December 2005