Solved

SQL Server permission issue

Posted on 2011-02-16
9
952 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
Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

 

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

Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

Question has a verified solution.

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

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…
The recent Microsoft changes on update philosophy for Windows pre-10 and their impact on existing WSUS implementations.
This tutorial will walk an individual through locating and launching the BEUtility application to properly change the service account username and\or password in situation where it may be necessary or where the password has been inadvertently change…
This tutorial will show how to configure a new Backup Exec 2012 server and move an existing database to that server with the use of the BEUtility. Install Backup Exec 2012 on the new server and apply all of the latest hotfixes and service packs. The…

696 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