Schema Copy/replicate in Same database....

Hello - I have a requirement to copy a schema in same database - with different name. What will be my best options other than export/import.
Schema name: PROD
Schema Size: 120GB
Tablespace: All data of PROD is in PROD_D tablespace only
New Schema name will be: NPROD
Thanks in advance

hi,
If you're worried about the dump size, you may generate it and get a 20Gb size file...
follow instructions from link Compressed dump
... if your schema has only tables, you may use CTAS
Regards
Ignacio
http://oracledisect.blogspot.com

Similar Messages

  • Unable to copy table in same Database

    I m using jdbc:odbc bridge to connect to MS access database. i am trying to create a table by copying data from another table in same database. the code is
    Statement stmt = mycon.createStatement();
    String query = "create table " + temp1 + " as select * from " + temp2;
    stmt.executeUpdate(query);
    But java is throwing exception as:
    java.sql.SQLException: [Microsoft][ODBC Microsoft Acces Driver] Syntax error in
    CREATE TABLE statement.
    Simple create and select are working fine. Is there something like MS Access doesnt support such queries?
    Thanx for help
    Viney

    Hi Viney_yadav,
    First a general suggestion: The error message you got states that is a SQL syntax error. This tells you that you should try running the SQL that is failing directly through Access and correct the syntax problem there. That will help you verify the SQL syntax and avoid any complications related to Java.
    And now some specific help (cut/paste from a previous life): Different DBMS's handle the SELECT INTO... differently. SELECT INTO... in Microsoft Access actually creates a new table. If the table already exists (in Access) then you would use the INSERT INTO..SELECT... statement.
    EXAMPLE to create and populate a new table in Access (sorry didn't test this):
    select temp2.* into temp1 from temp2

  • Oracle Streams setup for multiple schemas in a same database

    We are on 11.1.0.7 and will be using Oracle 11g Streams that will replicate the data real-time for two schemas between the source and target set of schemas with in the same database. We will be doing DDL as well as DML replication.
    I created the following plan and want your inputs. After implementing this, I created a table in SCOTT but it's get replicated to RPT_SCOTT later I tried inserting a row in the table created under SCOTT but that too didn't get replicated to RPT_SCOTT.
    Here are the steps that I used to set up my STREAMS -
    Database Instance:     TESTDB
    Schemas:
         Source:          SCOTT
                   HR
         Target:          RPT_SCOTT
                   RPT_HR
    Configuring Streams:
    1.     Database is in Archive log mode
    2.     Set up the Streams administrator.
    create user STRMADMIN identified by STRMADMIN default tablespace USERS temporary tablespace temp;
    grant resource, dba, AQ_ADMINISTRATOR_ROLE to STRMADMIN;
    BEGIN
    DBMS_STREAMS_AUTH.GRANT_ADMIN_PRIVILEGE(
    grantee => 'STRMADMIN',
    grant_privileges => TRUE);
    END;
    3.     Set up Streams queues
    CONNECT STRMADMIN/****
    BEGIN
    DBMS_STREAMS_ADM.SET_UP_QUEUE(
    queue_name => 'STREAMS_QUEUE',
    queue_table => 'STREAMS_QUETAB',
    queue_user => 'STRMADMIN');
    END;
    4.     Add the Apply rule
    BEGIN
    DBMS_STREAMS_ADM.ADD_SCHEMA_RULES(
    schema_name      => 'RPT_SCOTT',
    streams_type     => 'APPLY',
    streams_name     => 'APPLY_CC_STREAM',
    queue_name          => 'STRMADMIN.STREAMS_QUEUE',
    include_dml     => true,
    include_ddl     => true,
    inclusion_rule     => true,
    source_database     => 'TESTDB');
    END;
    BEGIN
    DBMS_STREAMS_ADM.ADD_SCHEMA_RULES(
    schema_name      => 'RPT_HR',
    streams_type     => 'APPLY',
    streams_name     => 'APPLY_AB_STREAM',
    queue_name          => 'STRMADMIN.STREAMS_QUEUE',
    include_dml     => true,
    include_ddl     => true,
    inclusion_rule     => true,
    source_database     => 'TESTDB');
    END;
    BEGIN
    DBMS_APPLY_ADM.ALTER_APPLY(
    apply_name     => 'APPLY_CC_STREAM',
    apply_user     => 'STRMADMIN');
    END;
    BEGIN
    DBMS_APPLY_ADM.ALTER_APPLY(
    apply_name     => 'APPLY_AB_STREAM',
    apply_user     => 'STRMADMIN');
    END;
    5.     Add the Capture Rule
    CONNECT STRMADMIN/*****
    BEGIN
    DBMS_STREAMS_ADM.ADD_SCHEMA_RULES(
    schema_name     => 'SCOTT',
    streams_type     => 'CAPTURE',
    streams_name     => 'CAPTURE_CC_STREAM',
    queue_name          => 'STRMADMIN.STREAMS_QUEUE',
    include_dml     => true,
    include_ddl     => true,
    inclusion_rule     => true,
    source_database     => 'TESTDB');
    END;
    BEGIN
    DBMS_STREAMS_ADM.ADD_SCHEMA_RULES(
    schema_name     => 'HR',
    streams_type     => 'CAPTURE',
    streams_name     => 'CAPTURE_AB_STREAM',
    queue_name          => 'STRMADMIN.STREAMS_QUEUE',
    include_dml     => true,
    include_ddl     => true,
    inclusion_rule     => true,
    source_database     => 'TESTDB');
    END;
    6.     Set the instantiation system change number (SCN)
    CONNECT STRMADMIN/******
    DECLARE
    source_scn NUMBER;
    BEGIN
    source_scn := DBMS_FLASHBACK.GET_SYSTEM_CHANGE_NUMBER();
    DBMS_APPLY_ADM.SET_SCHEMA_INSTANTIATION_SCN (
    source_schema_name => 'SCOTT',
    source_database_name => 'TESTDB',
    instantiation_scn => source_scn);
    END;
    7.     Start the Apply
    CONNECT STRMADMIN/******
    BEGIN
    DBMS_APPLY_ADM.START_APPLY('APPLY_CC_STREAM');
    END;
    BEGIN
    DBMS_APPLY_ADM.START_APPLY('APPLY_AB_STREAM');
    END;
    8.     Start the Capture
    CONNECT STRMADMIN/******
    BEGIN
    DBMS_CAPTURE_ADM.START_CAPTURE('CAPTURE_CC_STREAM');
    END;
    BEGIN
    DBMS_CAPTURE_ADM.START_CAPTURE('CAPTURE_AB_STREAM');
    END;
    Waiting for your inputs!

    If I understand from your code, you want to do this on the same DB :
    SCOTT --> RPT_SCOTT
    HR  --> RPT_HRSo there is a schema transformation, where is it coded ?
    General info : http://download.oracle.com/docs/cd/B28359_01/server.111/b28321/strms_transform.htm
    More specific on schema rename : http://download.oracle.com/docs/cd/B28359_01/server.111/b28321/strms_mtransform.htm#CHDGDHDE
    Next : where are the initialisation of both capture schema ?
    Missing :
    execute DBMS_CAPTURE_ADM.PREPARE_SCHEMA_INSTANTIATION( schema_name          => 'scott'');
    execute DBMS_CAPTURE_ADM.PREPARE_SCHEMA_INSTANTIATION( schema_name          => 'HR'');This tell Streams from where to capture the SCN.
    Also there is an (WRONG) instantiation of SCOTT for the apply, which tells the apply to consider as valuable candidate all LCR after source_scn,
    but where is the code or RPT_HR. Alas, you put for the APPLY target schema 'SCOTT' while it should have been 'RPT_SCOTT'.
    the fact that is correct or false depends where you put the schema transformation. If you put the transformation at apply time then use the SOURCE schema name (SCOTT, HR) for the LCR will contains their name. If you put the transformation at capture time, then put target schema name for the LCR will contain their name (RPT_HR,RPT_SCOTT).
    Let's say you put the schema transformation at capture time then
    Missing:
    DBMS_APPLY_ADM.SET_SCHEMA_INSTANTIATION_SCN (
    source_schema_name => 'RPT_HR',
    source_database_name => 'TESTDB',
    instantiation_scn => source_scn);If you attache the transformation on the apply process then the code is :
    DBMS_APPLY_ADM.SET_SCHEMA_INSTANTIATION_SCN (
    source_schema_name => 'HR',
    source_database_name => 'TESTDB',
    instantiation_scn => source_scn);And this is useless:
    -- useless code
    BEGIN
    DBMS_APPLY_ADM.ALTER_APPLY(
    apply_name => 'APPLY_CC_STREAM',
    apply_user => 'STRMADMIN');
    END;
    BEGIN
    DBMS_APPLY_ADM.ALTER_APPLY(
    apply_name => 'APPLY_AB_STREAM',
    apply_user => 'STRMADMIN');
    END;
    /Last : You are using the same queue for 2 separated capture/apply transformation.
    Do yourself a favor and give each couple capture/tranform/apply its own queue.

  • Cloning Schema within same database in DG environment

    Hi guys,
    I have a Production database with Data Guard configured (2 physical standbys, one same DC, 2nd other DC). I need to clone a schema (size approx. 380GB) within the same database, ofcourse creating cloned schema with a new name.
    Example:
    ======
    Primary DB: wflprd
    Standby 1: wflprddr1
    Standby 2: wflprddr2
    Source Schema: PegaRules - Size 380 GB
    Desitnation Schema: NewSchema within same database
    what are possible options available? expdp/impdp?
    regards,
    Anjum

    I believe my question is not understood correctly or may be I put the question incorrectly.
    I understand expdp/impdp or exp/imp works but is this the only solution in case of large schema sizes and data guard in place.
    log_archive_dest_1 = LOCATION=/u03/orarch/wflprd, valid_for=(ONLINE_LOGFILE,ALL_ROLES)
    log_archive_dest_2 string service="(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=tcp)(HOST=baswflprddatz02)(PORT=1521)))(CONNECT_DATA=(SERVICE_NAME=wflprddr1_XPT)(INSTANCE_NAME=wflprddr1)(SERVER=dedicated)))", ARCH SYNC NO AFFIRM delay=0 OPTIONAL max_failure=0 max_connections=1 reopen=300 db_unique_name="wflprddr1" register net_timeout=180 valid_for=(online_logfile,primary_role)
    log_archive_dest_3 string service="(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=tcp)(HOST=actwfldredatz01)(PORT=1521)))(CONNECT_DATA=(SERVICE_NAME=wflprddr2_XPT)(INSTANCE_NAME=wflprddr2)(SERVER=dedicated)))", ARCH SYNC NO AFFIRM delay=1440 OPTIONAL max_failure=0 max_connections=1 reopen=300 db_unique_name="wflprddr2" register net_timeout=180 valid_for=(online_logfile,primary_role)
    Objective: We have one big schema containing data of three different customers. We are segregating that big schema into different schemas, one for each customer. So, once schema is cloned within same database, irrelavent data is cleaned.
    regards,
    Anjum

  • How copy the same project with its database schema & deploy it on same PC?

    Hi,
    Firstly, sorry about my forum handle. For some odd reason all the handles that I am trying to create are already in use.
    Right, I am a new Application Express Developer and am managing my own Oracle Database Instance as well. I have managed to create a complete project and I have another client who requires the same project. What is the logic and steps that I can use in making a complete copy of the existing project and use it for my second client. The databse objects would be the same.
    My initial thoughts are to create another database schema as a copy of the current database schema and then do an import/export of the existing project so that the new copy will work with the new schema? I am just talking on top of my head here. I am not a DBA and being new to Application Express administration does not help much either as well.
    Thanks for reading my message.
    Shahzad
    Edited by: user10818643 on 05-Aug-2009 08:49

    Virtual private database basically works by modifying your existing query.
    So you have a table with your clients and a code for each client
    So when client A logs in, he uses an application_context to set his code.
    You have to write the procedure to set the context.
    Now , what you need to do, is to modify your tables so that you can join to your client_code table based on client_code.
    So when client A runs his code, he only sees his own data. When Client B runs he only sees his Data.
    But you , if you run as sysdba can see both sets of data.
    Check out http://asktom.oracle.com and the oracle docs. Oracle expert one on one has a good section on this two (by tom kyte too)
    You really want to satisfy yourself that this is the solution you want. Do the queries run slower. Well, it depends on how well you implement fgac. If implemented well, it will be marginally slower but you will have far less maintenance than an alternative implementation. The big advantage is adding additional clients has virtually no extra workload for you.
    I think you may need to use database account authentication for this to work with Apex. I'm really not sure.
    I suggest you read up on this, and maybe try and set up a 3 table demo app with it. That way you can see whether or not its for you.

  • Is it possible to copy the same database multiple times simultaneously?

    This is the setup of my environment.
    I have a 'master' database that contains the full schema plus some pre-populated data such as default settings. When database schema changes are made, they get made to the master database. When a new customer signs up for the service, I make a copy of this
    master database (using SMO) that will now be the database containing all of the customer's information. The database is rather large, and the copy operation can take a couple minutes.
    Everything works fine as expected, unless I try to provision two new customers at the same time. It appears that Azure only allows for one DB copy operation at a time. Is there a way to allow for copying the same database multiple times simultaneously?
    Thanks for you input. I understand that this is likely not the optimal setup, and that there is many better ways of doing this, but I am somewhat heavily invested in the current process and I would like to find out how to make it work if I can.

    BTW, you can do this programatically by using PowerShell (https://msdn.microsoft.com/en-us/library/ee210569.aspx), SqlPackage (http://www.benday.com/2012/12/18/deploy-a-sql-server-database-projects-dacpac-with-sqlpackage-exe/)
    or the SQL Server binaries for .NET (http://www.vijayt.com/Post/Deploying-a-data-tier-application-in-SQL-Azure-programatically)
    Hope this helps.
    Alex

  • Performance slows down when moving from stage to test schema within same instance with same database table and objects

    We have created a stage schema and tested application which is working fine when we are moving it to another schema for further testing ( This schema is created using same scripts which were used to create objects in staging schema) the performanc of application (Developed in .NET) slows down drastically
    Some of the store procedures we have checked at Databse/SQLdeveloper level are giving almost same performance but at Application level there is lot of difference
    Can you please help
    We are using Oracke 11g Database

    Are you using the Database Cloud Service?  You cannot create schemas in the Database Cloud Service, which makes me think you are not.  This forum is only for the Database Cloud Service.
    - Rick Greenwald

  • Different schema on same database

    i have 2 schemas in the same database, i create a table in one schema and can access the same table from the other schema without grant option. For eg, i create one table 'emp' in one schema 'schema1' like:
    create table emp(no number);
    Now, from the other schema, schema2, i can access this table data using the following select statement :
    select * from schema1.emp;
    without first giving the grant on the table from 'schema1' like this:
    grant select on emp to schema2.
    Please help in solving my doubt as i need it resolved urgently.

    Have you (perhaps mistakenly) granted a user the SELECT ANY TABLE privilege?
    Justin
    Distributed Database Consulting, Inc.
    http://www.ddbcinc.com/askDDBC

  • Creating a database link to another schema in the same database

    Hello,
    I'm trying to create a database link to another schema in the same database. It was created without errors, but when I try to use it I receive "ORA-12154: TNS:could not resolve the connect identifier specified" message...
    I'm trying to do it because on my production enviroment the databases are separated, so there I can use database links without problem, but in my development environment it's all in one database separated by schemas...
    So I'm trying to simulate the same system to not need to rewrite the query every time I move from development to production environment.
    Any ideas?
    Thanks

    Hi,
    Yes, you can create a database link to your own database. I've done it before for exactly the same reason you want to.
    (By the way, I think it's a good reason. What are the alternatives?
    Having different versions of code for Development and Production? Absolutely not! Terrible idea!
    Using synonyms or substitution variables that are set differently in the different databases? That might be more efficient than a database link, but efficiency probably isn't such a big issue in Development.
    [Conditional compilation|http://download.oracle.com/docs/cd/B28359_01/appdev.111/b28370/fundamentals.htm#sthref250]? This might be good; it has all the efficienty of the above options, with more clarity.)
    Assuming you do want to stick with a database link, not all errors are caught when you create the link.
    Is the Development database in the tnsnames.ora file of the Development server? Do you have other database links, either in the Development server or pointing to it, that work? What is different about the ones that work, and the one that doesn't?
    Edited by: Frank Kulash on Oct 14, 2009 1:58 PM
    The more I think about this, the more I agree with the earlier respondent: synonymns are a good solution for this.
    To that suggestion you replied:
    On this way I might use "select * from SCHEMA.table" instead of "select * from table@SCHEMA"... I looking for an option to use the second way...Actually, the suggestion was that you say:
    select  *
    from    SCHEMA_table_ptr;where schema_table_ptr is a synonym.
    In Development, that synonym is defined as schema.table.
    In Production, that synonym is defined as table@SCHEMA
    Why are you "looking for an option to use the second way"?
    If you think that people reading the code should realize that the query is being done via a database link (at least in Production), then add a comment.

  • Cloning a schema using transportable tablespace in same database?

    In 10g r2, is it possible to clone the schema in same database using transport tablespace?
    sample syntax
    impdp USERID=<TargetConnection> DIRECTORY=NHS_DIR Remap_Schema=TESTA:TESTB
    TRANSPORT_DATAFILES='<TargetDataFile>' DumpFile=<DumpFileName> logfile=<LogFileName>

    >
    In 10g r2, is it possible to clone the schema in same database using transport tablespace?
    sample syntax
    impdp USERID=<TargetConnection> DIRECTORY=NHS_DIR Remap_Schema=TESTA:TESTB
    TRANSPORT_DATAFILES='<TargetDataFile>' DumpFile=<DumpFileName> logfile=<LogFileName>
    >
    Well, why not simply test that yourself? You seem to know the command already. It is possible but with some effort:
    You have to rename the original tablespace before importing it back. Also, you have to create the user testb with the appropriate privileges. The datafile that you import has to be renamed also, because a file with that name already belongs to the database.
    Kind regards
    Uwe
    http://uhesse.wordpress.com

  • Conn generating link ddl but schema in same database

    i have a connector which associates 2 locations in the same database. when i deploy the connector, it generates link ddl. when i deploy my mapping it uses that link. i can't get the mapping to generate schema.table_name.
    any help would be appreciated.
    i've searched the forum and gone through the docs. i don't know what i'm doing wrong.

    Chandra,
    Such document is always one and the same with all Oracle products - a User Guide that ships with a product and is available online http://www.oracle.com/technology/documentation/warehouse.html The User Guide is searchable and indexed. Look up "register locations" and you'll find "Registering Locations" section in Chapter 13 (of OWB 10g User Guide) with step-by-step instructions.
    Nikolai Rochnik

  • DBlink between two schema on the same database.

    Hello,
    I am facing a troublesome situation here regarding a database link. Usually I create my db links between two databases hosted on two different servers but in this current situation, am in short of machines. The database informations are contained in two different schema that were suppoded to be imported on two different databases(servers). As only one machine is available,I would like to know given the situation, whether I can create two schemas on the same database and link both schema using a database link. Is it possible? If yes, how do I achieve that?
    Thanks in advance.

    adomi wrote:
    Hello,
    I am facing a troublesome situation here regarding a database link. Usually I create my db links between two databases hosted on two different servers but in this current situation, am in short of machines. The database informations are contained in two different schema that were suppoded to be imported on two different databases(servers). As only one machine is available,I would like to know given the situation, whether I can create two schemas on the same database and link both schema using a database link. Is it possible? If yes, how do I achieve that?
    Thanks in advance.Cann't understand you. If you transfer data between two databases, then use database link. If you use only one database, then you don't need to use database link. Please elaborate more

  • Same database different schemas on 9i

    Hi,
    Am trying to set up a simple replication from hr.jobs to tgt.jobs within the same database.
    For a particular reason I am having to do this on 9.2.8.0
    Question is: is this possible on 9i as I cannot use dbms_streams_adm.rename_schema (correct me if wrong) and I can't see how I can write to a queue from hr.jobs then dequeue this as tgt.jobs using an apply process.
    Am writing to one queue. I have a capture and apply process (no propagation - something I picked up from a forum). I have one default Queue.
    Am new to streams so all help and pointers welcome.
    TIA
    S.

    HI,
    Thanks. Have seem first link. Second one is new and points to metalink note.......by chance I have just found (on this forum) a reference to a metalink note.
    Looks like I need to write transformation rules pre-10g
    If not would like to hear....
    Thanks.

  • Oracle Streaming in same database - 10g

    Oracle Streaming in 10g database
    Posted: Sep 21, 2006 4:25 AM Reply
    Hello,
    I am trying do streaming at table level for all dml changes from one schema(source) to another schema (target) controlled by admin schema (stream_admin). I have all these schemas in same database(10g-enterprise edition).
    As given in documentations , I created
    1. two queues(in_Q and out_Q) in Stream_admin,
    2. two process( capture and apply process) in Stream_admin ,
    3. A propagation rule for propagation between in_Q and out_Q,
    4. did instantiation,
    5. started both capture and apply process.
    Having done that , I insert in source table and check for the same in target but alas!! nothing happens. I fail to achieve streaming.
    I am not getting any error. Neither in process , nor in propagation or queues. And all queues,rules and process are enabled.
    Please help.

    datapump uses dbms_metadata extensively.
    Problem is twofold
    - the amount of data
    - why on earth do you need to 'copy' these 1.2 Tb a 'number of times'
    One would expect you would have tested the upgrade on a smaller test database. and you wouldn't need to fix bugs in a 1.2 Tb database.
    A better idea would be to duplicate the complete database using RMAN. This doesn't perform conventional INSERTs and doesn't create redo.
    Sybrand Bakker
    Senior Oracle DBA

  • Export & Import in the same DataBase

    Hi,
    I'm trying to export and import in the same DataBase but in different User/Tablespace, the imp procces create the objects in the same Tablespace of the export. What can I do to create a copy of a schema in the same database?
    Thanks. JEA

    I am not sure if I am reading your question correctly, Create a new user in your database.
    Use the command line (DOS) command 'exp80 username/password@hoststring'
    there are a number of parameters here, you can find their meanings online if you search for 'export ORACLE command line parameters', I don't know what your requirements are but you have to set the FILE parameter with the name of the file you wish to store your output in(ext should be .dmp).
    To import, use imp80 and log on as the new user you created then the following parameters need to be set:
    File= your file name
    SHOW = n
    IGNORE = n
    GRANTS = y
    ROWS = y
    FROMUSER = old user name
    TOUSER = new user name
    TABLES = *
    I hope this helps.
    SE

Maybe you are looking for

  • Itunes will not install on windows 7 home

    Any one had this issue Itunes will not install on windows 7 home

  • [URGENT]:Service PO and PO matching

    Hi, For a service PO, should I select the value basis as Amount and the Purchase basis as Services? If I select this combination, then the price is fixed as 1, and the quantity can be changed. Should we enter the PO line using this combination,and pu

  • My itunes starts displaying weird fonts for song titles and app names. Help?

    Need help to change them back to normal, I realize if I double click songs and movies, the titles goes back to normal english text. However, I can't "RUN" an itune App to change the text back. And I do have more songs that are all messed up text. Any

  • Flash for Linux?

    The latest Flash Player for Linux has major version 7. More and more Websites exist for which version 7 is not sufficient anymore. Are newer versions of the Flash Player ported to Linux? If so, does anybody know any release date?

  • Future price vs. average price / material expenses in COPA

    Hello, at the moment we have some trouble with the material input in the COPA for merchandise. Normally the material input for it should be the average price from the material master. After having analysed some missing costs for material input we hav