PROMPT ==============================================================
PROMPT DBMS name: ORACLE Version 9i R2 9.2.0.8.0
PROMPT Created: 22.06.2009
PROMPT User: SYS
PROMPT Roles: Connect / Resource
PROMPT Usage: Creates DDL for all User of an Database
PROMPT XXXXX
PROMPT Release 3.0.6 Build 007
PROMPT Target Platform xxxxxx
PROMPT ==============================================================
PROMPT SET the Spoolfile
column spool_name new_value S
set termout off
SELECT LOWER(G.global_name)||'_'||
LOWER(U.username)||'_'||
TO_CHAR(SYSDATE,'DD.MM.YYYY') ||'.lst'
spool_name
FROM user_users U,
global_name G
WHERE ROWNUM < 2;
set termout on
spool &S
SELECT U.username||' - '||
G.global_name||' - '||
TO_CHAR(SYSDATE,'DD.MM.YYYY HH24:MI:SS')
START_run_info
FROM user_users U,
global_name G
WHERE ROWNUM < 2;
set head off
set pages 0
set long 9999999
SELECT DBMS_METADATA.get_ddl ('USER', username) || ';' ddl FROM dba_users;
SELECT DBMS_METADATA.get_ddl ('ROLE', role) || ';' ddl FROM dba_roles;
SELECT DBMS_METADATA.get_granted_ddl ('ROLE_GRANT', role) || ';' ddl
FROM role_role_privs;
SELECT DBMS_METADATA.get_granted_ddl ('SYSTEM_GRANT', role) || ';' ddl
FROM role_sys_privs;
SELECT DBMS_METADATA.get_granted_ddl ('OBJECT_GRANT', role) || ';' ddl
FROM role_tab_privs;
SELECT U.username||' - '||
G.global_name||' - '||
TO_CHAR(SYSDATE,'DD.MM.YYYY HH24:MI:SS')
STOP_run_info
FROM user_users U,
global_name G
WHERE ROWNUM < 2;
PROMPT LOGFILE writen : &S
spool off