Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 982
  • Last Modified:

SQL Server permission issue


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
akohan
Asked:
akohan
  • 6
  • 3
1 Solution
 
mass2612Commented:
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
 
akohanAuthor Commented:

I will get back to you today.

Regards.
0
 
mass2612Commented:
How did you get on?
0
Making Bulk Changes to Active Directory

Watch this video to see how easy it is to make mass changes to Active Directory from an external text file without using complicated scripts.

 
akohanAuthor Commented:

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
 
mass2612Commented:
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
 
akohanAuthor Commented:



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
 
akohanAuthor Commented:

OK solved it.
0
 
akohanAuthor Commented:


Solution is

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

0
 
akohanAuthor Commented:
I tried this SQL command in a query and worked fine.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

  • 6
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now