I have a database with .sql
extension which is exported from server using putty.
How to import this into SQL Server 2012 in Management Studio?
It is not accepting .sql
as database, throwing error.
If I try to restore using
RESTORE HEADERONLY FROM DISK = N'D:\LogFile\accesslog.sql';
I am getting the following error:
Msg 262, Level 14, State 1, Line 1
CREATE DATABASE permission denied in database 'master'.Msg 3013, Level 16, State 1, Line 1
RESTORE HEADERONLY is terminating abnormally.
Please help me with this.
2 Answers 2
You can't directly restore a MySQL backup to MSSQL. What you can do is use tools such as Microsoft SQL server migration assistant.
But those still won't help you if you don't have the proper permissions on the destination server. You'll most likely be creating a database, editing schemas and creating logins and users. Which means you need the sysadmin role.
Possible duplicate of this question or this question.
From BOL:
If the database being restored does not exist, the user must have CREATE DATABASE permissions to be able to execute RESTORE. If the database exists, RESTORE permissions default to members of the sysadmin and dbcreator fixed server roles and the owner (dbo) of the database (for the FROM DATABASE_SNAPSHOT option, the database always exists).
You're creating a database on your server, regardless of the fact that it already existed on another server, therefore you need CREATE DATABASE
permissions.
sysadmin
role.CREATE DATABASE
permissions to create a database, even if it was an export from another server. You also need to let us know what type of database you exported from. Was it SQL Server? MySQL? Oracle?