2

Can anyone help me in doing this task? I am using my sql azure database in my local machine's sql server management studio 2008 r2. What my issue is, I am trying to take backup of a database from my c# console application using the following methods:

  • using smo: showing error at "sqlBackup(server)" method. The error details like -

    System.IndexOutOfRangeException: Index was outside the bounds of the array. at Microsoft.SqlServer.Management.Smo.SqlPropertyMetadataProvider.PropertyNam eToIDLookupWithException(String propertyName, PropertyAccessPurpose pap) at Microsoft.SqlServer.Management.Smo.SqlSmoObject.GetDbComparer(Boolean inSe rver) at Microsoft.SqlServer.Management.Smo.SqlSmoObject.InitializeStringComparer()

    at Microsoft.SqlServer.Management.Smo.AbstractCollectionBase.get_StringCompar er() at Microsoft.SqlServer.Management.Smo.SimpleObjectCollectionBase.InitInnerCol lection() at Microsoft.SqlServer.Management.Smo.SmoCollectionBase.InitializeChildCollec tion(Boolean refresh) at Microsoft.SqlServer.Management.Smo.SmoCollectionBase.GetEnumerator()

  • using "backup database" command, this showing command not supported in this version of sql server. After searching in internet, i found that this command wont support for azure databases in ssms. Can anyone please provide me solution to solve this.

2 Answers 2

10

You can not backup the Database in Azure Sql Service. When try to Backup Shows this Error

Statement 'BACKUP DATABASE' is not supported in this version of SQL Server.

So Backup Azure SQL Service by Right Click on Db --> Tasks --> Export data Tier Application --> Set Location Creates a bacpac file after export, then it can be import via this

Note: Be aware there are export and extract. The extract option only copies the schema, so if you need the data as wel make sure to use the export variant.

Sign up to request clarification or add additional context in comments.

Comments

1

For security reasons, SQL server instance doesn't allow database migrations between two different target servers such as local and azure or vice versa.

The below tool can help run the scripts on one server to another. Keep in mind that when you run them it restores the schema and the data fully. You can alter the settings in Advanced option.

https://sqlazuremw.codeplex.com/

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.