sql view server state permission was denied - sql-server

I just installed SQL server 2014 however, I have a problem creating the database or even view properties.
I get "VIEW SERVER STATE permission was denied on the object 'server', database 'master'. Microsoft Server, Error:300"
I cannot alter my server roles, I have only "Public" role for some reason.
any ideas?

connect to ssms using administrator(sysadmin) account and execute the below
USE MASTER
GO
GRANT VIEW SERVER STATE TO [username]

From SQL Server Expert
Login user do not have VIEW SERVER STATE permission and granting the required permission solves the issue.
USE MASTER
GO
GRANT VIEW SERVER STATE TO <username>

Just for reference, this problem seems to be related to this bug.
I have the same problem with SQL Server Management Studio 2012.
If anyone finds stuck with this problem, try to update the SQL Server Management Studio. This way, you don't need to grant the permission VIEW SERVER STATE to the user.
Using SQL Server Management Studio 2014 (12.0.4213.0) now, and the problem seems to be gone

Related

Data Migration Assistant SQL Server to Azure VIEW Server State

I have a SQL Server 2012 database that I want to migrate to Azure SQL using the Data Migration Assistant v5.2. When I get to the Select Target section, I enter a SQL Authentication account that is in the dbmanager group. I get an error:
VIEW SERVER STATE permission was denied on object 'server', database 'master'.
The user does not have permission to perform this action.
And can go no further.
How do I get past this?
Thank you,
Dep
To run an assessment(DMA), you have to be a member of the SQL Server sysadmin role.
Please ref: https://learn.microsoft.com/en-us/sql/dma/dma-overview?view=sql-server-ver15#prerequisites
There are two workarounds we could found before we migrate the on-premise SQL server to Azure SQL:
Workaround 1:
From the SQL Server Management Studio via statement:
Connect to the on-premise SQL instance
Select New Query
Use the following statement
GRANT VIEW SERVER STATE TO "AccountName"
Workaround 2:
Update your SSMS to a new version.

SQL Server 2014 dbCreator role not created

Installed SQL server 2014 using
en_sql_server_2014_management_studio_with_service_pack_2_x64_9009295.exe
First, I am not getting the screen where you can create default instance and create sa login. So once it got installed, I go to SQL Server Express and logged in with Windows Authentication, but I see a Red downward arrow for sa login under Security\Logins. This makes me unable to create database giving error
CREATE DATABASE permission denied in database master. (Microsoft SQL Server, Error:262)
Please advise!
change the type of authentification from windows authentification to sql server authentification and give the dbowner to sa in master database

Server level Admin Rights not working?

I created a server on Microsoft Azure, and a SQL database on it. I downloaded SQL Server Management Studio, and I am able to connect to the server fine using the Server Admin Id and password I created when creating the server. But when I try and run a bulk load query to insert a picture in a picture column. It says I do not have rights. Error is:
You do not have permission to use the bulk load statement
Also in Management studio if I go to server level security folder I have logins as an option and the Server Admin ID is there, when I right click to go to properties, its missing properties as an option.
Let me know if you need more info.
Any help is appreciated,
Thank you,
Abdul

Confused by SQL Server Express when create a new database

I am an administrator of of my own machine, I have SQL Server Express installed. But when I tried to create a new database I got this error
Create Database permission denied in database 'master'
I figured I was missing 'sysadmin' role for my login. When I tried to add my self as 'sysadmin' I got another error
User does not have permission to perform this action
I am the administrator of this machine, why cannot I have permission to create a new database in this SQL Server Express instance?
Thanks
This post may be helpful as well. It points to a script that allows you to add yourself to sysadmin role (provided that you are a local Windows admin).
Update As the link to the actual script is gone, refer to the StackExchange answer on how to take ownership of a SQL Server.
I'd look at this post. http://blogs.msdn.com/b/dparys/archive/2009/09/17/create-database-permission-denied-in-database-master-my-fix.aspx
There are system level rights and then there are SQL rights, sometimes they don't align.

BUILTIN\Administrators removed - how to undo it

SQL Server 2000 Standard, Windows 2003
My coworker removed 'BUILTIN\Administrators' group from SQL Server which results in 'SQL Server Agent' not working.
All my TSQLs to synchronize databases stopped working.
I have Administrator rights on the server and my database user is in sysadmin role.
Does any one have idea how to bring 'BUILTIN\Administrators' back without restoring master database from backup?
Edit: When I try to add Administrators or MACHINENAME\Administrators using Enterprise Manager I have this group on the list to choose, but when I accept my choice I have error:
Error 15041: Windows NT user or group 'MACHINENAME\Administrators' not found. Check the name again
of course instead of MACHINENAME I see my server name
Edit2: Found it
Login as sysadmin
Run following TSQL queries
EXEC sp_grantlogin 'BUILTIN\Administrators'
and
EXEC sp_addsrvrolemember 'BUILTIN\Administrators','sysadmin'
You don't want to re-add 'BUILTIN\Administrators' as it is a SQL Server 2000 security flaw. All domain administrators will have full sysadmin rights to your SQL Server to drop databases etc.
Find the account that is running SQL Agent (Right click SQL Server agent in enterprise manager and select properties). Then add this account as a SQL Server login using windows authentication and add it to the sysadmin fixed server role.
Another method is to connect to your SQL Server database with the "NT AUTHORITY\SYSTEM" account. This approach requires you to start SQL Server Management Studio as the system account. After connect, you can create a new login or reset sa password.
Using Enterprise Manager, can't you just go into Logins and add "Administrators" as a Windows Login to the server? Then add the login to the sysadmin role?
If you can't use "Administrators", try "MACHINENAME\Administrators" (obviously substituting MACHINENAME for the actual name).
Sorry I don't have a more definitive answer, I don't really want to try it :)

Resources