I've two SQL Server databases and both of them are on cloud.
- First server is source
- Second server is destination
I only have a non SA access. And I'm using DBForge Studio for managing the database. I'm trying to copy the database from the first server to the second server through DBForge→Database Sync→Copy Database
and then select copy (I'm following this article).
Note: The database already exists in destination with same name, but no tables yet.
I got an error message when trying to copy:
The EXECUTE permission was denied on the object 'xp_fileexist'.....
Then I try to copy & overide but I got the same error message.
So I try to use another way like export & import. I export the database from source server into .sql, but there are only queries for insert, it didn't serve the query for create table schema, and I tried to import into another file like .csv and .xsl but I got the same, it only contain data without schema.
Is there any better way to copy the database without SA access?
-
What access do you have on the destination database?James Jenkins– James Jenkins2019年09月19日 14:28:07 +00:00Commented Sep 19, 2019 at 14:28
1 Answer 1
Is there any better way to copy the database without SA access?
Yes, you do not have to be sa
or sysadmin
member to perform the activity that you described, but following are the least privileges required to do so.:
You must be member of
- Database role:
db_ddladmin
or Database role:db_owner
at source server - Server role:
dbcreator
at destination server
You can verify current membership with following query (1=YES, 0=NO):
---- Source server
select IS_MEMBER ('db_ddladmin' ) as Is_DDLAdmin,
IS_MEMBER ('db_owner' ) as Is_DBOwner
go
---- Destination server
select IS_SRVROLEMEMBER ('dbcreator' ) as Is_DBCreator
go
I haven't used dbForge studio, but using SSMS free tool provided by Microsoft, and while having permissions (as mentioned above), you can achieve what your looking for (export data along with objects into .sql
format)
via SSMS -> Tasks -> Generate script option. focus on following options at Advanced scripting options
- Types of data to script = Data and schema
- Script for server version = your desired version
-
in source and destination I've same user role, which can only add, delete, modify record, column, and table. Base on your desc it should work. I'll try, thankyouBlackjack– Blackjack2019年09月24日 08:11:47 +00:00Commented Sep 24, 2019 at 8:11