Try this:
files included:
dup_user.sql
clears.sql
clear_for_spool.sql
Jared
-------------------------------------
-- dup_user.sql
-- can call from command line
-- e.g. @dup_user OLD_USERNAME NEW_USERNAME
-- duplicate a user with a new name, same privs.
-- does NOT move objects
-- you must run the generated file manually
-- you will also have to manually drop the old user
@clears
col colduser new_value uolduser noprint
col cnewuser new_value unewuser noprint
col cspoolfile new_value uspoolfile noprint
prompt Old Username:
set term off feed off
select upper('&1') colduser from dual;
set term on feed on
prompt New Username:
set term off feed off
select upper('&2') cnewuser from dual;
select '_' || lower('&unewuser') || '.sql' cspoolfile from dual;
set term on feed on
@clear_for_spool
spool &uspoolfile
prompt set echo on
select 'create user &unewuser identified by values ' || '''' || password || '''' ||
' default tablespace ' || default_tablespace ||
' temporary tablespace ' || temporary_tablespace || ';'
from dba_users
where username = upper('&uolduser')
/
select 'alter user &unewuser quota ' ||
decode(max_bytes, -1, ' UNLIMITED ', max_bytes ) || ' on ' ||
tablespace_name || ';'
from dba_ts_quotas
where username = upper('&uolduser')
/
select 'grant ' || granted_role || ' to &unewuser;'
from dba_role_privs
where grantee = upper('&uolduser')
union
select 'grant ' || privilege || ' to &unewuser;'
from dba_sys_privs
where grantee = upper('&uolduser')
union
select 'grant ' || privilege || ' on ' || owner || '.' || table_name || ' to
&unewuser;'
from dba_tab_privs
where grantee = upper('&uolduser')
--order by 1, 2, 3, 4, 5
/
prompt set echo off
spool off
@clears
prompt
prompt The file '&uspoolfile' will create the new user '&unewuser'
prompt
-----------------------------------------------------------------------------
-- clears.sql
set pause off
set echo off
set trimspool on
set feed on term on echo off verify off
set line 80
set pages 24 head on
clear col
clear break
clear computes
btitle ''
ttitle ''
btitle off
ttitle off
-------------------
-- clear_for_spool.sql
@@clears
set pages 0 lines 200 term on feed off
----------------------------------------------------------
"Bartolo,
David" To: Multiple recipients of list ORACLE-L
<[EMAIL PROTECTED]>
<bartolo@USCOL cc:
O.edu> Subject: Convert 7.3 users to 8.17 users
Sent by:
[EMAIL PROTECTED]
om
08/28/01 02:07
PM
Please respond
to ORACLE-L
Hi all
Can I take all the users created in a 7.3 database and somehow import them
into a 8.1.7 database
with the original passwords and roles/access to tables?
TIA
David
--
Please see the official ORACLE-L FAQ: http://www.orafaq.com
--
Author: Bartolo, David
INET: [EMAIL PROTECTED]
Fat City Network Services -- (858) 538-5051 FAX: (858) 538-5051
San Diego, California -- Public Internet access / Mailing Lists
--------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from). You may
also send the HELP command for other information (like subscribing).
--
Please see the official ORACLE-L FAQ: http://www.orafaq.com
--
Author:
INET: [EMAIL PROTECTED]
Fat City Network Services -- (858) 538-5051 FAX: (858) 538-5051
San Diego, California -- Public Internet access / Mailing Lists
--------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from). You may
also send the HELP command for other information (like subscribing).