How To Assign DB Owner Roles To All Databases In Server
Sep 10, 2012Is there a simple SQL/stored procedure to assign a user to be db_owner on all databases in a SQL server?
In our env., we have SQL Server 2000, 2005 and 2008 ...
Is there a simple SQL/stored procedure to assign a user to be db_owner on all databases in a SQL server?
In our env., we have SQL Server 2000, 2005 and 2008 ...
I have created a database test and created a login name devloper for the database test
Now I have created database test2 and want to connect to the database test2 with same login developer.
How can i do that .
I have changed in the security able to connect to test2 but unable to see tables and views.
What may be the cause.
If i create a new SQL login and give that login db ownership for a test db.When that user adds my SQL Server through his own SQL EM, why does he/shealso see all other objects (databases, sql security logins, DTS, ...)?Is there a way for the user to open SQL EM but only see his/her db andnothingmore?Thank you
View 4 Replies View RelatedApologies if my post does not fit into this forum. I initially tried the SQL Server Data Access forum but I now think my question is more security related.
Is it possible for a web user who has been successfully authenticated with forms authentication to be authorised to use a SQL Server 2000 role depending on a particular ASP.NET 2.0 role that they have been authorised to use? I understand that that I can assign a SQL Server 2000 role to the ASPNET or NETWORK SERVICE account but this will grant access to anonymous web users to the database role. I can ensure that I only call stored procedures which access sensitive data in web pages that are in restricted by ASP.NET roles. However, it would be nice to also restrict stored procedures via the ASP.NET 2.0 Forms Authentication roles.
If this is not possible have you got any bright ideas how I could restrict access to stored procedures who are anonymous web users.
Many thanks,
Mark
I'm developing an ASP.NET2.0 application which accesses a SQL Server 2005 Express database. I plan to use integrated security for access to the database.
I'm confused about the relationships between Windows groups, the ASP.NET web.config file <allow roles=.../> and SQL Server roles.
I would like to create a Windows group to which I can assign multiple users and grant that group access to a Web Site using windows authentication and also grant that windows group access to the database my web application uses.
I have gotten the combination of Windows Authentication to the web site and to the database to work for a specific windows user but I am having trouble determining the combination of database security entities I must create to allow access to my database by members of the windows group.
For a Windows user:
1. Create Windows user
In SQL Express
2. CREATE LOGIN FROM WINDOWS WITH DEFAULT_DATABASE =
3. CREATE USER FOR LOGIN
4. CREATE ROLE
5. EXEC sp_addrolemember <role-name> <user-name>
For a Windows group, what would be the equivalent commands necessary to grant a windows group access to my database? Specifying the Windows Group name in sp_addrolemember does not appear to be sufficient even though the documentation states that a windows group name is a valid value for the member name argument.
I am in the process of locking down the SQL Server in an environment that is considered to be in production (pilot stages) and there is no staging or test environment that mirrors it. I need assistance in determining the server and database roles to assign to existing logins, most of which currently have sa and dbowner rights. Because it is not a development environment, I need to be sure that downgrading the server and/or database level permissions will not break any functionality.
I'm starting with the logins that have the SA fixed server role. These logins need to be able to install applications that require the use of a backend database, which will be stored on SQL Server. In addition, through the installation process a new login/password for the newly created database(s) is normally created. For the existing logins with the SA fixed server role, will downgrading to the securityadmin and dbcreator roles be sufficient to facilitate those needs, or are those too much/ too little? And should any user account ever be granted the SA role? If so, what questions could I ask to determine this need?
Since these install process for these applications usually prompt to install using SA or local system account to authenticate to SQL to create the new database(s), that account should have securityadmin and dbcreator roles to create the database and its tables, as well as add a new login to that database.
Please address this question, keeping in mind that the logins will only be performing the described actions, installing apps using SQL Server as the backend database and adding a login to that database (which may or may not be done during the installation process).
Thank you,
nu_dba
Hello,
I am new user of SQL Server. I have some problems with these words. I want to make my database works in my specified permissions. I will specify permissions with schemas and these schema wants an owner. I want this owner should be my user. When creating a user it needs a valid login. I am selecting my login and it occurs and error says this login has an different user. I am specifying permissions with roles. But i can't make association all of them. I hope i told my problem to you as well. If you explain these words to me and tell me how can i do my database's works with my own schemas, users and roles i'll be grateful. Thanks for advices.
Happy coding...
Hi,
I'm looking for some guidance/help regarding setting up a sa - lite account in SQL 2005. I need to give another admin rights to create/monitor maintenance plans, backup and restore databases, monitor performance/logins, but NOT be able to have any rights on several tables (and of course not being able to set user permissions).
I've tried using server and db roles but haven't been able to determine how to give someone w/o full sa rights access to maintenance plans.
If you can think of soemthing, please let m eknow.
Jenn
Can you write a stored procedure to add a user to your DB and set the roles the user belongs to?
I want to write a stored proc. to add users and set roles so it can be used in code instead of doing it manually.
After the user has been added and their roles set, can you write another stored proc. to give you what roles they belong to?
After reading Books Online, I am still confused with Database Role vs Application role.
My intention is to control the end users' authority on the database, where the end users will access through Winforms client application. With proper assignment of schema and database roles to an user, I believe this will enough to control the permisison of an user.
If this is the case, why Application role exists? When and why should I use Application Role? How is it different from Fixed Database Role?
Hi! Can anyone say which ms sql server predefined roles are similar to the following oracle predefined roles: dba, connect, resource. I already know that sysadmin in MS SQL Server is the same as DBA in Oracle but what about the rest?
Thanks a lot.
Hi all,
I am facing some trouble in my asp.net application. We have decided to add some more security at the DB. Every user gets his own login in SQL-server. (I know for connection-pooling it is better to use the exact same connectionstring, but security is the most important fact in our project).
What I want to do is add sql-server roles to new created sql-server users. I can create sql-server users from my code and I can GRANT or DENY rigths to a specific table, but I don't know how to give a user a role.
Any ideas?
Thx,
BKT
Hi,
I want a user login to have permissions to view sql server jobs that they are not the owner of without giving them system administrator permissions,
Is there any way to do this?
Hi,
I have just received my notebook from my work, and Sql Server 2005 is installed on it. There are 2 accounts, the SA (i dont know this password), and my Windows account.
When I go to security - server roles; I see that only the SA account is assigned to the sysadmin role. But my account is not assigned to any server role and when I want to create a database I get the following error: CREATE DATABASE permission denied in database 'master'. (This is at my local database)
Is there anyway I can get passed this restriction? (without hacking my own pc?)
With kind regards
What roles or permissions does a user need to create stored procedures?
Jshurak - The International Businessman of Mystery
Hi,
I have some stored procedures that I use in my .Net application. These stored procs are created by the role of [dbo]. Now I want to deploy the application along with the database. On the live database I have created a new user, but I cannot give this user the role of dbowner. I have only given it the roles of public, dbreader and dbwriter.
Now the problem is that I am not able to execute my stored procedures. So what should be the solution for this problem. Should I modify my stored procs and create them with the role of public or should I give the user the role of a dbowner.
I also want to know, what is the best set of roles I should give a db User and yet not compromise the security of the database.
If any one knows the solution to my problem, please reply or provide some links that would help. Urgent
Regards
Vineed
hi friends..... i want to assign value to the nvarchar variable on sql server2005 procedure ...tell me how ? thanks and regards.samuel chandradoss . J
View 4 Replies View RelatedI have MS SQL Server 2000 DB.
I have created a User and created some tables for the same.
I created a Role named A and granted Select Permissions for few tables to that roles.
When I created another Role named B and added this role (A) to B, the permissions are not being xferred to B. Bcos of which, if i assign an User to Role B, he is not able to select the tables for which permissions have been given thru role A.
Note : If i give assign directly the user to Role A, it is working. But i want to assign User to role A only thru B.
Hi all,
is it possible to assign for each CPU a different process within one SQL Server 2005?
I got 2 servers (each 4 CPUs; 64 bit system) which should be able to failover, but on the other hand there are reporting/analysing applications and totally different sharepoint/other applications that should be hosted seperately, each on one physical server.
Thanks a lot for any help!
After "copying" a SQL Srv DB from one server to the next, we have found that the permissions within the developer-created database roles did not transfer. How can we insert these permissions without doing it manually? Or can we create some type of DTS package that will bring the roles' permissions for us? Or how do you move a SQL database from one server to the next and get everything within it to come along??
View 3 Replies View RelatedShort of system administrator, does anyone know what server role a login must be assigned to in order to execute DTS package in Query Analyzer?
View 9 Replies View RelatedI am currently working on a SSIS configuration database. However, I am having trouble writing a script to get the the users that have each server role permissions. I'm pretty sure that I need to use sp_helpsrvrole, but am not sure where to go from here. If anybody has any ideas or has seen a script on the internet to get this then that would be a tremendous help.
Thanks in advance,
Kyle
Hello All,
How to assign the DataSource to Server Report which is stored in the remote machine. Now i need to work on it. If you have any solution please pass on it to me.
Thanks,
SR.
Hi!
I have developed a database in MS SQL Server 2005 Express, to which I would require only bulkadmin server role from an external java application, because I only need to update rows, insert values or use select queries in the database.
The problem is that, using either the Microsoft JDBC Driver 1.1 or the Java JDBC ODBC Driver and the Windows XP Data Base (ODBC) configurations, I need a user with sysadmin server role inside Sql Server, otherwise JDBC won't connect to the database using the selected user. Even if I leave the sql login with setupadmin or any server role lower than sysadmin, the connection is refused.
Is there no way to connect using JDBC to MS Sql Server 2005 other than granting the connected user sysadmin rights? My code looks as follows:
Code Snippet
String driver = "com.microsoft.sqlserver.jdbc.SQLServerDriver";
String url = "jdbc:sqlserver://FIREBLADE\SQLEXPRESS";
String user = "username";
String password = "password$$";
Connection conn;
Class.forName(driver);
conn = DriverManager.getConnection(url,user,password);
if (conn != null)
System.out.println("SQL Server Connection established ...");
I have heard that Java JDBC connections to Microsoft require high-level access.
Any informed answer is more than welcome. Thanks for reading my post!
I need to find out how to add roles to my SQL that is on a hosted server.I have created 2 roles, but after publishing and uploading my site, when I try and create a user, I get the error:"Exception Details: System.Configuration.Provider.ProviderException: The role 'userAtype' was not found."There are two other roles that the same happens with.Running it locally all was fine, I just didn't seem to get this info where it needs to be when I uploaded it.I'm new to messing about with SQL, so sorry if this is really elementary.I have VS2005 Standard, and the SQL Server Management Studio Express.The hosting provider I have does not allow remote connections to the DB on shared hosting, so I need to (?) generate a script to populate the DB? and run it in their browser-based Querry Window?How would I do this?Thanks.
View 4 Replies View RelatedI have seen the red down arrow for disabled, but I don't know what this means?
(I can't post an image is there a way to upload an image?)
It appears to be a little red tornado or down pin?
I wanted to set up a trigger to alter me or log to a table when someone is added to a server role. The event for the trigger I wanted to use is ADD_SERVER_ROLE_MEMBER. When trying to create the trigger, I get the following information:
"ADD_SERVER_ROLE_MEMBER" does not support synchronous trigger registration.
Hi
I've been stuck with this for a while - but now I really need to find an answer - maybe you kind-hearted guys can help.
At the moment, our security model is done via NT Trusted Connection; each NT user can belong to more than one NT groups, which in turn are members of roles within a SQL7 database.
This means that SQL Server 7 does NOT have individual NT user's login information.
At the same time, we have a table called "Personnel" which stores each of this NT user's specific ID value(let's called this field "RepID"). On entering the VB front-end, an API call which gets the current NT login can validate against this table "Personnel" and gets this ID value (as this value is stored in various other tables within the database).
Now it comes to a point that I need to filter a recordset out from another table whose record source depends on whether the RepID field value belongs to a certain role within the database. So far these two levels of security is not linked in anyway - I have yet to be able to find a way to do the filter (except to hard-code the whether the user is a role in a new field in the table "Personnel").
Is there a better way to do it? One that only involves stored procedures?
Problem is IS_MEMBER only returns information of current user - but I need to find out other RepIDs' roles too!
Any suggestions is welcomed.
Simon
P.S. Apologies for end up reading cross-post; as I am not sure whether it's purely SQL Server or a bit of NT Server involved too.
Hi Nerds
There are 2 production servers (SQL Server 6.5). One is publisher and the other one is subscriber. Data is replicated from publisher to subscriber which is a transaction based replication. Each day at 8:00PM data comes into publisher and the updations,replication,backup,reporting are carried out till 11:00AM next day. The subscriber server is used as a reporting server and the publishing server is used as the data warehouse server.
I want to cleanup a table on the publisher. Since it is replicated on the subscriber, can I do delete operation on the subscriber, make the subscriber server a publisher and the publisher server a subscriber, do replication from publisher(new) to subscriber(new) and again change publisher to subscriber and subscriber to publisher without affecting the production line of the databases. I have to do this between 11:00AM to 8:00PM.
Pranav.
I have a Contact table where I enter a "Parent" (Mother or Father) with IsSubscriber = 1. I also enter all of their children in this same table, with IsDependent = 1.
I then have a Relationship table that relates each child to the appropriate parent record in the Contact table.
I need to assign a sequence number to each child ONLY if they were a multiple birth (twins, triplets, etc.; all have the same DOB). I've been successful at writing a query using ROW_NUMBER(), but it includes the single births (no other child of the same parent has the same DOB).
Stripped down version of Tables and Data and my failed attempt to write a query to do what I want:
IF OBJECT_ID('TempDB..#Contact','U') IS NOT NULL
DROP TABLE #Contact
CREATE TABLE #Contact (
ContactId INT IDENTITY(1,1) PRIMARY KEY CLUSTERED
, IsSubscriber BIT
[Code] ....
This is as close as I can seem to get.
I want to assign consecutive numbers to a block of data where block of data is based on days consecutive to each other i.e., one day apart.
Date format is: YYYY-MM-DD
Data:
TestId TestDate
----------- -----------------------
1 2011-07-21 00:00:00.000
1 2011-07-22 00:00:00.000
1 2011-07-27 00:00:00.000
1 2011-07-29 00:00:00.000
1 2011-07-30 00:00:00.000
1 2011-07-31 00:00:00.000
[Code] ....
My Attempt:
WITH cte AS
(
SELECTTestId,
TestDate,
ROW_NUMBER() OVER
(
PARTITION BYTestId
[Code] .....
Expected Output:
TestId TestDate OrderId
----------- ----------------------- --------------------
1 2011-07-21 00:00:00.000 1
1 2011-07-22 00:00:00.000 1
1 2011-07-27 00:00:00.000 2
1 2011-07-29 00:00:00.000 3
1 2011-07-30 00:00:00.000 3
[Code] ....
The OrderId is the column I am trying to obtain using my following cte code, but I can't work around it.
Hi,I am trying to setup a subscription but I keep running into problems.I setup the subscription fine, I see that it creates a job in SQLServer. It shows a specific domain account as the owner and I can'tfigure out why. The problem is that this account is in a differentdomain and it's having problems authenticating when it runs. I did usethis account for the services and whatnot when I originally set it up,but I've changed the account that SQL Server and SQL Server Agent rununder, but it still uses this account as the owner. The only otherthing I can think of is that the database owner ofSystemCenterReporting is still this account. Is this why it's listingthis account as the owner of the job? Where else could it be?Thanks,Bill
View 2 Replies View RelatedHow would we know to assign the time stamps for automated backups in job schedules....
View 1 Replies View Related