Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Mailing Lists -> Oracle-L -> RE: moving a schema from prod to test (or vice versa) in 8i - no dbms_metadata

RE: moving a schema from prod to test (or vice versa) in 8i - no dbms_metadata

From: Guang Mei <gmei_at_incyte.com>
Date: Fri, 27 Feb 2004 14:30:33 -0500
Message-ID: <NJEDKDKJDGAKAEKKNEEJAEMFCOAA.gmei@incyte.com>


You can use exp/imp, if the schema is not too big. We do this routinely here.

Guang

-----Original Message-----
From: oracle-l-bounce_at_freelists.org
[mailto:oracle-l-bounce_at_freelists.org]On Behalf Of Ben Sent: Friday, February 27, 2004 2:24 PM
To: Oracle-L_at_Freelists. Org
Subject: moving a schema from prod to test (or vice versa) in 8i - no dbms_metadata

Hi

I have often needed to copy a schema to another database so I am working on a script to accomplish this. This could be an entirely new schema on the target database or may require a drop cascade and then recreate. I have checked all the usual web sites and have not found one. Does anyone have one they want to share? My effort so far has produced the following (work in progress ) pseudo script:

select 'create user TOSCHEMA identified by values '''||password||'''   default tablespace TOSCHEMA temporary tablespace TEMP;' from sys.DBA_USERS
where username = 'FROMSCHEMA';

select 'grant '||GRANTED_ROLE||' to TOSCHEMA;' from sys.DBA_ROLE_PRIVS
where grantee = 'FROMSCHEMA';

select 'grant '||PRIVILEGE||' to TOSCHEMA;' from sys.DBA_SYS_PRIVS
where grantee = 'FROMSCHEMA';

select 'alter user TOSCHEMA quota
'||decode(MAX_BYTES,-1,'UNLIMITED',MAX_BYTES)

        ||' on '||TABLESPACE_NAME||';'
from sys.DBA_TS_QUOTAS
where username = 'FROMSCHEMA';

select 'grant '||PRIVILEGE||' on '||OWNER||'.'||TABLE_NAME||' to TOSCHEMA'

     ||decode(GRANTABLE,'YES',' with grant option ;',';') from sys.dba_tab_privs
where grantor='FROMSCHEMA' or grantee = 'FROMSCHEMA';

select 'grant '||PRIVILEGE||' ('||COLUMN_NAME||')'||' on '||OWNER||'.'||TABLE_NAME||
' to TOSCHEMA'||decode(GRANTABLE,'YES',' with grant option ;',';') from sys.dba_col_privs
where grantor='FROMSCHEMA' or grantee = 'FROMSCHEMA';

Thanks,

Ben



Please see the official ORACLE-L FAQ: http://www.orafaq.com

To unsubscribe send email to: oracle-l-request_at_freelists.org put 'unsubscribe' in the subject line.
--
Archives are at http://www.freelists.org/archives/oracle-l/
FAQ is at http://www.freelists.org/help/fom-serve/cache/1.html
-----------------------------------------------------------------

----------------------------------------------------------------
Please see the official ORACLE-L FAQ: http://www.orafaq.com
----------------------------------------------------------------
To unsubscribe send email to:  oracle-l-request_at_freelists.org
put 'unsubscribe' in the subject line.
--
Archives are at http://www.freelists.org/archives/oracle-l/
FAQ is at http://www.freelists.org/help/fom-serve/cache/1.html
-----------------------------------------------------------------
Received on Fri Feb 27 2004 - 13:26:57 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US