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
Similar Messages
-
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 DatabaseAre 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 -
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 -
Oracle troubles with multiple schemas in same database
We have several different users set up with individual schemas in the
same Oracle database. We run into trouble when more than one user tries
to use Kodo in their local schema. Things go fine for User A, but when
the User B tries to run the schematool on their own Oracle schema, they
get this nonsense:
javax.jdo.JDOFatalDataStoreException: An error occurred while connecting
to the data store.
NestedThrowables:
com.solarmetric.kodo.impl.jdbc.sql.SQLExceptionWrapper: [SQL=SELECT
DISTINCT JDO_SCHEMA_METADATAX.CLASSNAMEX FROM JDO_SCHEMA_METADATAX]
ORA-00942: table or view does not exist
at
com.solarmetric.kodo.impl.jdbc.schema.SchemaTool.<init>(SchemaTool.java:99)
at
com.solarmetric.kodo.impl.jdbc.schema.SchemaTool.main(SchemaTool.java:1114)
at
com.solarmetric.kodo.impl.jdbc.schema.SchemaTool.main(SchemaTool.java:1083)
at
com.solarmetric.kodo.impl.jdbc.schema.SchemaTool.main(SchemaTool.java:1073)
at
com.solarmetric.kodo.impl.jdbc.schema.SchemaTool.main(SchemaTool.java:1064)
If the User A drops all the tables from their schema, then things go
fine for User B ... but then User A will have the same problem when they
try to run the schematool.
It is our suspicion that Kodo is actually selecting the metadata all of
the tables in **everybody's** schemas, and thus erroneously thinking
that jdo_schema_medatax already exists. It really ought to restrict
itself to the schema it's actually connected to.
If our theory is correct, it would explain why Kodo is so incredibly,
horribly, painfully slow to connect to our Oracle database -- we have
dozens of schemas in there, many of which have hundreds of tables.
Is 2.3.0 addressing this problem?
PaulPaul,
Are you using the 'schema-name' system preference setting for each user?
Oracle's mechanism for selecting database metadata requires that the
appropriate schema name be explicitly when more than one schemas are used.
See the database setup section of our documentation for more information.
-Patrick
On 7/3/02 3:50 PM, "Paul Cantrell" <[email protected]> wrote:
We have several different users set up with individual schemas in the
same Oracle database. We run into trouble when more than one user tries
to use Kodo in their local schema. Things go fine for User A, but when
the User B tries to run the schematool on their own Oracle schema, they
get this nonsense:
javax.jdo.JDOFatalDataStoreException: An error occurred while connecting
to the data store.
NestedThrowables:
com.solarmetric.kodo.impl.jdbc.sql.SQLExceptionWrapper: [SQL=SELECT
DISTINCT JDO_SCHEMA_METADATAX.CLASSNAMEX FROM JDO_SCHEMA_METADATAX]
ORA-00942: table or view does not exist
at
com.solarmetric.kodo.impl.jdbc.schema.SchemaTool.<init>(SchemaTool.java:99)
at
com.solarmetric.kodo.impl.jdbc.schema.SchemaTool.main(SchemaTool.java:1114)
at
com.solarmetric.kodo.impl.jdbc.schema.SchemaTool.main(SchemaTool.java:1083)
at
com.solarmetric.kodo.impl.jdbc.schema.SchemaTool.main(SchemaTool.java:1073)
at
com.solarmetric.kodo.impl.jdbc.schema.SchemaTool.main(SchemaTool.java:1064)
If the User A drops all the tables from their schema, then things go
fine for User B ... but then User A will have the same problem when they
try to run the schematool.
It is our suspicion that Kodo is actually selecting the metadata all of
the tables in **everybody's** schemas, and thus erroneously thinking
that jdo_schema_medatax already exists. It really ought to restrict
itself to the schema it's actually connected to.
If our theory is correct, it would explain why Kodo is so incredibly,
horribly, painfully slow to connect to our Oracle database -- we have
dozens of schemas in there, many of which have hundreds of tables.
Is 2.3.0 addressing this problem?
Paul
Patrick Linskey [email protected]
SolarMetric Inc. http://www.solarmetric.com -
Data comparison and update/insert between two schemas in same database
Hi all,
I have requirement like this. In one database, i am having two users, user1 and user2. Both users is having same tables and structure wise also same. In user1, data will be populated by job.
Now, what i want to do is, i have to find out difference between user1 and user2 data and the Difference data will be updated/inserted into the user2.
Any ideas please...
Thanks in advance,
PalWill trigger help you ... ie. for every update/insert on user1 will do on user2-- it is heavy to do for all table...
--svmg -
How to create table in another schema of same database
Hi..
I've a database DB1
and has 2 schemas / USers in that..
Usr1 and Usr2...
And i created a TEMP table in Usr1 schema... and created
Then tried the following statement in Usr2 schema...
CREATE TABLE TEMP AS SELECT * FROM Usr1.TEMP;
Then it's giving error that ...
:00942 TABLE OR VIEW DOESN'T EXIST..
What is the reason for that...
Thank youjosh1612 wrote:
What other grants do i need to give so as to replicate the Primary Keys also...????That's not a matter of grants. It's the way the CREATE TABLE AS SELECT statement works. It does not copy over indexes, primary key constraints, unique constraints, foreign key constraints, etc.
If you want to copy all that over, you would probably want to get the DDL from the original table (using the DBMS_METADATA package if you're in a recent version), modify the DDL with the new schema name, create the table, indexes, and constraints, and then do an INSERT ... SELECT to populate the data. Or do an export & import of the table from one schema to another.
Justin -
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 -
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 advancehi,
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 -
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 -
Call Class within the Database
I don't know if this is the right place to post, but. I'm trying to create an Applet that references a JAVA class stored in the database. My code looks something like this:
<applet code="Hello.class" codebase="http://www.somesite.com/pls/dad/" width="150" height="30"></applet>
Hello.class is stored within a 10g database. The codebase is a vitural url that connects to a schema within the database. Can this be done?? and How??Please elaborate. I believe the answer is yes, but it's not entirely clear what you mean.
- Phil -
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?
ThanksHi,
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. -
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. -
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. -
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
Maybe you are looking for
-
Catch the onClick event on Interactive Report to access columns content
Hi, I am using Apex 4 I would like to display some rows into an interactive report. I have define a dynamic action on that report in order to catch the Mouse OnClick Event. The Goal is to display the detail of the row in a form region in the sidebar.
-
How can I type Vietnamese in the text box of the report.
-
I could not understand the info on the action of tabs. I followed instructions to set "open in existing window" but messages still show up in tabs along the top. I have trouble finding my inbox. Thank you, Martha
-
"Root device is read only"-?
Hi! I want to test my RAM using Memtest and start the Mac in Single user mode. But at the bottom of a long text, it says "Singleuser boot -- fsck not done Root device is mounted read-only" What does this mean, and how can I change it? OS 10.6.4 Kind
-
Do not apply Templates for dynamic page
Hi, When i add a tag <ORACLE> ...</ORACLE> then all code before this tag don't displate.(I have viewed source after apply template but did't see code before Oracle tag). Could you tell me the way to sovle the problem. thanks ! thangtk