User && Roles Backup
Jun 27, 2007Hi,
Can you please tell how to backup the users and their access permission from a database before restoring it.
Balavenkatesh.
Hi,
Can you please tell how to backup the users and their access permission from a database before restoring it.
Balavenkatesh.
I am wondering is there anyway I can backup only Login name, Users and Roles, Not database, stored procedure, Views and Trigger. If some one can suggest there is a way that will be really great
Thanks in advance.
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?
I would like to know if there is a way to find out who changed a users roles/access WITHOUT using the audit function. For example, if a user account was created and given SA access then changed to read only, how can I find out who made that change? I tried searching for an answer, but kept getting no results. I'm thinking this may tie into the sys.sysusers view?
View 3 Replies View RelatedHi all,
I've created a training database, and added a user to it. Now I am trying to figure out what database roles I need to give him. Can I get away with public only, or he will need the db_owner role? Thanks.
I have a sp that my users need access to run and currently their roles are set up as users with db_datareader, db_datawriter. I'm having trouble getting them access just adding permissions to the tables being used here. What is the best method to allow them access to only the neccessary roles to run this sp?
ALTER PROCEDURE dbo.spi_CallList
(@strAgent nchar(4), @MEA int)
AS
DECLARE @Msg varchar(255)
declare @SQL varchar(4000)
IF EXISTS (SELECT TABLE_NAME FROM INFORMATION_SCHEMA.VIEWS WHERE TABLE_NAME = 'qs_CallList1')
DROP VIEW qs_CallList1
IF EXISTS (SELECT TABLE_NAME FROM INFORMATION_SCHEMA.VIEWS WHERE TABLE_NAME = 'qs_CallList2')
DROP VIEW qs_CallList2
IF EXISTS (SELECT TABLE_NAME FROM INFORMATION_SCHEMA.VIEWS WHERE TABLE_NAME = 'qs_CallList3')
DROP VIEW qs_CallList3
SET @SQL = 'Create view qs_CallList1 as
SELECT top 100 percent tsd_Claim.clinsnum AS [Ins#], Sum(tsd_Claim.cloutstandingamt) AS OutstndByIns
FROM (tsd_Claim LEFT JOIN [qs_SQLClaimStatusLastEntryCL] ON (tsd_Claim.clnum = [qs_SQLClaimStatusLastEntryCL].Claim)
AND (tsd_Claim.clpid = [qs_SQLClaimStatusLastEntryCL].Pat))
LEFT JOIN tsd_Patient ON tsd_Claim.clpid = tsd_Patient.PID
WHERE (((tsd_Patient.PAGENT)=''' + ltrim(rtrim(@strAgent)) + ''')
AND (([qs_SQLClaimStatusLastEntryCL].Pat) Is Null)
AND ((tsd_Claim.clfromdos)<GetDate()- ' + cast(@mea as varchar(12)) + '))
GROUP BY tsd_Claim.clinsnum
ORDER BY Sum(tsd_Claim.cloutstandingamt) DESC'
EXECUTE(@sql)
SET @SQL = 'Create view qs_CallList2 as
SELECT TOP 100 percent tsd_Claim.clinsnum AS [Ins#],
tsd_Claim.clpid AS [Account#],
Sum(tsd_Claim.cloutstandingamt) AS OutstndByAcct
FROM (tsd_Claim
LEFT JOIN [qs_SQLClaimStatusLastEntryCL] ON (tsd_Claim.clnum = [qs_SQLClaimStatusLastEntryCL].Claim)
AND (tsd_Claim.clpid = [qs_SQLClaimStatusLastEntryCL].Pat))
LEFT JOIN tsd_Patient ON tsd_Claim.clpid = tsd_Patient.PID
WHERE (((tsd_Patient.PAGENT)=''' + ltrim(rtrim(@strAgent)) + ''')
AND (([qs_SQLClaimStatusLastEntryCL].Pat) Is Null)
AND ((tsd_Claim.clfromdos)<GETDATE()-' + cast(@mea as varchar(12)) + '))
GROUP BY tsd_Claim.clinsnum, tsd_Claim.clpid
ORDER BY Sum(tsd_Claim.cloutstandingamt) DESC'
EXECUTE(@SQL)
SET @SQL = 'UPDATE tsd_Patient SET tsd_Patient.PPriority = Null WHERE (((tsd_Patient.PAGENT)=''' + ltrim(rtrim(@strAgent)) + '''))'
EXECUTE(@SQL)
set @SQL = 'truncate table priority'
EXECUTE(@SQL)
set @SQL = 'INSERT INTO Priority ( Agent, [Account#] )
SELECT tsd_Patient.PAGENT, tsd_Claim.clpid AS [Account#]
FROM ((tsd_Claim LEFT JOIN tsd_Patient ON tsd_Claim.clpid = tsd_Patient.PID)
INNER JOIN [qs_CallList1] ON tsd_Claim.clinsnum = [qs_CallList1].[Ins#])
INNER JOIN [qs_CallList2] ON (tsd_Claim.clpid = [qs_CallList2].[Account#])
AND (tsd_Claim.clinsnum = [qs_CallList2].[Ins#])
WHERE (((tsd_Claim.cloutstandingamt)>0.99))
GROUP BY tsd_Patient.PAGENT, tsd_Claim.clpid, [qs_CallList1].[Ins#],
[qs_CallList1].OutstndByIns, [qs_CallList2].OutstndByAcct
ORDER BY tsd_Patient.PAGENT, [qs_CallList1].OutstndByIns DESC , [qs_CallList2].OutstndByAcct DESC'
EXECUTE(@SQL)
set @SQL = 'Create view qs_CallList3 as
SELECT TOP 100 Percent tsd_Patient.PAGENT, tsd_Claim.clpid AS [Account#], tsd_Claim.clticketnum AS Claim,
tsd_Claim.clfromdos AS DOS, tsd_Claim.cloutstandingamt AS Outstnd, tsd_Claim.clins AS Insurance,
tsd_Claim.clinsph AS Phone, tsd_Patient.PGLNAME, tsd_Patient.PFNAME AS [First], tsd_Patient.PLNAME AS [Last],
tsd_Patient.PSSN, tsd_Patient.PDOB, [qs_CallList1].OutstndByIns, [qs_CallList2].OutstndByAcct,
[qs_SQLClaimStatusLastEntryCL].Pat
FROM (((tsd_Claim LEFT JOIN tsd_Patient ON tsd_Claim.clpid = tsd_Patient.PID)
INNER JOIN [qs_CallList1] ON tsd_Claim.clinsnum = [qs_CallList1].[Ins#])
INNER JOIN [qs_CallList2] ON (tsd_Claim.clpid = [qs_CallList2].[Account#]) AND (tsd_Claim.clinsnum = [qs_CallList2].[Ins#]))
LEFT JOIN [qs_SQLClaimStatusLastEntryCL] ON (tsd_Claim.clnum = [qs_SQLClaimStatusLastEntryCL].Claim)
AND (tsd_Claim.clpid = [qs_SQLClaimStatusLastEntryCL].Pat)
WHERE (((tsd_Claim.clfromdos)<GetDate()-' + cast(@mea as varchar(12)) + ')
AND ((tsd_Claim.cloutstandingamt)>0.99)
AND (([qs_SQLClaimStatusLastEntryCL].Pat) Is Null
Or ([qs_SQLClaimStatusLastEntryCL].Pat)=''0''))
ORDER BY tsd_Patient.PAGENT, [qs_CallList1].OutstndByIns DESC ,
[qs_CallList2].OutstndByAcct DESC ,
tsd_Claim.clinsnum DESC,
tsd_Claim.clpid,
tsd_Claim.cloutstandingamt DESC'
EXECUTE(@SQL)
set @SQL = 'update tsd_patient set tsd_patient.ppriority = priority.priority from priority where tsd_patient.pid= priority.[account#]'
EXECUTE(@SQL)
I saw an article I believe on this site, now I can't find on HOW TO MOVE USERS AND ROLES FROM ONE SERVER TO ANOTHER. DOES ANYONE KNOWS WHAT IS THE BEST WAY TO DO that?
View 3 Replies View RelatedHi, SQL experts.
I'm
new in the SQL Server Express Configuring Stuff and I've a problem or
more exactly I don't have any idea about configuring an secure and
hacking save user for a SQL Express DB.
What server roles/server
permissions/endpoint permissions/database permissions are neccessary to
have an rw access SQLE user? Any articles available? Any suggestions?
Scenario is a Personal Webpage for my Family & Friends located in my house
- ASP.Net Starter Website: Personal Website
- 2 MDF DB's: ASPNETDB.MDF & PERSONAL.MDF (included with the Starter Website)
- Development on DEV PC; Deploy on SERVER PC
HW:
- SERVER PC with Win2k (fully patched)
- DEV PC with Win XP Sp2 (fully patched)
- LAN 100Mbit w NAT FW
- WAN Cable Modem 128/1500
SW:
- APACHE 2.0.55 with latest aspnet_mod
- ASP.NET 2.0
- SQL Server Express
- SQL Manager 2005 Lite
- MS Web Developer Express
What I've done so far:
- APACHE: configured & working
- aspnet_mode: configured & working
- SQLExpress: configured & working
- SQLBrowser: configured & working
- TCP/IP Protocol for SQLE: configured & working
- Mixed authentication for SQLE: configured & working
- ASPNETDB.MDF: attached, configured & working
- PERSONAL.MDF: attached, configured & working
- SQL Manager 2005 Lite: configured & working
- SQLE users: created one for ASPNETDB and one for PERSONAL
(with SQL Manager Lite; Sorry MS!!! your SQL Server Mgmt Studio Express sucks!)
- WEBSITE: changed connection string from local to remote
(local doesn't work, because the LocalSystem User on Win2K, which is
used by the SQLServer, has no User Profile. Also you cannot change the
Service User, so it won't work with the local connection string, but
with an attached and remote accessible DB it works just fine)
- WEBSITE: runs locally and remotely on DEV PC with remote DB's and custom users.
But
I'm concern about the two users I've created, to access the two DB's.
I've no idea, what rights/roles aso they need to use the DB for remote
(for development) and local (for production) access and to be secure?
Thanks for any help, ideas and suggestions.
Alex
I have several roles on a database and want to find out to which roles
a certain user belongs to. What's the SP to get this information?
Background:
I have a table where I store some application specific permissions for
the different roles. I use the same grant/deny/revoke logic like in
SQL server. These are permissions that cannot be mapped to a SP or a
table.
In a query I want to get all the permission records for the role that
a user belongs to.
Thomas Schoch
What I'm looking for is a list of roles a particular user is a memberof.the closest I've found so far is sp_helprolemember without anyarguements. but this gives me all the roles and all the users. I wantthis same list filtered on a specific user.something like sp_??? 'user'
View 2 Replies View RelatedWe maintain a few applications that query multiple databases on our server. We also have groups of users that multitask using different applications.
I've always created a Role in each database for every application.
Wondering if someone is in two Roles at once will we have security conflicts?
Hi,
I would like to create the folders Sales, Orders and Credit under the Home folder.
The Sales folder contains a set of reports that should be accessible to a group of users, similarly Orders folder contains a set of reports that should be accessible to a group of users.
I do not have facility to create user groups in SQL Reporting Service. I create a user group in my machine (from Control Panel) but Reporting service is not able to view this group.
I am able to add individual users to a folder, but I would like to check if I can create a group and then add users to this group.
Any help in how to resolve this issue.
Cheers,
I am not sure why this is not working it clearly states in the MSDN that it should "
'role'
Is the name of the SQL Server role being checked. role is sysname and can include the database fixed roles or user-defined roles but not server roles.
"
I have seen many questions revolving around this issue on this site and on the net about this but know one can answer it
I have created a new user defined database role called testrole with any owner
then created a new sql login and user (Sql Authentication)
add the user to the database role testrole
check IS_MEMBER and it returns 0
try this with a fixed database role and I get the desired result of 1
this is simple and should not be such a problem for every one
unless I am doing something wrong
Please help
Thanks
I have created an web reference called ReportingSerivce 2005. i am trying to set an user to have browser rights without going into Report Manager.
But I can't get the SetPolicies function to work correctly. Any ideas?
Code written in VB.
Dim rs As ReportingService2005
rs.Url = "https://wa.hrconnect.treas.gov/reportserver/reportservice2005.asmx"
Dim Item As String = "/"
Dim Policies() As Policy
Policies(0) = New Policy
Policies(0).GroupUserName = TxtUser.ToString
Policies(0).Roles = New Role(0) {}
Policies(0).Roles(0) = New Role
Policies(0).Roles(0).Name = "Browser"
Policies(0).Roles(0).Description = "May view folders and reports."
rs.SetPolicies(Item, Policies)
As part of our security project, I've done the following when logged in as 'sa':
Created database roles 'dbrole1' within dbAccount
Created login and user 'user1' and added user to be a member of 'dbrole1'
Granted execute permissions on sp1 and sp2 to 'dbrole1'
However, I didn't see the above permissions listed in SQL Server Management Studio - Database - Security - Roles - Database Roles - 'dbrole1' properties - securables
Any ideas? Thanks!
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...
Apologies 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.
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.
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
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
I 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.
We have a payroll database that needs to be backed up just before completing the payroll for that period. I need to create a batch file that a normal user can run that will tell the database to back up and then tell the user when it is done so they can continue working. Is there an easy way to do this without giving the users special permissions? I don't want to give them backup op status. Any help would be appreciated.
View 4 Replies View RelatedI have a scheduled job backup/maintenance plan. In it I told it to delete all logs older than one day.
Does that mean it delete logs for every job or just that job? I ask because for some reason all the logs on every job is being truncated down to one day.
Thanks
I have databases
TESTDB db owner testuer
Login testuser
When right clicking on logins i see dbo
When open this i see testuser
So i clicked on Role Members db_backupoperator was denied
had to do it on the owner schema and select db_backupoperator
Not sure why the role member is permitted.
Backup job for User databases is failing.
I found below errors
View job history
Step 0:
The job failed. The job was invoked by schedule 4(DBMP_User). The last step to run was step 1(subplan)
Step 1:
Message: Executed as user ServernameSystem. The package execution failed. The step failed
Appln-event log:
SQL server scheduled job DBMP_User failed. Invoked on 2007-12-24 , the job was failed.
Sql server error log
Database backed up. DBname creation,date()time€¦€¦paged dumped 8434659,first LSN: 21126:101410:48,last LSN :21128:933:1, number of dump devices:1, device information: file=1,type=disk (E:MSSQLBACKUP )
This is an informational message only. No user action is required
Error log:
Date:
Log: SQL Agent (current €¦)
Message:
(396) An idle CPU condition has not been defined-OnIdle job schedules will have no effect.
Please advice how to proceed?
hi this is raja sekar.k from bangalore,i need to know how to make a webform with the "BACKUP SQL DATABASE " from a user.. if it is possible.. please help me ..thanksregards Raja Sekar.kChola software consulting pvt ltd..Bangalore
View 2 Replies View RelatedI need to have an Application owner backup a SQL Server dbase after his updates.
Im not that familiar with ISQL. He does not have EM installed on his machine. What minimum installments do I have to do on his machine for him to log into SQL Server, after I create a login for him ?
Once in the command window I would give him the script of isql -Usa -Ppassword -SSqlServerA -Q "BACKUP DATABASE [test] TO DISK = N'E:Program FilesMicrosoft SQL ServerMSSQLBackupdbase1' WITH NOINIT , NOUNLOAD , NAME = N'test backup', NOSKIP , STATS = 10, NOFORMAT"
Is this the correct way to go ?
Thank you
In order to take automated backup of all user databases below is the query. This query will eliminate use of manual backups for user databases, in order to fully automate this just create a SQL Agent job and write this query in the job and forget about taking any manual DB backups.
DECLARE @name VARCHAR(50) -- database name
DECLARE @path VARCHAR(256) -- path for backup files
DECLARE @fileName VARCHAR(256) -- filename for backup
DECLARE @fileDate VARCHAR(20) -- used for file name
SET @path = 'C:DB_BKPUP'
[Code] .....
I wish to create a user that can backup any or all databases in our SQLServer 2000 Instance. I thought there would be a server role for thisfunction, however I can only find that after I grant access of adatabase to the user, then I can choose ds_backupoperator.I want to create a user that will have the ability to backup all thedatabases. I dont wish to have to come back to the server after a newtable is created and add the backup user to that table.I want SA w/o the full privilage...am I crazy?Any Suggestions?TIARobBackgroup: We currently have about 10 SQL servers, and adding more inthe future. I am using SQLBackup from Idera along with HP SurestoreTape library (60 slots,2- DLT8000 drives with 40/80 GB capacity) withArcServe from Computer Associates. I want to have this automated tobackup to file then tape, regardless of what databases get created.
View 1 Replies View RelatedHello ,Is it possible/recommended to do SQL server instance backups in Singleuser mode ?Thanks in advance,atv
View 5 Replies View RelatedHi:
This question came to me from a friend and I don't have a lot of details so I apologize in advance. I thought it might be worth a shot to ask here since I couldn't find anything on point in the MS help or KB. A SQL Server 7 database running on an NT 4.0 box is having a full database backup nightly. The backup routine is pretty standard, created using the Maintenance Wizard. It backs up two databases on the server. The problem is that when folks come into work in the AM, the databases are in Single-User mode and someone has to go in and change this. Is this normal behavior? My (admittedly limited) understanding of SQL 7 backups is that they are relatively transparent, and Single User mode is not necessary. You can operate normally other than you can't to any unlogged txn's while the backup is running. They have not done anything explicit to put the databases in Single-user mode when the backup begins. Any ideas how to prevent this from happening? (Or how to automate the switch out of Single-user mode when the backup is completed?)
Thanks!