Solved

SQL Server permission issue

Posted on 2011-02-16
9
947 Views
Last Modified: 2012-05-11

Hello group,

I am trying to use the right click "Script Database As" function in Management Studio to create a script so later I can import database and its data on a different sdrver.

When I do this then I get a message as following:

Could not read metadata, possibly due to insufficient access rights. (Microsoft.SqlServer.Smo)

Any help will be appreciated.

Thanks.


0
Comment
Question by:akohan
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
  • 3
9 Comments
 
LVL 29

Expert Comment

by:mass2612
ID: 34912925
Hi,

Try this open SQL Server Mangt Studio > Connect to the SQL instance > Right click the instance name > select Properties > Select Permissions > Select the Username (of the user with the error) > scroll down the list of Explicit Permissions and Grant "View any definition".

Then have the user close all connection to SSMS and re-open and try again.
0
 

Author Comment

by:akohan
ID: 35030413

I will get back to you today.

Regards.
0
 
LVL 29

Expert Comment

by:mass2612
ID: 35048338
How did you get on?
0
Webinar: Aligning, Automating, Winning

Join Dan Russo, Senior Manager of Operations Intelligence, for an in-depth discussion on how Dealertrack, leading provider of integrated digital solutions for the automotive industry, transformed their DevOps processes to increase collaboration and move with greater velocity.

 

Author Comment

by:akohan
ID: 35048880

OK. I found I was not using sa account .... but I think the main problem is that I'm doing this on 2 different machines:

machine A has db1
machine B has db2

when I get backup of db1 and want to restore it on B it complains that layout of databases are different.

Any suggestion?

Thanks.
0
 
LVL 29

Expert Comment

by:mass2612
ID: 35061785
When you say layout do you mean the physical location and database logical file names? If that's the case you just need to update your script / GUI settings when doing the restore to point to the correct names and locations on machine B
0
 

Author Comment

by:akohan
ID: 35183231



Yes different machine. I'm still getting

System.Data.SqlClient.SqlError: The backup set holds a backup of a database other than the existing 'StoreDB' database. (Microsoft.SqlServer.Smo)
0
 

Author Comment

by:akohan
ID: 35183730

OK solved it.
0
 

Accepted Solution

by:
akohan earned 0 total points
ID: 35183738


Solution is

RESTORE DATABASE MyDataBaseName FROM DISK = 'C:\MyDataBasename.bak' WITH REPLACE

0
 

Author Closing Comment

by:akohan
ID: 35221261
I tried this SQL command in a query and worked fine.
0

Featured Post

Three Reasons Why Backup is Strategic

Backup is strategic to your business because your data is strategic to your business. Without backup, your business will fail. This white paper explains why it is vital for you to design and immediately execute a backup strategy to protect 100 percent of your data.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this article I will describe the Detach & Attach method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
New Windows 7 Installations take days for Windows-Updates to show up and install. This can easily be fixed. I have finally decided to write an article because this seems to get asked several times a day lately. This Article and the Links apply to…
This tutorial will show how to push an installation of Backup Exec to an additional server in both 2012 and 2014 versions of the software. Click on the Backup Exec button in the upper left corner. From here, select Installation and Licensing, then I…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …

739 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question