Quantcast
Channel: SQLServerCentral » SQL Server 2014 » Administration - SQL Server 2014 » Latest topics
Viewing all articles
Browse latest Browse all 6525

Restore Database permission failure

$
0
0
I would appreciate any help someone can give me with this.I'm trying to figure out why this SQL Agent job keeps failing. We used management studio, and connected as mydomain\myuser, and developed a script to take a backup file from a network share and restore it. It worked fine in SSMS under that login.After we got it working , we created a SQL Agent job on the same server to run the script, and set the agent job to run under that account that we tested with.This is the error message we got:[b]"Executed as user: mydomain\myuser. Create Database permission denied in database master'.[/b]So, I gave that login the rights to Create Database and Create Any Database. Then the error message changed to: [b]"Executed as user: mydomain\myuser. User does not have permission to RESTORE database 'mydatabase'. [SQLSTATE 42000][ERROR 3013] RESTORE DATABASE is terminating abnormally. [SQLSTATE 42000] (Error 3013). The step failed. " [/b]* I can't use SA for the job account, because the SA account doesn't have rights to see the network folder where the backup file sits, so it has to run under the domain account.* The user is a member of the dbcreator role - and the serveradmin and sysadmin roles* The user is a member of dbowner on the database I am trying to overwrite with the restore* I have given the user the rights CREATE DATABASE and CREATE ANY DATABASEThe only suspicious thing I found was that it appears the server was renamed at one time. When I looked at the login in management studio, I was not able to change some of the rights. On the Securables page, it shows the server name as "MyServer-New", but the server name is "MyServer". It is a replacement, and I suspect that when they did the replacement they named it "MyServer-New", set everything up, then renamed it.I found this post listed below, and ran the script (shown below), and it showed that the server name was MyServer and the Server\InstanceName is MyServer-New[url]http://blog.sqlauthority.com/2015/07/13/sql-server-how-to-change-server-name/[/url][code="sql"]SELECT HOST_NAME() AS 'host_name()',@@servername AS 'ServerName\InstanceName',SERVERPROPERTY('servername') AS 'ServerName',SERVERPROPERTY('machinename') AS 'Windows_Name',SERVERPROPERTY('ComputerNamePhysicalNetBIOS') AS 'NetBIOS_Name',SERVERPROPERTY('instanceName') AS 'InstanceName',SERVERPROPERTY('IsClustered') AS 'IsClustered'[/code]I can't reset SQL until the next maintenance window to test changing the server name as outlined in the post.Has anyone seen anything like this before? Am I on the right track with the name change messing up permissions, or is there something else I need to check?Thanks for any help anyone can offerWayne

Viewing all articles
Browse latest Browse all 6525

Trending Articles