T-SQL User Mapping

 I need to get a list of users and databases that a sql login is mapped to.  Is there a view or a sp that can get me this information?

You can use as a procedure:
Code Snippet
if exists (select 1 from sysobjects where name like '%sp_logins_database%')
drop proc sp_logins_database
go
create procedure sp_logins_database @db sysname = null
as
declare @cmd varchar(200),@database sysname
if exists (select 1 from tempdb..sysobjects where name like '%#logins_users%')
drop table #logins_users
create table #logins_users
(database_name varchar(100),
username varchar(100),
loginname varchar(100))
declare cur cursor for
select name from master..sysdatabases
open cur
fetch next from cur into @database
WHILE @@FETCH_STATUS = 0
begin
set @cmd = 'select '''+@database+''', l.loginname as [login name],u.name as [user name] from '+@database+'..sysusers u inner join master..syslogins l
on u.sid=l.sid'
insert into #logins_users
exec (@cmd)
fetch next from cur into @database
end
close cur
deallocate cur
if @db is null
select * from #logins_users
order by database_name
if @db is not null
select * from #logins_users
where database_name = @db
order by database_name
go
exec sp_logins_database 'master'

Similar Messages

  • Call to ldap server fails ORA-06521: PL/SQL: Error mapping function

    I am getting this error(s)
    ORA-06521: PL/SQL: Error mapping function
    ORA-06512: at "SYS.DBMS_LDAP_API_FFI", line 0
    ORA-06512: at "SYS.DBMS_LDAP", line 1338
    ORA-06512: at "SYS.DBMS_LDAP", line 1273
    ORA-06512: at "SYS.DBMS_LDAP", line 529
    ORA-06512: at line 127
    after binding and searching an ldap directory.
    Line 127 is:
    my_dn := DBMS_LDAP.get_dn(my_session, my_entry);
    Both of the 'my_xx' parameters have been successfully set earlier in the script I believe as they produce no errors and DBMS_LDAP.count_entries(my_session, my_message) returns = 1.
    I am following the example at:
    http://download-west.oracle.com/docs/cd/B10501_01/network.920/a96577/smplcode.htm#636994
    In fact any of the functions used in the 'while loop' in the above example give a similar error.
    Apparently SYS.DBMS_LDAP_API_FFI is a call to an external C program, but this would be a standard Oracle one, not one I have written.
    I am connecting to a non-Oracle ldap server, and have tried several (OpenLDAP 2.X, & Windows 2000 AD), with same results.
    Any suggestions gratefully received.
    Cheers
    KIM

    Fixed by running the catldap.sql script (ORACLE_HOME/rdbms/admin/catldap.sql) as SYS user and recreated the dbms_ldap packages. I am not sure why some of the functions worked OK and others did not.
    KIM

  • Ldap problem, ORA-06521: PL/SQL: Error mapping function

    I am getting this error(s)
    ORA-06521: PL/SQL: Error mapping function
    ORA-06512: at "SYS.DBMS_LDAP_API_FFI", line 0
    ORA-06512: at "SYS.DBMS_LDAP", line 1338
    ORA-06512: at "SYS.DBMS_LDAP", line 1273
    ORA-06512: at "SYS.DBMS_LDAP", line 529
    ORA-06512: at line 127
    after binding and searching an ldap directory.
    Line 127 is:
    my_dn := DBMS_LDAP.get_dn(my_session, my_entry);
    Both of the 'my_xx' parameters have been successfully set earlier in the script I believe as they produce no errors and DBMS_LDAP.count_entries(my_session, my_message) returns = 1.
    I am following the example at:
    http://download-west.oracle.com/docs/cd/B10501_01/network.920/a96577/smplcode.htm#636994
    In fact any of the functions used in the 'while loop' in the above example give a similar error.
    Apparently SYS.DBMS_LDAP_API_FFI is a call to an external C program, but this would be a standard Oracle one, not one I have written.
    I am connecting to a non-Oracle ldap server, and have tried several (OpenLDAP 2.X, & Windows 2000 AD), with same results.
    Any suggestions gratefully received.
    Cheers
    KIM

    Scott,
    Thanks for your concern. I should have explained. I am working in HTMLdb, successfully using ldap to authenticate, but now need to get the logged-in user's name and other details. All my attemps to use the wwv_flow_ldap functions have failed, and I am no resorting to DBMS_LDAP to get what I want. I am hoping thatsome helpful person can shed some light on this problem
    Cheers
    KIM

  • Error processing cube - requested operation cannot be performed on a file with a user-mapped section open

    Hi,
    We have recently moved our production servers and since the move have been experiencing an intermittent (but frequent) error when processing our OLAP cube.
    The error messages presented are:
    "Error: The following error occurred during a file operation: The requested operation cannot be performed on a file with a user-mapped section open"
    "Error: Errors in the OLAP storage engine: An error occurred while processing index for the <Partition Name> partition of the <Measure Group Name> measure group of the <Cube Name> cube from the <Database Name> database"
    I assume the second message is a consequence of the first error.  The partitions and measure groups seem to vary each time the process is run.
    It appears from similar threads that this is usually caused by backups or anti-virus applications locking the files that Analysis Services is using the process the cube.  I have ensured that there are no backups running at the time of processing and
    I have disabled anti-virus programs without success.
    I have also created a new version of the cube (using the deployment wizard) which deployed without error but then encountered the same error when processing for a second time.  There was nothing (client application wise) using this cube when it failed
    to process.
    As I mentioned earlier, this problem is intermittent.  Sometimes the cube will successfully process but usually it fails to process.
    We have not encountered this error in our previous production environment or in any of our development environments.
    Has anyone encountered this problem before? Any suggestions on possible solutions?
    Thanks
    Rich

    Hi jonesri,
    I think you can try to use SSAS Dynamic Management View to monitor SSAS instance, such as existing connections and sessions. For example, please run the following MDX query:
    SELECT[SESSION_COMMAND_COUNT],
    [SESSION_CONNECTION_ID],
    [SESSION_CPU_TIME_MS],
    [SESSION_CURRENT_DATABASE],
    [SESSION_ELAPSED_TIME_MS],
    [SESSION_ID],
    [SESSION_IDLE_TIME_MS],
    [SESSION_LAST_COMMAND],
    [SESSION_LAST_COMMAND_CPU_TIME_MS],
    [SESSION_LAST_COMMAND_ELAPSED_TIME_MS],
    [SESSION_LAST_COMMAND_END_TIME],
    [SESSION_LAST_COMMAND_START_TIME],
    [SESSION_PROPERTIES],[SESSION_READ_KB],
    [SESSION_READS],[SESSION_SPID],
    [SESSION_START_TIME],[SESSION_STATUS],
    [SESSION_USED_MEMORY],
    [SESSION_USER_NAME],
    [SESSION_WRITE_KB],
    [SESSION_WRITES]
    FROM $SYSTEM.DISCOVER_SESSIONS
    Use Dynamic Management Views (DMVs) to Monitor Analysis Services:
    http://msdn.microsoft.com/en-us/library/hh230820.aspx
    In addition, you can aslo use SQL Profiler to capture some events for further investigation.
    Use SQL Server Profiler to Monitor Analysis Services:
    http://technet.microsoft.com/en-us/library/ms174946.aspx
    If you have any feedback on our support, please click
    here.
    Regards,
    Regards,
    Elvis Long
    TechNet Community Support

  • Change user mapping when user is owner

    I have a DB on a SQL 2008 Server that I need to remove the user mapping for the SA account.  The creator/owner of the DB is actually a Windows account but the user mapping for the SA account are DBO role and DBO schema.  For some reason, this is the only DB on this server that has the issue.  Any help from one of you SQL gurus would be much appreciated as I am NOT knowlegeable on this topic.  I just need to remove this mapping for the SA account to this specific DB.

    Leks,
    I'm purely looking for a way to remove the user mappings for the SA account to this one DB.  I know SA has access to everything and that it uses the dbo account to connect to each DB.  I need a way to remove the user mappings.  It's that simple.  The way our dev team coded the website, having the user mapping in place creates lots of issues which I'm not going to provide here.  This is the only DB that has this mapping.  All other DB's on the server don't have the mapping and those web tools are working fine.
    Because SA has the dbo user account mapping on this DB, it will not allow me to edit the mappings.  Here is the error message.
    TITLE: Microsoft SQL Server Management Studio
    Drop failed for User 'dbo'.  (Microsoft.SqlServer.Smo)
    For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=10.0.2531.0+((Katmai_PCU_Main).090329-1015+)&EvtSrc=Microsoft.SqlServer.Management.Smo.ExceptionTemplates.FailedOperationExceptionText&EvtID=Drop+User&LinkId=20476
    ADDITIONAL INFORMATION:
    An exception occurred while executing a Transact-SQL statement or batch. (Microsoft.SqlServer.ConnectionInfo)
    Cannot drop the user 'dbo'. (Microsoft SQL Server, Error: 15150)
    For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=10.00.2531&EvtSrc=MSSQLServer&EvtID=15150&LinkId=20476
    BUTTONS:
    OK
    If anyone has a procedure for what I'm trying to accomplish here, it would be greatly appreciated.  There must be a way to remove/edit this mapping.  It's the only DB that has it.  Why?  I don't know because I didn't create this actual DB.

  • SSO to Exchange without user mapping

    I have Exchange configured for collabration groupware integration, and it works fine. I can get my calander entries without a problem when I have a user mapping set for the Exchange Transport. I have SSO enabled using the iis_proxy.dll authenticating via Active Directory also without a problem. I can also connect to OWA without any issue. The only thing I don't like is that I need a user mapping for the calander availabity.
    Does anyone know of a way to make this more automatic? I don't want the users to need to maintain their own mappings.

    We are in the exact same situation. I thought that the SSO22KerbMap ISAPI filter would do just that but the user mapping is required no matter what, unless I'm missing something in my config. The Exchange and Active Directory users are the same so a user mapping should not be required.

  • How to set/get the values thru Wedbynpro coding for User mapping fields

    Hi All
    In system object we have the user mapping fields like District,city,plant,Salesmanager.
    now we want to set/get the values of these usermapping fields of system object thru webdynpro coding...
    if anybody have sample codes of the same then it would be great help to me
    Thanks in advance
    Thanks
    Trisha Rani

    Hi Kavitha
    Thanks for your reply
    My requirement is exactly as follows.
    1) i have created one portal system object in system administration and also i created usermapping fields in the system object from the usermanagement  in system object.
    i created the user mapping fields like Plant,SalesManager,District etc.
    i also created the system alias name for the same system object
    2)  Now i came to persoanlize link and mapped the system object to the portal user.
    while mapping to the system object we need to enter Mapping userId, Password , once we enter these values and we can also enter the values of usermapping fields which we defined while creating the system object ( for example District,Salesmanager,Plant etc)
    once we enter all the values and click on save then these usermapping  values to be mapped to the portal user.
    3) Now my requirement is , i  want to control the usermapping field values thru webdynpro coding for setting/getting the values.
    I need sample code of the same.
    Please let me know if u need more details on the same.
    Thanks
    Trisha Rani

  • SSO and User Mapping at same time

    Hi,
    Can we use SSO and User mapping at same time between Portal and SAP Backend system?
    For some of the users the user id is different in both end.
    After implementing the SSO... Will it affect the existing user mapping? and the system alias created for that?
    If not, Can we use both SSO and user Mapping same time?
    Thanks,
    VB

    Hi VB,
    In this case I suggest you create 2 systems one you might have created for users who are having common user ids in portal & at the backend system.
    For the users whose ids are defeering you can create reference system and in user managemant property of that system
    Authentication Ticket Type - Select -SAP Logon TicketSAP Assertion Ticket
    Logon Method -  UWPW
    User Mapping Fields -  {100,200,300}Client;Language
    where 100,200,300 are the clients of the backend system.
    Assign this system in the ivews.
    Thanks,
    Vishal

  • User Mapping to R/3 - admin.pwdprotection=false but still pwd field appears

    <br />
    Hello All,<br />
    I am doing SSO using user mapping to R/3 system from Portal as the ids are different for Portal and R/3.<br />
    I can access a transaction iview from R/3 successfully using user mapping(in SSO) but the problem is everytime a user changes his R/3 password, the mapped password is to be changed in Portal.Otherwise, unable to access transaction iview.<br />
    1) I have changed the property ume.usermapping.admin.pwdprotection=false in configtool but still in User Admin > User mapping for system access , the password field is populated and while accessing the R/3, the password is being verified. I have seen in another system where the password field is not being asked after modifying the property to false, only id field is present. From the end user, under Personalize > User Profile > User Mapping for system, no systems are present as expected for mapping. Logon method in system is uidpw and mapping type is "Admin".<br />
    Versions - Portal is NW7.0 SP18 and ECC is .0 EhP3.<br />
    anybody faced the same problem? Is there a note to fix it?<br />
    2)Also, in the User Admin > User mapping for system access , in the dropdown I can see the system aliases I have created in systems but not in System admin> sys config > Ume config > under User Mapping , I do not find any reference system. <br />
    After first restart it was not there, after some time it has come, later it was coming as configured but invalid beside the system in braces in dropdown like abc(configured but invalid). Once I unselected, now it is no more available in dropdown.<br />
    3) I have used diagtool to identify the problem. In the ticket, how do I see the mapped user?<br />
    I am seeing only the following details.From the log - <br />
    The created ticket is: <br />
    [ [Ticket [initialized]<br />
      Ticket Version  = 0<br />
      Ticket Codepage =  (Encoding=1100)<br />
      User = 121444<br />
      Issuing System ID     = EPD  ( Portal name)<br />
      Issuing System Client = 000<br />
      Creation Time = 200905150649<br />
      Valid Time    = 8 h 0 min<br />
      Signature (length=261 bytes)<br />
      InfoUnit id=32, name=portal_user, content=portal:121444, length=16<br />
      InfoUnit id=136, name=authscheme, content=basicauthentication, length=19<br />
      InfoUnit id=1, length=9<br />
      InfoUnit id=2, length=3<br />
      InfoUnit id=3, length=3<br />
      InfoUnit id=4, length=12<br />
      InfoUnit id=5, length=4<br />
      InfoUnit id=10, length=9<br />
    ]. <br />
    Authentication stack: [ticket].<br />
    <br />
    Does this have an entry for mapped user of target R/3 system also?<br />
    If I am not finding the userid/pwd in ticket, how is SSO working? based on user mapping only?<br />
    Thanks,<br />
    Isvarya<br />

    Thanks Anja for the quick response.
    My primary objective is to use SSO with logon tickets to backend which is independent of user passwords.
    regarding 1)
    From the link -
    http://help.sap.com/saphelp_nw70/helpdata/EN/f8/3b514ca29011d5bdeb006094191908/frameset.htm
    Features
    ●      Either users or administrators can perform user mapping.
    ¡        Users must always enter a password to validate their mapped user ID.
    This password is not stored, but is used to confirm that the user is entering a user ID with which he or she has access to the ABAP-based system.
    ○       Administrators can enter a password to validate their entries.
    The UME property ume.usermapping.admin.pwdprotection defines whether or not the administrator must enter a password. By default the administrator must enter one.
    is also in the same lines.
    But as per the SAP library link, I do not find a reference system  because of problem 2 in the initial post.
    Also, I have a screenshot of user admin where the password field itself is not present. If you can share your email id, I will send the scrnshot without pwd and mine with password.
    2)I have seen this note. But, none of the 3 cases mentioned are applicable to me..user mapping is working just fine..Only reference system is not populated. 
    3) Becuase of 1, I was expecting to see mapped id alone or mapped id along with system name in logon tickets.
    Thanks for the response.

  • Portal Runtime Error while performing User Mapping  to SAP SRM

    Please find below the error I received while User Mapping from  Enterprise Portal to SAP SRM :
    Portal Runtime Error
    An exception occurred while processing a request for :
    iView : pcd:portal_content/administrator/super_admin/super_admin_role/com.sap.portal.user_administration/com.sap.portal.user_mapping/com.sap.portal.userMappingAdmin/com.sap.portal.userMappingAdmin
    Component Name : com.sap.portal.usermanagement.admin.UserMappingAdmin
    User Mapping not fully available..
    Exception id: 04:21_23/06/05_0073_8097650
    See the details for the exception ID in the log file

    Hi,
    yes, Karsten is correct. Just some background:
    "User Mapping not fully available.." finally means that user mapping is configured to use strong encryption, but the main crypto key for user mapping is missing. Usually, that's because "SAP Java Cryptographic Toolkit" and/or "JCE policy files for unlimited strength encryption" are not installed (or the server hasn't be restarted afterwards). The note will most likely help
    Best regards
    Heiko

  • Error while creating the user mapping

    hi friends i was gettig this error while editing the logon data in user mapping.
    An exception occurred while processing a request for :
    iView : pcd:portal_content/administrator/super_admin/super_admin_role/com.sap.portal.user_administration/com.sap.portal.user_mapping/com.sap.portal.userMappingAdmin/com.sap.portal.userMappingAdmin
    Component Name : com.sap.portal.usermanagement.admin.UserMappingAdmin
    User Mapping not fully available..
    Exception id: 12:54_19/02/07_0002_9709050
    See the details for the exception ID in the log file

    Hi Rajesh,
    Navigate to <b>User Administration---->User Mapping</b>
    Under Search, Search for your user id in users.
    You will get ID, Name with <b>Edit Link</b> and by the side "System" Drop Down Box which contains the name of the system Aliases that u created.
    <b>Click on Edit Link,</b> It will ask for user and password. Give the user and password for R/3 System and clicked save. After this you will get an info like, Logon Data Saved.
    ******Hope this helps you. Reward Points if you find this helpful.
    Regards,
    Eben. J <i></i><i></i><i></i>

  • Error in User Mapping

    Hi All,
    I have created a system from Application integrator PAR file and has added on extrafield to the system as I have three fields to be mapped with the target application.
    On doing so when I try to preview the iView using this system for connecting the target application I am getting the following error.
    Portal Runtime Error
    An exception occurred while processing a request for :
    iView : pcd:portal_content/com.tcs.192207.192207/com.tcs.192207.192207_Roles/com.tcs.192207.home/com.tcs.192207.documentum/com.tcs.192207.documentum_01
    Component Name : com.sap.portal.appintegrator.sap.Generic
    Exception in SAP Application Integrator occured: Unable to process template 'userName=<MappedUser>&password1=<MappedPassword>&repositoryName=<<b>Repository</b>>', because 'Repository' is an invalid terminal property of the Root context..
    Exception id: 10:48_01/06/07_0027_203196350
    See the details for the exception ID in the log file
    I dont know what to write in place of the bold portion.
    I have added the extra mapping field with the name Repository
    I tried MappedRepository also that is also not working can sombody please help. I am getting null at the target application end for this extra field rest of the two I am able to recieve.
    Regards
    Sid

    Hi Sid,
    your template does not work because Repository is no standard parameter. You have to use a custom provider for this parameter. Refer to chapter 6 (Making Parameter Dynamic) of document <a href="https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/bf8cc890-0201-0010-00b1-8d04e5f4378a">"How to…Use the Application Integrator"</a>.
    Basically, you have to write a portal service which provides the parameter at runtime. If I understood you right the parameter Repository has to be set by the user in the user mapping dialog. Thus you can access the value using the IUserMappingService See the SAP Library for an <a href="http://help.sap.com/saphelp_nw70/helpdata/en/69/3482ee0d70492fa63ffe519f5758f5/frameset.htm">Example</a>.
    Best regards,
    Martin

  • Issue with user mapping and SAP reference system

    Hello Gurus,
    I have this strange system behaviour when preparing my system for single sign-on using user mapping.
    Case 1.
    In the user management property category, I have the following defined.
    Authentication Ticket Type - SAP Logon Ticket
    Logon Method - UIDPW
    User Mapping Fields  -
    User Mapping Type - admin, user
    In the alias editor, I defined the default alias as SAP_PRD
    Result= when I go to identity management to assign the reference system (the default alias - SAP_PRD)...I do not see the system alias there.
    Case 2:
    In the user management property category, I have the following defined
    Authentication Ticket Type - SAP Logon Ticket
    Logon Method - SAPLOGONTICKET
    User Mapping Fields  -
    User Mapping Type - admin, user 
    In the alias editor, I defined the default alias as SAP_DEV
    Result, when I go to the identity management to assign the refernce system (the default alias - SAP_DEV), I see it there.
    What might be my issue? Does it mean I can't assign SAP reference if I am using UIDPW as logon method?
    Please help me.

    Hi Mahesh,
    Thanks for the feedback. I am relatively new to EP...so please I won't mind if you can guide me on how to go about this.
    This is what I did...
    I chose System Administration > Permissions
    In the PCD, I located my system with the alias, SAP_PRD
    It opened up the permission assignment area.
    Now I have these permissions set
    Administrator - Full Control
    Administrators - Full control
    com.sap.caf.eu.gp.roles.superuser - Full control
    Everyone (built in group) - Full control
    Everyone (Everyone role)- Full control
    super_admin_role - Owner
    For all the above End User box is checked.
    I can't find anyone end user group .
    Once I pick UIDPW, the alias disapperars from the reference system list.
    Please help.

  • Configuration Issue in User Mapping ..

    Hi,
    Pls help resolve this issue..
    When i go to <b>" UserMapping "</b> option using the <b>"Personalize "</b> link , i get the following error msg..
    "There is a configuration issue which leads to problem when accessing user mapping data for the selected backend system"
    Also , if i go thru "User Administration -> User Mapping "
    then it says,
    --"There is a configuration issue which leads to problem when accessing user mapping data for the selected backend system  .
    Usually reason is user mapping being configured for Strong encryption, but necessary additional files might be missing.Check Security log file for information "--
    I am not able to solve this problem..Pls help
    Thanks in advance

    Hi Venkat,
    <b>Here the quick and dirty solution</b>:
    In your portal go to 'System Administration' -> 'System Configuration' -> 'UM Configuration' -> 'Direct Editing'.
    There locate the parameter 'ume.usermapping.unsecure', set it to 'TRUE' and restart your server.
    I would rather recommend to install the unlimited strength jurisdiction policy files.
    For more info on this, check this thread:
    JCE Jurisdiction does not allow Portal to start
    Hope this helps,
    Robert

  • How to defne user mapping for a Webservice method to acheive single sign on

    I all,
    I have created a Web service System using a url (containing full path of my wsdl )
    Now this particular wsdl(my webservice) has an <b>authenticate method</b> , which takes username and password.
    wanted to know is there any way that i can do user mapping for it .
    i.e when i create an ivew for this web service system using authenticate method , it should pick up the username and password from the user mapping. presently the ivew itself asks for username and password ?
    else can anyone tellme is there a way to do user mapping for my web service system that i have created using a wsdl url. presently it works with any junk username password, i mean the connection always succeds , may be because accessing a wsdl dosent requires any user name and password.
    thanks

    I all,
    I have created a Web service System using a url (containing full path of my wsdl )
    Now this particular wsdl(my webservice) has an <b>authenticate method</b> , which takes username and password.
    wanted to know is there any way that i can do user mapping for it .
    i.e when i create an ivew for this web service system using authenticate method , it should pick up the username and password from the user mapping. presently the ivew itself asks for username and password ?
    else can anyone tellme is there a way to do user mapping for my web service system that i have created using a wsdl url. presently it works with any junk username password, i mean the connection always succeds , may be because accessing a wsdl dosent requires any user name and password.
    thanks

Maybe you are looking for

  • Can I stop iTunes from automatically unsubscribing to Podcasts.

    iTunes keeps telling me it has automatically unsubscribed me to a Podcast because i haven't listened to it for a while. Can i set this to a much higher value before it does that? Its really irritating. I often don't listen to a Podcast for a few week

  • Fax and Modem with UC560

    Dear All, I have a somewhat tricky configuration to make happen and hope you can help me. I have a UC560-BRI-K9 (located in Germany) that is connected via BRI/ISDN and also utilizes an external SIP-Trunk. The UC is shared by two related businesses an

  • Imported images not displaying in LR

    My images do not display in the Library module. If I click on the Develop module I can see an individual image or three, but then as I go through the album previous viewed images go blank again. Not sure what I'm doing wrong. Any ideas?

  • Display Settings, 16:9?

    I just got my first mac, a mac mini. i'm using a phillips 17" widescreen LCD display(VGA input) but i cant seem to get a widescreen output from the mac mini. this might be dumb question but how do i get it to display widescreen on the LCD display? re

  • Access denied:com.sap.ip.bi.web.portal.integration.launcher

    Hi Friends, I have installed a Standalone Portal ( EP, EP core, BI Java) , configured LDAP as data source and imported the Portal content from Source system . ( in Development, Quality, Production) I completed all configuration and testing completed.