Grant permissions to SQL Server 2005 - sql

Iam working in ruby on rails for fetching existing tables from remote MS Sql database.Iam getting this error while trying to run the application.
ODBC::Error: 42000 (229) [Microsoft][ODBC SQL Server Driver][SQL Server]The SELECT permission was denied on the object 'TeviceDetails', database 'BObd', schema 'dbo'.: EXEC sp_executesql N'SELECT [TeviceDetails].* FROM [TeviceDetails]'
From forums and other sites i understand this is due to 'permission denied from server DB' and mentioned several solutions to rectify this.following are the solutions i got from forums.
But my problem is, i really don't know where to type/grant these privileges. (Is it in ruby console or ODBC console.If it is in ODBC console ,from where i can access this ODBC console??)
USE msdb
CREATE USER [TheUser] FOR LOGIN [TheLogin]
GO
GRANT EXECUTE ON sp_start_job TO [TheUser]
GO
SQLAgentUserRole
SQLAgentReaderRole
SQLAgentOperatorRole

The easiest place to do that is in SQL Server Management Studio, or SSMS. It's a free download from Microsoft.
http://www.microsoft.com/en-us/download/details.aspx?id=8961
You could type these into an ODBC console but you may as well get the proper tool for the job.

Please read this answer.
TSQL to grant db_datareader and db_datawriter for MS SQL Server
You can execute this once for the database.

Related

Taking ownership for SQL Server Management Studio

I'm new to SQL Server 2008. I just installed SQL Server Express. I'm having trouble creating a new database, and I think I don't have permission.
I login like this, please see this screenshot:
Then I tried to create a new database and I got this:
I tried to search for some solution and this what I've got:
http://blogs.msdn.com/b/sqlexpress/archive/2010/02/23/how-to-take-ownership-of-your-local-sql-server-2008-express.aspx
But I can't download the script and the page says:
An error occurred while processing your request.
Please help. Kind regards
I resolved my problem with the following steps:
Set the instance of the SQL Service to single-user mode:
Open SQL Server Configuration Manager. Double click SQL Server Services.
Stop all SQL Server services
Right click SQL service and click Properties, in the Advanced tab, look for 'Startup Parameters'
Insert '-m;' at the beginning of the Startup Parameters value
Start the SQL service
Open SQL Server Management Studio and login with Windows authentication, you can now add user or change password of different users.
Hope this helps!
Try logging in with the sa account and grant permissions to your Windows account.
If you do not know the sa password use sqlcmd and execute the following commands:
Use Master
Go
ALTER LOGIN [sa] WITH PASSWORD=N'NewPassword'
Go
Login with the sa account and GRANT permission to the account.
USE Master;
GRANT CREATE DATABASE TO Jommel;

Cant access SSIS packages in MSDB folder via SSMS

The SQL Server instance specified in SSIS service configuration is not
present or is not available. This might occur when there is no default
instance of SQL Server on the computer. For more information, see the
topic "Configuring the Integration Services Service" in Server 2008
Books Online.
Login failed for user 'XXXXX'. (MsDtsSrvr)
After connecting to Intergation Services on the server, I get the above error error message when i try open the MSDB folder under Stored Packages. This is a default instance of SQl server. I've checked the MsDtsSrvr.ini.xml file and all looks fine. The user has access to MSDB system tables. Can anyone recommend any thing else to check?
add the user as a login to the SQL server with sys_admin rights to msdb (taken from last comment in reply to the original question, by davey, #june 19th at 21:54which worked for me - this is the answer)

Creation of database in SQL Server 2008

I am unable to create a database in SQL Server 2008. This is the message that I recieve every time:
TITLE: Microsoft SQL Server Management Studio
------------------------------
Create failed for Database 'university'. (Microsoft.SqlServer.Smo)
------------------------------
ADDITIONAL INFORMATION:
An exception occurred while executing a Transact-SQL statement or batch. (Microsoft.SqlServer.ConnectionInfo)
------------------------------
CREATE DATABASE permission denied in database 'master'. (Microsoft SQL Server, Error: 262)
For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=10.00.1600&EvtSrc=MSSQLServer&EvtID=262&LinkId=20476
What should be done?
This is related to the permission of the logged in user.
Solution 1)
Click on Start -> Click in Microsoft SQL Server 2005
Now right click on SQL Server Management Studio
Click on Run as administrator
Solution2)
check with select user_name() if you are not logged in as guest.
Add a domain account as sysadmin to SQL Express with SQLCMD
Start a command shell elevated
type SQLCMD –S (local)\sqlexpress
CREATE LOGIN [your domain account] FROM WINDOWS;
check if the login is created successfully
SELECT NAME FROM SYS.SERVER_PRINCIPALS
Grant sysadmin rights
SP_ADDSRVROLEMEMBER ‘darth\vader’, ‘sysadmin’
Reference : http://blogs.msdn.com/b/dparys/archive/2009/09/17/create-database-permission-denied-in-database-master-my-fix.aspx
You need to give the account your using permission to create databases.
You may need to login using the sa account and perform a GRANT on the user account.
GRANT CREATE DATABASE TO YourAccount;
http://msdn.microsoft.com/en-us/library/ms178569.aspx

Error when trying to create subscriptions in reporting services

I am trying to set up reporting emailing SQL Server 2005 Reporting Services. When I click to save a subscription I recieve the following error:
An internal error occurred on the report server. See the error log for more details. (rsInternalError) Get Online Help The SELECT permission was denied on the object 'sysservers', database 'mssqlsystemresource', schema 'sys'.
I was under the impression Reporting Services uses the role RSExecRole which is created during installation. Isn't mssqlsystemresources something that is not supposed to, and not easily touched?
This is most because the user doesn't have permissions setup correctly. Can you check if RSEXECROLE doesn't have any DENY permissions and has correct permissions on the reportserver db.
http://www.sqlservercentral.com/blogs/brian_kelley/archive/2007/11/6/3195.aspx
Based on the code in the above url, RSEXECROLE should have 323 rows on SQL Server 2005 SP3. Yours should match that.
Let me know what you find.

Problem with connection to MS SQL Server database using SSMS

I have a database on line with Godaddy (who uses SQL Server 2005). They provide basic management tools, but tell you that for more advanced tools you can connect directly using SSMS. I followed their instructions to ensure my online database will accept remote connections, and can apparently log in using SSMS with success (after giving my hostname and access data).
However: Now from in SSMS, when attempting to expand the "Databases" folder tree, I get the following error:
Failed to retrieve data for this request. (Microsoft.SqlServer.Management.Sdk.Sfc)
For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server& LinkId=20476
ADDITIONAL INFORMATION:
An exception occurred while executing a Transact-SQL statement or batch. (Microsoft.SqlServer.ConnectionInfo)
The server principal "cmitchell" is not able to access the database "3pointdb" under the current security context. (Microsoft SQL Server, Error: 916)
For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=09.00.4262&EvtSrc=MSSQLServer&EvtID=916&LinkId=20476
I been having the same problem but finally fix the issue.
http://clayburt.com/2009/12/28/godaddy-windows-hosting-ms-sql-2005-database-with-sql-management-studio-ssms-2008/
Read the direction carefully
Open SSMS
Connect to the Database with Godaddy
Open "Object Explorer Details"
Click on Database
Right-Click on any column name heading
Un-check collation column
I do know why this happen but it happen to fix the problem for me. Hope that helps!
You don't appear to have permissions to view that database. I would suggest GODaddy tech support would be the place to resolve the issue.