November 8, 2017 at 1:28 pm
river1 - Wednesday, November 8, 2017 12:44 PMWhy do you say I need to create a normal share? I think that even with administrative share, if with right permissions, then this is not an issue. And this admin share was created just to hold backups
You can't modify permissions on admin shares - they are accessible to members of the local administrators group on the server where the drive is local.
Sue
November 8, 2017 at 3:21 pm
Jeff Moden - Wednesday, November 8, 2017 1:02 PMUnderstood and agreed on the high security thing except I don't trust the other people
that could get in as RESTRICTED_USER, either.
Fixed that one for you Jeff.
Put down that pork chop. Ha!
Lest anyone think I'm being mean, Jeff & I are friends.
"The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
- Theodore Roosevelt
Author of:
SQL Server Execution Plans
SQL Server Query Performance Tuning
November 8, 2017 at 7:17 pm
Grant Fritchey - Wednesday, November 8, 2017 3:21 PMJeff Moden - Wednesday, November 8, 2017 1:02 PMUnderstood and agreed on the high security thing except I don't trust the other people
that could get in as RESTRICTED_USER, either.
Fixed that one for you Jeff.Put down that pork chop. Ha!
Lest anyone think I'm being mean, Jeff & I are friends.
ROFLMAO!!! I love your tenacity for being completely accurate. 😀
--Jeff Moden
Change is inevitable... Change for the better is not.
November 9, 2017 at 12:24 am
Grant Fritchey - Wednesday, November 8, 2017 10:01 AMIt's very likely a permissions issue. When you run backups through SQL Agent, for example, that backup process is running under SQL Agent's login, whatever that might be. When you're connected to SQL Server through SSMS and running queries, it's your login. It's entirely possible you don't permission to that path. Or vice versa, you do and SQL Server does not.
Let me add the job code and an image of the job so that I can better ilustrate what I am not understanding.
I have this job:
which as this code:
Declare @DBName VARCHAR(200)
Declare @Path VARCHAR(1000)
As per image, this is a one step job and as NO user configurated by default as the run as user.
This means that the step (all t-sql inside the step) will run under the SQL Agent Service account? or will run under the account of the person that will execute the job ?
Because this is not a job that will be executed on a daily basis. This is a job that will be execute only manually (by clicking on the job and request it to run).
So question is, what is the security account that will be used to run the job? my security account or the SQL Server agent account?
My view (probably wrong) is that, the person how will click on the job to run it, only needs to have permissions to execute the job, then, what the job is doing (go to the shared folder and restoring) requires permissions on the SQL Server agent account.
In summary:
Person that runs the job: Permissions to execute the job, nothing more (does not even need permissions to restore.
SQL Server Agent account : Permissions to be able to restore and permissions to go to the share \\servername\G$\...
Am i correct?
Thank you
November 9, 2017 at 12:48 am
As an example, I have just changed the Job ower from SA to another account I am now getting the error:
Message
Executed as user: a2\sa-a2-capf-dwh-d-rm. Linked servers cannot be used under impersonation without a mapping for the impersonated login. [SQLSTATE 42000] (Error 7437). The step failed.
This means that this account a2\sa-a2-capf-dwh-d-rm needs to have permissions (login) on the PROD server to where this linked server that exists in dev points to, correct?
November 9, 2017 at 2:18 am
river1 - Thursday, November 9, 2017 12:24 AMPerson that runs the job: Permissions to execute the job, nothing more (does not even need permissions to restore.
Correct.
SQL Server Agent account : Permissions to be able to restore and permissions to go to the share \\servername\G$\...
No, that permission is needed for the SQL Server account. At least, it is for backups, and I imagine it's the same for restores. But, as already discussed, you can't change the permissions on the G$ share. You would have to have the SQL Server account put into the local admins group on the server servername. Ask those who are refusing to create you a share whether it's preferable to do that, or create a share with suitably restricted permissions.
John
November 9, 2017 at 2:58 am
John Mitchell-245523 - Thursday, November 9, 2017 2:18 AMriver1 - Thursday, November 9, 2017 12:24 AMPerson that runs the job: Permissions to execute the job, nothing more (does not even need permissions to restore.Correct.
SQL Server Agent account : Permissions to be able to restore and permissions to go to the share \\servername\G$\...
No, that permission is needed for the SQL Server account. At least, it is for backups, and I imagine it's the same for restores. But, as already discussed, you can't change the permissions on the G$ share. You would have to have the SQL Server account put into the local admins group on the server servername. Ask those who are refusing to create you a share whether it's preferable to do that, or create a share with suitably restricted permissions.John
Thank you for your answer John, but if this restore is going to be executed by a SQL Server Job under SQL Server Agent, why do you say that its the SQL Server Service account that needs to have permissions insted of the SQL Server Agent Service account?
November 9, 2017 at 3:05 am
river1 - Thursday, November 9, 2017 2:58 AMThank you for your answer John, but if this restore is going to be executed by a SQL Server Job under SQL Server Agent, why do you say that its the SQL Server Service account that needs to have permissions insted of the SQL Server Agent Service account?
Because it's the database engine that's doing the restore. The SQL Server Agent account is running a SQL command, not accessing the files directly. This surprised me when I learned it recently, but now all our backup locations have permissions for the SQL Server account only, and they all work properly. But once again, don't take my word for this. Set it up so that SQL Server and SQL Server Agent have access to the share, and make sure it works. Then remove access for SQL Server, and see whether it still works. Then swap over so that only SQL Server Agent has access, and see what happens then.
John
November 9, 2017 at 3:35 am
They have finally agreed in sharing. So now its:
\\Servername\Backups\dwhCore\dwhCore_FULL_201711050200.bak
Now, question is, who needs to have permissions in this share?
The SQL Server Agent Service Account where the job that has the step is running?
The SQL Server Service Account?
Or the owner of the job?
Thank you,
November 9, 2017 at 5:57 am
river1 - Thursday, November 9, 2017 3:35 AMThey have finally agreed in sharing. So now its:\\Servername\Backups\dwhCore\dwhCore_FULL_201711050200.bak
Now, question is, who needs to have permissions in this share?The SQL Server Agent Service Account where the job that has the step is running?
The SQL Server Service Account?
Or the owner of the job?
Thank you,
What John said. The SQL Server service account.
"The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
- Theodore Roosevelt
Author of:
SQL Server Execution Plans
SQL Server Query Performance Tuning
November 9, 2017 at 6:08 am
Thank you.
So the SQL Server Service account (Not the SQL Agent account) need to have permissions to go to:
\\Servername\backups\....
And to have restore permisisons (which by defaut it already has.
As for the user that will execute the job, the only permissions it will need is to execute the job it self, correct?
The user does not need any restore nor shared location permissions, correct?
November 9, 2017 at 6:29 am
Actually, I have changed the owner of the job to : a2\sa-a2-capf-dwh-d-rm$
and now I get the following infromation when trying to run the Job:
Executed as user: a2\sa-a2-capf-dwh-d-rm. Linked servers cannot be used under impersonation without a mapping for the impersonated login. [SQLSTATE 42000] (Error 7437). The step failed.
So as summary I think that permissions need to be like this:
Restore operations are executed by the SQL Server Service account.
Based on this, in each of the environments to be refreshed, SQL Server Service account needs the following permissions:
As for the account owning the Job: a2\sa-a2-capf-dwh-d-rm (Dev example)
The user that triggers the job needs permission to execute the Job 05 – DWH RestoreFromProd (no additional permissions needed for the user)
Can you please validate?
Viewing 12 posts - 31 through 41 (of 41 total)
You must be logged in to reply to this topic. Login to reply