HI
I want to create new sql account in sql server 2005,and user only able view sql agent job history details only.How do I do this.Please help.
Thanks
Tank50
HI
I want to create new sql account in sql server 2005,and user only able view sql agent job history details only.How do I do this.Please help.
Thanks
Tank50
Good catch, — mapping the login to msdb and choosing an Agent role is the right approach. One important clarification: SQLAgentUserRole only lets a user see and manage jobs they own. If the requirement is to let the user view job history for all jobs (but not change them), assign SQLAgentReaderRole instead. SQLAgentOperatorRole grants broader operational rights (start/stop/run jobs, manage operators), so avoid that unless you want those capabilities.
Quick steps (GUI):
SQLAgentUserRole or SQLAgentReaderRole).T-SQL examples (run as a user with permissions):
-- Windows login
CREATE LOGIN [DOMAIN\UserName] FROM WINDOWS;
USE msdb;
CREATE USER [DOMAIN\UserName] FOR LOGIN [DOMAIN\UserName];
EXEC sp_addrolemember 'SQLAgentReaderRole', 'DOMAIN\UserName'; -- SQL login
CREATE LOGIN [sqluser] WITH PASSWORD = 'StrongP@ssw0rd';
USE msdb;
CREATE USER [sqluser] FOR LOGIN [sqluser];
EXEC sp_addrolemember 'SQLAgentReaderRole', 'sqluser'; Troubleshooting and cautions:
sysadmin server role — that gives full control.SELECT on msdb.dbo.sysjobhistory (and join to sysjobs for names), but this is more fragile across versions than using the built-in Agent roles.sp_helpuser.Thanks to for the documentation pointers and to for confirming the GUI mapping — choose SQLAgentReaderRole if you need global history visibility.
— debasisdas 580Jump to Post
Hi
Thanks for Reply.I found the how to do this.First create server loging sql server 2005.After that in user mapping select msdb table and select role as sqlagentuser role.
Thanks
Tank46
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.