To create such script which will fetch all this data in form of create command

Whenever I do a restore I always forget to reapply some database roles or application roles in post restore steps.We have one database of very different db roles,Grant permissions,Login and User permissions and they changes also frequently.
What dmv's I required to create  such script which will fetch all this data in form of create command and after restore I just have to run those create commands and all the rights should visible as before .
Thanks

The context of your question is not entirely clear, but I assume that you restore a copy from one type of environment (for instance QA) to another (for instance development).
To get group membership, you use the catalog views sys.database_principals and sys.database_role_members. Querying these is straightforward.
To get permissions you would query sys.database_permissions. This view is more difficult to query, but you can take shortcuts depending on what is in use at your site.
Erland Sommarskog, SQL Server MVP, [email protected]

Similar Messages

  • Is there any FM which will fetch all functional reportees of a Manager ?

    Hello friends,
    Can anyone please resolve my query mentioned below ? This is related to HR-ABAP.
    Query:- Is there any existing Function Module to get all the functional reportees of a Manager ?
    [Part of requirement:- On report selection-screen, Manager's GIN number will be provided and the report will extract the data for all
    the functional reportees of the manager. My query is, Is there any existing FM for this requirement which will fetch all the functional reportees of a Manager ?]
    Thanks & Regards,
    Ranjan Sahoo

    Hi Mohan,
    this is correct since the values are stored in different tables (fact, dimension etc) due to star sheme modelling. As far as I know there is no standard function module for this issue.
    However ABAP report RSDD_SHOW_ICUBE might help. This is the report for transaction listcube, all relevant data is build up, there you should find all necessary steps and standard reports/modules to fetch the required characteristic value. Although I do not know the exact requirement you will probably have to work with SID values.
    Perhaps this will help resolving your issue.
    Best Regards,
    Marcel

  • Form which will fetch possibly many records(maybe millions) from database

    Hello,
    I need to develop a form which will fetch many records from the database from one table . I could used go_block('blockname') & execute_query but I want to do something that will fetch the data and place it in a non db block instead of looping through the db block . What should I use ? Cursor ?
    I'd be grateful for any help please with an example of the code . Thanks.

    twinklin_girl wrote:
    Hello,
    I need to develop a form which will fetch many records from the database from one table . I could used go_block('blockname') & execute_query but I want to do something that will fetch the data and place it in a non db block instead of looping through the db block . What should I use ? Cursor ?
    I'd be grateful for any help please with an example of the code . Thanks.Two things you can do...
    Create a view and based on that view make your form.
    Another is How to Base a block on a FROM Clause Query
    Hope this helps
    Hamid
    Mark correct/helpful to help others to get right answer(s).*

  • I need to create a link which will send on email

    hi All
    i need to create a link which will send to email after click to that link it will directly opent that portlet so i want to know how to create
    runtime link.

    What you're referring to is a drop down menu. Those can't be created normally in iWeb. They can be added to a iWeb page but require an HTML snippet and javascript. Some possible javascript solutions have been posted in this forum. Search for drop down menu. Also do a Google search for drop down menu to get a number of sites with possible solutions.
    Or, you can create a separate Residential page and put photos of windows, shower doors, etc. on it and use them as links to the pages for the windows, shower doors. Those pages don't have to be included in the navbar. You can turn it off in the Inspector/Page/Page pane.
    Also see Section 9 of this iWeb FAQ site.
    Happy New Year

  • How to create a link which will redirect to a different iView?

    Hello,
    I have a certain iView, let's call it "myiView" which sits inside a certain Role, let's call it "myRole".
    At the Homepage of the users I have KM navigation iView which shows a certain folder. I would like to create inside this folder a link to "myiView", this way when users will click on this link at the Homepage they will be redirected automaticly to "myiView". I remember reading once something regarding internal links perhaps this is solution but I'm not sure. Can anyone please show me how to create such link which redirects to another iView at the portal.
    10X
    Roy

    Hey Prakash,
    I am creating a KM link to this target, where at this link I can write javascript? As far as I know it is only possible at the iView level no? And where do I take the PCD URL from?
    Hey Ashutosh,
    I think that your method will open a whole new browser since it is an external link, I woulk like to keep the current navgation at the same page, simply navigate the user to a different place at the portal...
    Roy

  • Hi,how can i change the default settings on my adobe readerX1 such that it will display all my pdf files according to their individual cover pages (as cover picture thumbnails)before i click them to open and read........i really enjoyed this feature as a

    hi,how can i change the default settings on my adobe readerX1 such that it will display all my pdf files according to their individual cover pages (as cover picture thumbnails)before i click them to open and read........i really enjoyed this feature as a default settings upon installation in previous editions of adobe reader .i use a windows 8 pc now.thank

    For sideloaded content the nook pulls the metadata from ePub file itself.  I would suggest looking at a program like Sigil or Calibre that will let you edit the metadata in the book to make it appear like you want.
    For the PDF vs ePub - No, that's the way PDFs work (think of them as graphics, not text), wheres ePubs are Web Pages - so  no you can't them to behave exactly alike without converting the files.

  • Create PDF file which will write to mdb

    HI there.
    I have a requirement to add some code to a set of PDF files which will be read by members of my team as part of their induction.   Each pdf has a form at the end which captures their name and a tickbox to state that they have read the document.  When a submit button as part of the form is clicked I would like to write these basic details to an access mdb database so that we can keep a check of who is compliant with the induction process.
    Is it possible to use Livecycle designer to create a document which will do this when opened in Adobe Reader?  I don't need the code to do this - just need to know if it is possible.  If not are there any other ways I could save the information on the form silently without the user needing to do anything other than submit the information?
    I've read somewhere that for certain things to work you need to activate some kind of reader extensions - is that the case for this solution?
    Thanks in advance for your advice.
    Matt

    Hi Matt,
    Yes, if the user has the free Adobe Reader, then database access will require the form to be Reader Enabled in LC/ADEP Reader Extensions.
    While you can Reader Enable a form in Acrobat (with restrictions), connecting to a database is not permitted.
    See here for a summary: http://assure.ly/etkFNU.
    Hope that helps,
    Niall

  • Create a procedure which will pass table name as an argument

    Please let me know, I want to create a procedure which will take
    table name as an argument and will display total no. of rows of
    that table.

    Hopefully this code will help u.
    CREATE OR REPLACE PROCEDURE P1(TAB_NAME IN VARCHAR2, ROW_NO
    OUT NUMBER)
    AS
    SQL_STMT VARCHAR2(1000);
    BEGIN
    SQL_STMT := 'SELECT COUNT(*) FROM ' || TAB_NAME;
    EXECUTE IMMEDIATE SQL_STMT INTO ROW_NO;
    END;
    SQL > VAR A NUMBER
    SQL > EXEC P1('EMP',:A);
    SQL > PRINT A
    A
    12
    SQL > SELECT COUNT(*) FROM EMP;
    COUNT(*)
    12

  • I want to create stored procedure which will give output rows from "values that are passed as one parameter (comma seperated) to store procedure".

    Hello,
    I want to create stored procedure which will give output rows from "values that are passed as one parameter (comma seperated) to store procedure".
    Suppose , 
    Parameter value : person 1,person2,person3 
    table structure : 
    Project Name | officers 1 | officers 2
    here, officers 1 or officers 2 may contain names of multiple people.
    expected OUTPUT : distinct list(rows) of projects where person 1 or person 2 or person 3 is either officer1 or officer 2. 
    please explain or provide solution in detail 
    - Thanks

    Hi Visakh,
    Thanks for reply.
    But the solution you provided giving me right output only if officer 1 or officer 2 contains single value , not with comma seperated value.
    Your solution is working fine for following scenario : 
    Project 
    Officers 1
    Officers 2
    p1
    of11
    off21
    p2
    of12
    off22
    with parameter : of11,off22 : it will give expected output
    And its not working in case of :
    Project 
    Officers 1
    Officers 2
    p1
    of11,of12
    off21,off23
    p2
    of12,of13
    off22,off24
    with parameter : of11,off22 : it will not give any row in output
    I need patten matching not exact match :) 
    ok
    if thats the case use this modified logic
    CREATE PROC GetProjectDetails
    @PersonList varchar(5000)
    AS
    SELECT p.*
    FROM ProjectTable p
    INNER JOIN dbo.ParseValues(@PersonList,',')f
    ON ',' + p.[officers 1] + ',' LIKE '%,' + f.val + ',%'
    OR ',' + p.[officers 2] + ',' LIKE '%,' + f.val + ',%'
    GO
    Keep in mind that what you've done is a wrong design approach
    You should not be storing multiples values like this as comma separated list in a single column. Learn about normalization . This is in violation of 1st Normal Form
    Please Mark This As Answer if it solved your issue
    Please Mark This As Helpful if it helps to solve your issue
    Visakh
    My MSDN Page
    My Personal Blog
    My Facebook Page

  • Which BADI will be triigrd for dates in service contract creating

    Hello CRM  guys ,
       Which BADI will be triigrd for dates in service contract creating.
    regards,
    ram.

    Hello CRM  guys ,
       Which BADI will be triigrd for dates in service contract creating.
    regards,
    ram.

  • I need script which will filter a set of groups by name, and then give a CSV with direct members

    I need script which will filter a set of groups by name, and then give a CSV with direct members
    say it like,
    $groupitems = Get-ADGroup -SearchBase "DC=fincaint,DC=local" -Filter {Name -like "*AppUsers"}
    ForEach ($groupitem in $groupitems)
            IF ($groupitem.objectClass -eq 'user')
       Get-ADUser $groupitem | FT Name, Email, City, Title | Export-Csv c:\member.csv
          IF ($groupitem.objectClass -eq 'group')
       Get-ADgroup $groupitem | FT GroupName, GroupDN | Export-Csv c:\member.csv

    Hi Dhiravia,
    It's been a while. How is it going? If the suggestion provided by ThmsRynr doesn't help, for scripting questions, in order to get better help, it's recommended that we ask for advice in the following scripting forum.
    The Official Scripting Guys Forum
    https://social.technet.microsoft.com/Forums/scriptcenter/en-US/home?forum=ITCG
    Best regards,
    Frank Shen
    Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact [email protected]

  • Unable to load sql script which is given in this tutorial: load_sample.sql

    Hi!
    To start, I inform you that I am beginner with Oracle. I installed Oracle 10g Express Edition on my computer(O/S: window xp)
    Then I go on http://127.0.0.1:8080/apex/f?p=4550:9:4181329966856697::NO:::, I login with system account, I create another dba account etc ... all looks very well ! Then I follow this tutorial: http://st-curriculum.oracle.com/tutorial/DBXETutorial/index.htm
    and I am unable to load sql script which is given in this tutorial: load_sample.sql (page:What to do first> Loading Data). I try with a little sql script and same result. I use gedit with UTF-8 and load in UTF-8, my browser is Firefox .
    The result is: when I upload a script, The browser returns "script uploaded." Then I can click on my script but the file is empty ! Nothing is done when i click on "run". Also I can' create a script. To import a script I have to copy one by one request in sql commands. I try also to change the owner of load_sample.sql:
    But it doesn't work. If someone has an idea ? Thanks for your help.
    regards
    meraj

    Problem Solved.
    When I switched default browser from mozilla firefox to ie(internet explorer) the problem is solved i got this from forum post (Script Editor Not Working
    But still i want to know why "load_sample.sql" is not run with the default browser(mozilla firefox).

  • In which table are stored the data of a set created by GS01?

    Hi All,
    could anyone tell me in which table are stored the data of a set created by GS01?
    Thanks

    Hi,
    It's stored in SETHEADER, SETNODE and SETLEAF tables.
    Regards,
    Eli

  • I want to update my IPODtouch, but it will erase all my data. How do I sync my ipod to a new computer so itunes will not erase my data???

    I want to update my IPODtouch, but it will erase all my data. How do I sync my ipod to a new computer so itunes will not erase my data???

    Follow these instructions. When you restore the iPod from backup as the article says your iPod will also be updated.
    Syncing to a "New" Computer or replacing a "crashed" Hard Drive: Apple Support Communities

  • HT201210 I am unable to update my IPhone 4 to the IOS 6.  I managed to back up and transfer  and then when it asked to update I said yes and the sync process starte, left it overnight and it came up with an error if continue you will loose all your data. 

    I am unable to update my IPhone 4 to the IOS 6.  I managed to back up and transfer  and then when it asked to update I said yes and the sync process started, left it overnight and it came up with an error if continue you will loose all your data.  So stopped! Help!

    Are you currently on ios 4?  If so that's where the backup comes in.  You'll need to restore your backup once the software is updated.

Maybe you are looking for