Solved

SQL Server permission issue

Posted on 2011-02-16
9
923 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
  • 6
  • 3
9 Comments
 
LVL 29

Expert Comment

by:mass2612
Comment Utility
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
Comment Utility

I will get back to you today.

Regards.
0
 
LVL 29

Expert Comment

by:mass2612
Comment Utility
How did you get on?
0
 

Author Comment

by:akohan
Comment Utility

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
Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

 
LVL 29

Expert Comment

by:mass2612
Comment Utility
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
Comment Utility



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
Comment Utility

OK solved it.
0
 

Accepted Solution

by:
akohan earned 0 total points
Comment Utility


Solution is

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

0
 

Author Closing Comment

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

Featured Post

Backup Your Microsoft Windows Server®

Backup all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Join & Write a Comment

Occasionally there is a need to clean table columns, especially if you have inherited legacy data. There are obviously many ways to accomplish that, including elaborate UPDATE queries with anywhere from one to numerous REPLACE functions (even within…
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 tutorial will walk an individual through the steps necessary to configure their installation of BackupExec 2012 to use network shared disk space. Verify that the path to the shared storage is valid and that data can be written to that location:…

771 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now