Generate create user scripts (including grants) frm one DB to another

Hello


I want to create users, including similar grants on a new database of an older one.

Say DB1 is the former base & DB2 is the new database.
How to generate scripts user creation to create users in DB2 that are there DB1?



See you soon,.
Malika

user9131570 wrote:
Hello

I want to create users, including similar grants on a new database of an older one.

Say DB1 is the former base & DB2 is the new database.
How to generate scripts user creation to create users in DB2 that are there DB1?

See you soon,.
Malika

Hi.First generate all the privileges of the database DB1 as follows:

select 'grant '||PRIVILEGE||' to '||'' from dba_sys_privs
where GRANTEE='';

select 'grant '||GRANTED_ROLE||' to '||'' from dba_role_privs
where GRANTEE=''

select 'grant '||PRIVILEGE||' on '||GRANTOR||'.'||TABLE_NAME||' to '||''
from dba_tab_privs
where GRANTEE=''

then create user () in the (new) DB2 database and above privileges as well.

Tags: Database

Similar Questions

  • Permissions do not update every time that a user moves a file from one folder to another in the Windows XP computer.

    Original title: folder permissions to move or copy.

    I have a problem that I'm sure has a simple explanation but I don't know.  I have a folder in the tree that whenever a user moves a file from one folder to another, the permissions do not update.  Yet if a user copies the folder to the same location, permissions to update as expected.  This only happens with XP.  If I try with Win 7, if the user moves or copies, update permissions.

    Has anyone seen this or have an explanation?

    Hello

    Your Windows XP question is more complex than what is generally answered in the Microsoft Answers forums. It is better suited for the IT Pro TechNet public. Please post your question in the forum TechNet for assistance:

    http://social.technet.Microsoft.com/forums/en/itproxpsp/threads

    Hope the helps of information.

  • Grants from one server to another

    Is it possible to create grants on objects in one schema to another, if the patterns are on different servers?

    Ben

    Benton says:
    Is it possible to create grants on objects in one schema to another, if the patterns are on different servers?

    Ben

    Let's say you have USER-1 of DB1 and USER-2 in DB2.

    You have a few tables have been created in USER-2 and now you want to USE-1 to access. For this, all you need is a link DB that would be created in USER-1 which will have the credentials of USER-2. Now when you connect via DB link created from the USER-1 USER-2 you can access the objects of USER-2.

  • Help me in creating softlink to move newspapers frm one to another directory.

    Hello

    I have a directory/u01/log, which is almost full, it prevents the inside newspapers.
    I want to create a symbolic link so that newspapers will fill the other as mount point / U02

    Can someone help me please?

    Thank you

    784786 wrote:
    Hello

    I have a directory/u01/log, which is almost full, it prevents the inside newspapers.
    I want to create a symbolic link so that newspapers will fill the other as mount point / U02

    Can someone help me please?

    Thank you

    CD/U01
    MV newspaper log_sav
    mkdir/u02/log
    ln s/u02/journal/u01/log

  • Grants the user script

    I want to get the user to my database creation script.

    So I used the following query.


    SELECT "create a user" | U.UserName | "identified" |
    DECODE (PASSWORD,
    NULL, 'EXTERNAL ',.
    "with the values" | '''' || PASSWORD | ''''
    ) || CHR (10) | "default tablespace". USER_USERS | CHR (10) |
    "temporary tablespace. temporary_Tablespace | CHR (10) |
    "profile" | PROFILE | CHR (10) |
    'quota ' |
    DECODE (Q.max_bytes,-1, 'UNLIMITED', NULL, 'UNLIMITED', Q.max_bytes).
    "on" | USER_USERS |
    DECODE (account_status, "LOCKED", "account lockout",
    "EXPIRATION", "password expired",
    "EXPIRED------& LOCKED ',"account password expires","
    NULL)
    ||
    ';'
    FROM DBA_USERS U, Q DBA_TS_QUOTAS
    -Comment this paragraph to include the system users & default
    If U.username NOT IN ('SYS', 'SYSTEM',
    "SCOTT', 'GENERAL', 'OUTLN', 'WKPROXY', 'WMSYS', 'ORDSYS', 'ORDPLUGINS', 'MDSYS."
    "CTXSYS', 'XDB', 'ANONYMOUS', 'OWNER', 'WKSYS', 'ODM_MTR', 'ODM', 'OLAPSYS."
    'HR', 'OE', 'PM', 'SH', 'QS_ADM', 'QS', 'QS_WS', 'QS_ES', 'QS_OS', 'QS_CBADM ',.
    'QS_CB', 'QS_CS', 'PERFSTAT')
    AND U.username = Q.username (+) AND U.default_tablespace = Q.tablespace_name (+)
    ;

    Then download the creating user script.

    Now, I want to get all subsidies previledges, object, resource group etc. of those to all users.
    Is any script available?

    How can I get that
    Thank you

    Published by: user618704 on February 25, 2009 02:34

    Hello

    I think that you have received the 'http://toolkit.rdbms-insight.com' script, so you answer from the same link
    Too much. Check it out

    http://Toolkit.RDBMS-insight.com/grants_script.php

    -Pavan Kumar N

  • creating user in sqldevloper script

    Hello
    in sqldevloper 3.0.04
    is it possible to see the creating user script in sqldevloper for a user? How?

    Thank you.

    You needn't SQLDeveloper to do it for you.
    All of these tools, e.g. Toad, expected to make using DBMS_METADATA. GET_DDL, GET_GRANTED_DDL, etc.

  • Need help to automate a script to create user

    Hi people,

    Environment: 10.2.0.4.0
    Platform: Sun Solaris

    I had to stop a few users (about 100) in my database. But before I did, I would save the user creation script as backup (just in case I need to re - create a user).

    Toad can generate the script to create user as follows

    CREATE USER TEST
      IDENTIFIED BY VALUES '**********'
      DEFAULT TABLESPACE PUBLISH
      TEMPORARY TABLESPACE TEMP_APP
      PROFILE APP_USERS
      PASSWORD EXPIRE
      ACCOUNT UNLOCK;
      -- 2 Roles for TEST
      GRANT CONNECT TO TEST;
      GRANT E_READONLY TO TEST;
      ALTER USER TEST DEFAULT ROLE ALL;
    However, it is simply too tedious to do it for each user. Can someone please suggest a solution more effeienct to generate the script to create user using PL/SQL, script etc?

    Thanks in advance

    rogers42

    DBMS_METADATA. GET_DDL

    Long value 1000000000

    Select dbms_metadata.get_ddl ('USER', username)
    from dba_users
    where

    There are other functions in this package to other things you list.

    -----------
    Sybrand Bakker
    Senior Oracle DBA

  • Creating table in the schema has with the user B and granting permissions to the user C

    Hello, I have a problem fun - we have a large table which requires a batch to make millions of updates, and he needs to finish more quickly. It takes several hours as an update, but a select create table did the same thing in about a minute. Yay! Then we just delete the old table and rename the new table to the former, rebuild all the index and grant select/insert/update/delete permissions to another user who needs access... and there is the problem, Oracle said insufficient privs.

    We have A figure, which is the owner of the table, userid B who done all the stuff of application batch and userid C which performs inserts for a process of middleware. None of them are actual users, of course. We want that user B to do the ETG, rename, rebuild and re-grant of the authorisation of the index. But user B apparently cannot grant permissions on objects in the schema A to user C, even if B has created the table and has the role DBA (not ideal, I know)!

    What's really crazy is that there is no sense unique user b can grant permissions to user C, which is to:

    grant select any table USER c;
    grant insert any table USER c;
    grant update any table USER c;
    Grant delete any table USER c;

    It seems really perverse can create tables in diagram A and even grant C privs "whole table" that user B, but may not grant privs specifically on this object in the schema A, even with DBA privs. I must be missing something... right?

    Yes. By default, the stored procedures are stored procedures from DEFINER rights. If A is the owner of a stored procedure, this stored procedure can do whatever A enjoys the privileges to directly. If A grants B privileges RUN this stored procedure, when B calls the stored procedure, the procedure runs with the privileges.

    I agree point stew, however, re-creating objects in Oracle is generally a bad idea and a TRUNCATE with one insert direct-path, possibly combined with the deactivation and the rebuilding of the index would be more appropriate than a DEC. If you're going to stick with this Assignment, however, that really do in a stored procedure owned by A while B has no need to CREATE ANY TABLE.

    Justin

  • How to migrate a report created by a user in OBIEE from one Instance to another?

    Hi all

    How to migrate a custom report created by the user in one instance to another.

    For example the user created a custom in the instance of the UAT report now I need to move it to PROD.

    Thank you

    Vishwamber Shetty

    Hello

    In a simple way, you can select State of catalog goto and Archieve it. Copy this physical file on the other machine new catalog goto and unarchieve it.

    AjitR

  • Create a script pour changer a voice-conversion rules

    Hi all,

    I have a client who wants to when he is on leave and that its closed society the opportunity to redirect all calls arriving on its head-end Agency agreed to take messages.

    I told him he can call me before leaving me to but not pour of suitable ca him... he wants to be the Girardon him even.

    I wonder therefore if there is the possibility to create a script that will initiate a telnet on the CPU connection and back orders I would do if the customer called me...

    Thanks in advance,

    Roman

    Hello Romain, and I salvation also Eric who is interested in the solution.

    Pour to do what you want to do, we will use 2 tools: PLINK.exe and the AUTOIT.

    TUS plink.exe

    http://www.chiark.greenend.org.uk/~sgtatham/PuTTY/download.html

    PLINK is the version of PUTTY console.

    PLINK will help us to establish administration sessions encrypted with our equipment.

    This is the command-line so big advantage, UN script can therefore include it in. That's what we do.

    Copy the utility to a directory on your disk.

    Œuvres a session console in this directory and launch a SSH session on the UC500 (user id ADMIN and address IP UC 500 = uc500_IP_ADDR).

    Plink - ssh [email protected] / * / _IP_ADDR

    Œuvres administrator.

    OK on one our SSH client.

    TUS now more AUTOIT.

    http://www.autoitscript.com/AutoIt3/index.shtml

    Download the ZIP package version. How you install anything on your PC. Unzip the package and go.

    AutoIt is a suite of tools absolutely magical (the word is weak).

    With Autoit can completely automate any Windows application. And without exception.

    This script amendments tool of will automatically launch windows programs and in addition to simulate user action in the application. And this by moving the mouse, buttons of the clicking on and typing while reading the contents of the windows, and well tempered by typing keyboard to the. And all instead of user.

    On can USE autoit pour to allow any to answer E-Mails only PC!   (Make a PC completely human?   )

    Just imagine the power of such a tool.

    I use it for everything and anything.

    And in this case, I use pour automate connections admins on Cisco equipment.

    You'll find en example a script that allows to connect in SSH to your favorite UC 500. This script displays the result of a show version.

    Here's the script.  call the session_admin_1.au3

    EARLY SCRIPT ===>

    $ip_addr = '192.168.10.1 '.
    $user = "cisco".
    $password = "cisco".
    $enable_password = "cisco".
    $commande = "plink - ssh" & $ip_addr
    ;
    Run (@ComSpec & "/ c" & $commande, "", @SW_MAXIMIZE)
    ;
    Sleep (500)
    Send ($User)
    Send ("{Enter}")
    Sleep (500)
    Send ($Password)
    Send ("{Enter}")
    Sleep (500)
    Send ("Enable")
    Send ("{Enter}")
    Send ($enable_password)
    Send ("{Enter}")
    Send "(terme len de 0") "
    Send ("{Enter}")
    Send ("see the version")
    Send ("{Enter}")
    Sleep (500)

    ;===> END SCRIPT

    Copy in the same directory as PLINK.exe.

    And copies also in the same directory the package AUTOIT AUTOIT3.exe utility

    Pour the script of this Tester

    1 / copy your script into the directory where the utility autoit3.exe
    2 / works a session console in this directory
    3 / type the following command: c:\>repertoire_autoit\session_admin_1.au3 autoit3

    And normally you need to see an educational SSH session on your CPU and see the version displayed on the screen.

    The syntax of the commands in the script is quite simple to understand and very well before in the help file provided in the package.
    I think that you won't hurt to adaptar to your needs.

    Will notice me instructions pour to login at UC are 500 it contained in variables at the beginning of the script.

    If so wishes display windows question marks for the administrator, to ask him to type this information on can adapt the script as a suit.

    EARLY SCRIPT ===>

    $ip_addr = InputBox ("Login", "IP address?","", "", 200 150 ")
    $user = InputBox ("Login", "Administrator?", "","", 200-150)
    $password = InputBox ("Login", "Password?", "","", 200-150)
    $enable_password = InputBox ("Login", "Enable password?", "","", 200-150)
    $commande = "plink - ssh" & $ip_addr
    Run (@ComSpec & "/ c" & $commande, "", @SW_MAXIMIZE)
    Sleep (500)
    Send ($User)
    Send ("{Enter}")
    Sleep (500)
    Send ($Password)
    Send ("{Enter}")
    Sleep (500)
    Send ("Enable")
    Send ("{Enter}")
    Send ($enable_password)
    Send ("{Enter}")
    Send "(terme len de 0") "
    Send ("{Enter}")
    Send ("see the version")
    Send ("{Enter}")
    Sleep (500)

    ;===> END SCRIPT

    This allows not to let the admin passwords into a file readable in clear on the workstation.

    But the coup-ins me the first script and what I do, is to transform the script en executable with the AUT2EXE.exe utility.

    So passwords are hidden inside "l" executable. And they are no longer visible.

    Then the script launches directly clicking on it without needing the utility 'autoit.exe '. During the generation of the 'executable,
    on can choose its icon.

    So as you understand, I'll let you make your scripts yourself. A first script to make the configuration change, then another pour back
    the configuration in the initial state.

    It goes without saying that to write the scripts correctly! We can well imagine the power of the thing. Create executable files from the scripts
    is a good way to lock their use to a single use. On may, if necessary, make scripts more complex pay allow them to more controls. Let me know if it is necessary.

    The scope of Autoit is huge! Can be used to create complete applications. I will probably have the opportunity again to illustrate it in tea items.

    Want current month.

    Patrick

  • validate if the user has entered at least one element of the page

    The apex Version: Application Express 4.1.0.00.32
    Web browser: Internet Explorer 8
    Oracle DB: 11g Enterprise Edition Release 11.2.0.1.0

    Is there a way to validate whether a user has entered at least one item on a form?

    I have a function:
    function hasPageValues return a Boolean value
    is
    Boolean v_item_found: = false;
    Start

    for rITM in
    (select nom_element
    of apex_application_page_items
    where application_id = Apex_Application.g_flow_id
    and page_id = Apex_Application.g_flow_step_id
    )
    loop
    -the element's value
    If v (rITM.item_name) is not null then
    v_item_found: = true;
    end if;
    end loop;

    Return v_item_found;
    end hasPageValues;

    I call this function returning a Boolean in my posting of the page. It doesn't seem to work. It always returns false. What am I missing and is there a better way to do this type of validation. Sorry I'm new to APEX. Thank you very much!

    SmV says:
    Also, I added the part output in the above code and it still does not work. Always returns false.

    When you have a problem in the APEX you can use debug mode to trace what actually demand. It is advisable to include the code of instrumentation in your program units that will generate useful debugging information. To do this, use apex_debug_message API:

    create or replace function hasPageValues (
        p_app_id  in pls_integer
      , p_page_id in pls_integer)
      return boolean
    is
      v_item_found boolean := false;
    begin
    
      for rITM in (
        select
                  item_name
                , display_as
        from
                  apex_application_page_items
        where
                  application_id = p_app_id
        and       page_id = p_page_id)
      loop
        apex_debug_message.log_message(rITM.item_name || ' (' || rITM.display_as || '): ' || v(rITM.item_name));
        -- does the item have a value
        if v(rITM.item_name) is not null
        then
          apex_debug_message.log_message(rITM.item_name || ' is not null: exit.');
          v_item_found := true;
          exit;
        end if;
      end loop;
    
      apex_debug_message.log_message('hasPageValues = ' || case when v_item_found then 'TRUE' when not(v_item_found) then 'FALSE' else null end);
    
      return v_item_found;
    
    end hasPageValues;
    

    Without data in the page, this gives the following debug trace:

    ...
    0.19096     0.00084     Perform custom validations:
    0.19180     0.00081     ...Validation "hasPageValues" - Type: FUNC_BODY_RETURNING_BOOLEAN
    0.19261     0.09948     ...Execute Statement: declare function x return boolean is begin return hasPageValues(:app_id, :app_page_id); return null; end; begin wwv_flow.g_boolean := x; end;
    0.29213     0.00144     P6_PRODUCT_IMAGE (File Browse...):
    0.29352     0.00082     P6_IMAGE (Display Only):
    0.29434     0.00075     P6_PRODUCT_ID (Hidden):
    0.29509     0.00105     P6_PRODUCT_NAME (Text Field):
    0.29614     0.00083     P6_PRODUCT_DESCRIPTION (Textarea):
    0.29697     0.00104     P6_CATEGORY (Radio Group):
    0.29801     0.00151     P6_PRODUCT_AVAIL (Radio Group):
    0.29952     0.00079     P6_LIST_PRICE (Number Field):
    0.30030     0.00071     hasPageValues = FALSE
    0.30102     0.00066     ......Did NOT pass
    0.30168     0.00080     Add error onto error stack
    0.30249     0.00079     ...Error data:
    0.30327     0.00299     ......message: Page has no values
    

    While with a set of element values, we get:

    0.07573     0.00107     Perform custom validations:
    0.07680     0.00094     ...Validation "hasPageValues" - Type: FUNC_BODY_RETURNING_BOOLEAN
    0.07774     0.00231     ...Execute Statement: declare function x return boolean is begin return hasPageValues(:app_id, :app_page_id); return null; end; begin wwv_flow.g_boolean := x; end;
    0.08005     0.00105     P6_PRODUCT_IMAGE (File Browse...):
    0.08109     0.00077     P6_IMAGE (Display Only):
    0.08187     0.00094     P6_PRODUCT_ID (Hidden):
    0.08281     0.00074     P6_PRODUCT_NAME (Text Field):
    0.08354     0.00087     P6_PRODUCT_DESCRIPTION (Textarea):
    0.08442     0.00072     P6_CATEGORY (Radio Group):
    0.08514     0.00067     P6_PRODUCT_AVAIL (Radio Group): Y
    0.08581     0.00112     P6_PRODUCT_AVAIL is not null: exit.
    0.08693     0.00076     hasPageValues = TRUE
    

    The two that appear to be the expected behaviours. What happens when you do this?

  • IMPDP with creating user

    Hello

    I'm running Oracle XE (10g) and now want to migrate to XE 11 g. For this I want to export my data residing in multiple schemas. My question is if it is possible to export and import my patterns without having to create manually user in the destination database? One of the reasons is I do not know the passwords of all schemas and I don't want to change one of them. If I manually create users in the database of the destination I want to assign new passwords.

    Thanks in advance,

    Habib

    >

    One of the reasons is I do not know the passwords of all schemas and I won't change an any of them

    >

    You can use the EXPORT COMPLETE as Fran said.

    However, you don't have to create passwords if you need to create the same users. You can just copy the passwords of the source

    Run on the source database

    SQL> SELECT USERNAME, PASSWORD from DBA_USERS WHERE USERNAME ='SCOTT';
    
    Then create the users in destination like below
    
    ALTER USER SCOTT identified by values '' ;
    
    SQL> SELECT USERNAME, PASSWORD from DBA_USERS WHERE USERNAME ='SCOTT';
    
    USERNAME                       PASSWORD
    ------------------------------ ------------------------------
    SCOTT                          F894844C34402B67
    
    SQL> alter user scott identified by values 'F894844C34402B67';
    
    User altered.
    
    A simple way is to generate the script
    
    SQL> SELECT 'ALTER USER ' || username || ' IDENTIFIED BY VALUES ' || chr(39) || password || chr(39) ||' ;' from dba_users
            where username in ('SCOTT', 'A', 'B');
    
    (chr(39)  = single quote. Just did it for readability. You can even do it as you normally manipulate quote within strings.
    

    and just run in the target database.

  • Tree of the newly created user table is empty

    Hi all

    I want to create a user who can only select a schema from a prisoner by one user.

    Create user test identified by Test1ng;
    grant create session to test;
    Grant select on a.table1 to test;

    The new user will use sqldeveloper and needs the tables is visible in the tab tables, but after completing the steps above test user when using sqldeveloper will see all the tables in the tab tables.

    Is there way to grant select test user on the tables in the diagram with the visible tables during the user test uses sqldeveloper?

    Thanks in advance

    Hello Hans,.

    A user sees only the tables held under its own Tables node. To see "table1", scroll down to the "Other users" node, and then expand users 'a' and look under this node Tables.

    Kind regards
    Gary
    SQL development team

  • creating user, visible tables on the tab tables sqldeveloper

    Hi all

    I want to create a user who can only select a schema from a prisoner by one user.


    Create user test identified by Test1ng;
    grant create session to test;
    Grant select on a.table1 to test;

    The new user will use sqldeveloper and needs the tables is visible in the tab tables, but after completing the steps above test user when using sqldeveloper will see all the tables in the tab tables.

    Is there way to grant select test user on the tables in the diagram with the visible tables during the user test uses sqldeveloper?

    Thanks in advance

    >

    Hello Hans,.

    as a test user, I am able to select the table using the prefix as below
    Select * from a.account;

    Well, then it is a problem of configuration of SQL Developer - maybe just restart it? Nothing of such a 'reboot' ;)

    Please mark the thread as answered here and move your question on the SQL Developer Forum
    If the problem persists.

    Paul...

  • Error ORA-20987 creating users with apex_util.create_user.

    Hello. I need to copy users from one summit to the other.

    @apex4 is a DBlink apex 4 initial installation, I need to create users on a new server apex4, where I am loged and run this script:


    declare
    users of cursor is
    Select *.
    of apex_040100.wwv_flow_fnd_user@apex4
    where user_name <>'ADMIN ';
    Start
    for you in a loop users
    (. Create_user) APEX_UTIL
    p_user_id = > u.user_id,.
    p_user_name = > u.user_name,
    p_first_name = > u.first_name,
    p_last_name = > u.last_name,
    p_description = > u.description,
    p_email_address = > u.email_address,
    p_web_password = > '1234'.
    p_web_password_format = > 'CLEAR_TEXT');
    end loop;
    end;

    I tried to connect with apex_public_user and sys as sysadmin, but I still get the same error:

    ORA-20987: APEX - unauthorized access (package for the undefined security group variable). -Contact your administrator of the application.
    ORA-06512: en "APEX_040100.WWV_FLOW_ERROR", line 704
    ORA-06512: en "APEX_040100.WWV_FLOW_ERROR", line 1008
    ORA-06512: en "APEX_040100.WWV_FLOW_FND_USER_API", line 24
    ORA-06512: en "APEX_040100.WWV_FLOW_FND_USER_API", line 617
    ORA-06512: en "APEX_040100.HTMLDB_UTIL", linea 1395
    ORA-06512: in linea 8

    Thanks in advance and sorry for my English.

    Published by: Andres Vilallave on 2012-ene-31 12:48

    Published by: Andres Vilallave on 31-ene-2012 12:49

    Hello

    When you run this code?
    If you run this code in SQL client like SQL * Plus or SQL Developer this post might help
    Re: installation of the runtime: how to create users?

    Kind regards
    Jari

    http://dbswh.webhop.NET/dbswh/f?p=blog:Home:0

Maybe you are looking for