Way To Determine Which Logins Have Write Permissions To Database On Sever
Nov 15, 2007
Hi there,
Does anyone know a way (a query perhaps?) to determine which logins have write permissions to a specific database on SQL Server 2005? Ive thought about joining sys.syslogins & sys.sysusers but looking at the columns, not sure which one would render me that info.
Query to show logins that don't have any permissions within the SQL instance? I'm tasked with doing some cleanup and have found some cases where the database was deleted or moved to another server but the logins that used it were not deleted. I'd like to identify them to research.
For instance a query to show logins that have no permissions in any of the existing databases would be handy. I'm thinking it would be complicated by the need to loop through all of the existing databases and then outer join it to the list of instance level logins. Going to try to write something like that but was hoping that a script already exists.
Our company has 2 Database Roles (DBE and DBA). The DBE creates database schema, performs SQL Server Administration, and manages server security. The DBA writes data access, ETL, and manages database security. In 2005, we're struggling with how to allow the DBA to see all of the logins on the server in order to add them as users of their database. What permissions does the DBA need to select from any of the logins on the server to add them to their database?
Is it possible to connect SQL Sever 2005 Express from SQL Sever 2000 Enterprise Manager? Tried to connect but got the error message "must use SQL Server management tools to connect this sever"
Hello All Just wondered if someone could help me with a bit of T-SQL, i have a application in ASP.NET/VB that allows the user to update a message board by clicking a button "update" this in turn triggers my Stored Procedure for inserting this data into a table, which works great. It inserts the data into its respective fields and also takes The Title, Line 1, Line 2 and so on and creates a XML file (Using FOR XML) which is stored in the same Table under a column call XML_Data. Which again works great. My problem now is how do i output this XML_Data to an actual XML file that is on my local machine, i.e. It be created in say C:Inetpubwwwrootxmlfiles("xml file name inserted here from another column that holds xml file name").xml Any help on this would be greatfully apreciated Thanks In Advance Neil
We are working on an application but with other users who have been using the SA password. The application is running on MSSQL 6.5 and sp4. We have been generally assigning logins/userids to new users although some people are using the SA id. The SA id password has been changed so that will stop users (really developers) from using it.
Most users are assigned to a group which has select, insert, update, delete permission. Some users will be moved to a group which as only select privilege
I would like to query the system tables and see exactly what permissions are assigned to each user.
I can look at Enterprise manager and cut and paste this information I think.This is cumbersome
1) Does anyone have a query I can run to get the userid/login and the permissions for each userid?
2) How can I make a user a dbo and give him/her the same permissions as a dbo on tablesalready creaetd?
In my local instance of SQL Server at work (which I use for testing), somehow all of the logins except 2 were dropped. The administrators group no longer exists as a login (nor do any other windows users or groups)-the only 2 remaining are sa (which is disabled) and a SQL login I had created earlier which has no permissions except read permission on master. I can login as this SQL user, but I do not have permissions to create logins or enable the sa account. Do I have any options other than uninstalling and reinstalling my local instance?
I am at a company with 18 employees and I have 11-12 databases in SQL server. I can't seem to give logins and permissions to groups. Is there a simpler way, or do I have to add every single employee to each database and give permissions?
I need to move several databases to a new server while retaining the same logins/permissions. Books Online indicates that DTS can move the SQL Server logins, but it sets the passwords to NULL in the process. Is there any way to move the logins and keep all passwords/permissions intact?
I know that there is Microsoft KB to migrate SQL Logins but it doesnt take care of Login Server level permissions or User level permissions.Idera used to have a Free tool SQLPermisions.exe but it works only on Windows XP/Vista not on Windows 7. Any third party tool (free or paid) which can migrate SQL Logins and User permissions ?
Hi,I work as an IT Administrator and part of my job role is to useEnterprise Manager and Query Analyzer to backup the logins andpermissions for each database on our SQL Servers. This information isused as a backup in the event of a server failing so we then havesomething to fall back on if we need to add the same logins/permissionsagain.This takes ages to do, as I have to manually enter all the informationinto a spreadsheet.Steps:- In Enterprise Manager I connect to a server then 'Security' tab, then'Logins'. I then enter all items into a spreadsheet.- In Query Analyzer I connect to a server then do 'sp_helpuser' to listall the permissions for each database. I then enter all informationinto a spreadsheet.I was wondering if there is such a program available on the market thatwould do this for me? I know that MS Baseline Security can show flatfile share permissions to a certain degree and was wondering if therewas a similar program out there to help me do my job easier, or ifthere is a simple way of doing this in the future...Any feedback would be greatly appreciated.Regards,Jenny
Hello all,I am looking for the script, which I believe exists already.I need tobe able to populate the script for security of one database andapply it to another database, even if it is located on another server:1. All logins which not exist have to be created and which existsignored including the NT accounts2. Users same as the old database + the existing ones stay in database3. Passwords for the new logins.4. All permissions/grants on all objects for the users that exists(usually it's the case) and ignore those that don't.I have script which does some of it, but it's not perfect, so everytime there are some errors.Please let me know, if you need me to email script that I have. It'spretty long so I cannot just post it in here.Thank you in advance.
A question on the permissions hierarchy: Since logins, database users, and database roles are both principals and securables - what does it mean to GRANT permission on a login/user/role to another principal? Does it mean that for a login - you can GRANT permission to EXECUTE AS that login or modify it, for example?
I am trying to write a sql script that will basically test logins for Windows NT Similar to when you bring up SQL Studio, and do run as windows NT I want to ensure my rights are not removed from SQL Servers and if so send my nice DBA an email.
How to do the connect as ? and check my permission is still set to access database with db_datawriter, db_datareader etc
I am migrating my database from Access to SQL Server , The application is in Access too, I have migrated the application to talk to SQL, I am able to query from database whereas not write to it, any operation on writing to database gives me ODBC insert on a linked table <tablename> failure.
Hi all Im currently going through a ASP.NET book but i just cant get to use the SQL server express databases that come with the code examples in the book. All i can do is read the data but thats about it. I keep on getting the error below whenever i try to alter the data in the databases. I have tried enabling write permissions for the NETWORK SERVICE account for the App_Data folder but i still get the same issue. Im running the web apps with these databases in IIS v5.1 and using Visual web developer express. Im still an ASP.NET novice so please keep the solution to my problem as simple as humanly possible.Thanks in advance all. Matt Server Error in '/Chapter06' Application.--------------------------------------------------------------------------------Failed to update database "C:INETPUBWWWROOTCHAPTER06APP_DATAWROXUNITED.MDF" because the database is read-only. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.Data.SqlClient.SqlException: Failed to update database "C:INETPUBWWWROOTCHAPTER06APP_DATAWROXUNITED.MDF" because the database is read-only.Source Error: An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below. Stack Trace: [SqlException (0x80131904): Failed to update database "C:INETPUBWWWROOTCHAPTER06APP_DATAWROXUNITED.MDF" because the database is read-only.] System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection) +857338 System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) +734950 System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) +188 System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) +1838 System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString) +149 System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async) +886 System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result) +132 System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(DbAsyncResult result, String methodName, Boolean sendToPipe) +415 System.Data.SqlClient.SqlCommand.ExecuteNonQuery() +135 System.Web.UI.WebControls.SqlDataSourceView.ExecuteDbCommand(DbCommand command, DataSourceOperation operation) +401 System.Web.UI.WebControls.SqlDataSourceView.ExecuteUpdate(IDictionary keys, IDictionary values, IDictionary oldValues) +721 System.Web.UI.DataSourceView.Update(IDictionary keys, IDictionary values, IDictionary oldValues, DataSourceViewOperationCallback callback) +78 System.Web.UI.WebControls.DetailsView.HandleUpdate(String commandArg, Boolean causesValidation) +1152 System.Web.UI.WebControls.DetailsView.HandleEvent(EventArgs e, Boolean causesValidation, String validationGroup) +461 System.Web.UI.WebControls.DetailsView.OnBubbleEvent(Object source, EventArgs e) +95 System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +35 System.Web.UI.WebControls.DetailsViewRow.OnBubbleEvent(Object source, EventArgs e) +109 System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +35 System.Web.UI.WebControls.LinkButton.OnCommand(CommandEventArgs e) +115 System.Web.UI.WebControls.LinkButton.RaisePostBackEvent(String eventArgument) +163 System.Web.UI.WebControls.LinkButton.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +7 System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +11 System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +174 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +5102 --------------------------------------------------------------------------------Version Information: Microsoft .NET Framework Version:2.0.50727.42; ASP.NET Version:2.0.50727.42
I see that a recent related message was posted about built-in accounts.
Anyway, a vendor set up system using SQL 2014. The SQL Server Agent service was running under the 'Local System Account'.
Agent jobs were failing because they couldn't write to a shared folder on the same server. I decided to change the account to a regular privileged domain user. Here is the error message:
Executed as user MYDOMAINSQL2014Agent Cannot open backup device 'EackupMyBackup' Operating system error 5(Access is denied). [SQLSTATE 42000] [Error 3201] BACKUP DATABASE is terminating abnormally [SQLSTATE 42000] [Error 3013]. The step failed
I granted Full Control to that domain user and it still failed. I added 'Everyone' and gave it Full Control and it succeeded.
I understand that the account under which the Agent is running should have Write permissions on the share. However, I must have missed something. The only way I can get this to work is to grant Write or Full Control to Everyone. I absolutely do not want to do that.
ok, first, I know... I forgot to run a backup of the master database, and I forgot to run a script to caputure logins. Not that that is out of the way... I need to recreate the logins under the Securities tab below the databases. All the company databases have the user names and passwords assigned to them, but they are not able to login, because they are not able to authenticate to the SQL server first.
Is there a script that someone has that will copy the company database security info for the users and recreate them in the SQL security tab?
I know that I can rebuild them manually, but I need to delete them first in the application software, then delete them from the databases, and then recreate them in the application software... and as simple as that sounds... it is a slow moving process.
hi I have two questions: 1. I want a code to save data typed in a textbox during runtime using SQL server database. The database has a table with several colums where i have to reference the necessary column. 2. Can i use a Gridview to enter data during runtime and save the same data to the database? that is, INSERTING data to the database.
My exploit environment: VS.net 2003, SQL Server 2000 SP4, SQL Server CE 2.0 SP4
I write next codes: Private cn As New SqlCeConnection("data source=my documentsSQLCECF.sdf")
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Try If Not System.IO.File.Exists("my documentsSQLCECF.sdf") Then Dim en As New SqlCeEngine("data source=my documentsSQLCECF.sdf") en.CreateDatabase() 'create a blank database to subscribe Synch() End If Catch err As SqlCeException ShowErrors(err) Catch err As Exception MsgBox("There was an error:" & err.ToString()) End Try End Sub
Sub Synch() Try Dim rep As SqlCeReplication = New SqlCeReplication With rep .Publisher = "192.168.0.222" .PublisherDatabase = "CFLab" .PublisherLogin = "sa" .PublisherPassword = "sa" .Publication = "CFLab" .Subscriber = "SQLCENETCF" .SubscriberConnectionString = "Provider=Microsoft.SQLServer.OLEDB.CE.2.0;Data Source=My DocumentsSQLCECF.sdf" .InternetUrl = "http://192.168.0.222/SQLCE/sscesa20.dll" ' Create the Local SSCE Database subscription rep.AddSubscription(AddOption.CreateDatabase) rep.Synchronize() 'subscribe End With
Catch err As SqlCeException ShowErrors(err) Finally
End Try End Sub
Public Sub ShowErrors(ByRef e As SqlCeException)
Dim errorCollection As SqlCeErrorCollection = e.Errors Dim bld As System.Text.StringBuilder = New System.Text.StringBuilder Dim inner As Exception = e.InnerException
If Not inner Is Nothing Then MessageBox.Show(("Inner Exception:" & inner.ToString())) End If
For Each err As SqlCeError In errorCollection bld.Append("/n Error Code: " + err.HResult.ToString("X", System.Globalization.CultureInfo.CurrentCulture)) bld.Append("/n Message : " + err.Message) bld.Append("/n Minor Err.: " + err.NativeError.ToString()) bld.Append("/n Source : " + err.Source)
For Each numPar As Int32 In err.NumericErrorParameters
If 0 <> numPar Then bld.Append("/n Num. Par. : " + numPar.ToString()) End If
Next
For Each errPar As String In err.ErrorParameters
If String.Empty <> errPar Then bld.Append("/n Err. Par. : " + errPar) End If
Private Sub btnShow_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnShow.Click connect()
Dim query As String = "select * from FlightData" Dim dap As New SqlCeDataAdapter(query, cn) Dim dataset1 As New DataSet dap.Fill(dataset1, "FlightData")
Disconnect() End Sub Sub connect() Synch() Try cn.Open() Catch err As SqlCeException ShowErrors(err) End Try End Sub Sub Disconnect() Try cn.Close() Catch err As SqlCeException ShowErrors(err) End Try End Sub
Private Sub dgdResults_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles dgdResults.Click
End Sub End Class
I want to synchronize the data from a SQLCE SERVER 2000 When i run the code above, the errors show: Error Code:80040E17 MessageQL Server CE encountered problems in creating the SQL Sever CE database.
Error Code:80040E17 A data source with the specified name already exists.
I do not know what's going wrong..=( Who can help me??!!! HELP~~~~~~~~~ thanks..
I have a sql sever 2005 express edition database but when i run my backup command from the command prompt, i get this error message . The .Net SqlClient Data Provider has received a severity 16, state 11 error number 911 on line 1 of procedure on server KSS15SQLEXPRESS: Could not locate entry in sysdatabases for database 'DATABASE1'. No entry found with that name. Make sure that the name is entered correctly. The .Net SqlClient Data Provider has received a severity 16, state 1 error number 3013 on line 1 of procedure on server KSS15SQLEXPRESS: BACKUP DATABASE is terminating abnormally. DATABASE one is the name of the database i want to backup. Now it looks there so many databases some of which i have no idea where they are. It looks like there some system stored procedures i have to run first before my database file can be located by my commands. It would be wonderfull if some one pointed me to an article that covers this initial part thoroughly.
I would like some help in uploading a database from my harddrive to a server using sql server management studio express.
If I try to attach it to the server, this program only looks at the files on this server and not on my harddrive. So how can I copy a sql database to my folder on the server.
I am sure it must be a simple problem, but I've been bizzy with it for about a day now. So, please advice.
What is the most reliable way to determine the last LSN of a database? I've looked in sys.database_files to no avail. I've also looked in msdb.dbo.backupset which is accurate but only based on backups already performed not the current state of the database.
I am trying to establish the date a database was last used.
At first i checked out sp_helpfile and sysfiles to see if there was a date last modified, i also tried using xp_cmdshell to check the date on the actual .mdf or .ldf on the o/s but if the file has not grown the date will be the create date.
I need to establish the date a database was last used, either the last time someone logged into it or the last time any sort of command was run against the database, i cannot use sysprocesses as there are no connections to the database, so i need to determine the last time there actually were any processes run against this database.
And i need to use tsql, checking audit logs etc is not viable, can anyone help ?
Does anybody know of a way to determine the last date/time a table has been accessed (query/update)? I've done enough research to know that this isn't easy. However, perhaps somebody has figured out a way through some of the stats that SQL Server keeps to determine the last access of a table. I have recently been put on a team that had no DBA and has a number of databases out there. They would like to determine which databases are inactive and get rid of them. I am a developer and haven't had much SQL Server Administration experience. Any info will help greatly! Thanks!