Replication For Partitioned Table
Well , I have a partitioned Table having partition on Date Field. Table Contains composite primary Key Date Field + Connection Id . Table Contains approx 30 Million Records.
Now when i m goin for replication setup , created materialized view on the basis of primary key , the fast refresh process takin time approx 3 hrs for refreshing 80,000 records on LAN environment.
Before partitioning this table the same refresh was taking only 20 Minutes.
can any body help me out to fasten up the refresh ?
What version of oracle are you using? What type of partitioning you are using on the table? Is the materialized view partitioned? What type of refresh mechanism are you using?(REFRESH FAST or REFRESH FORCE or REFRESH COMPLETE)? Is it ON DEMAND or ON COMMIT?
Similar Messages
-
Extract DDL for Partitioned tables in Oracle 8i
Hi
I am currently working on an Oracle 8i database. I have a need to extract the DDL of the existing tables & indexes. Dont need a schema level DDL extract, i just need it for a couple of tables and the corresponding indexes. I am currently using PL/SQL Developer a third party tool which is okay for extracting DDL for Non Partitioned tables, but when it comes to getting the DDL for PARTITIONED tables, it doesnt give me the partition information nor the tablespace information. We dont have a license for Toad or any other tools to get the DDL's. I also dont have the export/import privs on the DB. I need a free ware that can give me the DDL for the existing partitioned tables or atleast a query that I can run against the regular DBA views, which can give me the DDL along with Storage clause, the tablespace, indexes, grants & constraints.
Thanks in Advance
ChandraI also dont have the export/import privs on the DB. I need a
free ware that can give me the DDL for the existing
partitioned tables or atleast a query that I can run
against the regular DBA views, which can give me the
DDL along with Storage clause, the tablespace,
indexes, grants & constraints.But you (or the owner or the tables you connect with) should have export/import privs on its on tables (i.e the two tables). So use the User Views instead of DBA Views.
USER_TABLES, USER_TAB_PARTITIONS etc -
Auto stats gathering for partitioned table
Hi,
We are in 10gR2 in sun solaris. We are using auto stats gathering for our DB. Here is my question,
i know oracle gather statistics of the table, if the table changes more than 10%. How this work out for partitioned table? If the partition table changes more than 10% will last partition analyzed or the full table. We have partitioned based on insertion date.
Appreciate your responds.
Regards,
Satheesh Shanmugam
http://borndba.comI hope it will be only current partition which has teh stale statistics will be gathered the stastics instead of full table.
Anil Malkai -
CTAS using dbms_metadata.get_ddl for Partitioned table
Hi,
I would like to create a temporary table from a partitioned table using CTAS. I plan to use the following steps in a PL/SQL procedure:
1. Use dbms_metadata.get_ddl to get the script
2. Use raplace function to change the tablename to temptable
3. execute the script to get the temp table created.
SQL> create or replace procedure p1 as
2 l_clob clob;
3 str long;
4 begin
5 SELECT dbms_metadata.get_ddl('TABLE', 'FACT_TABLE','USER1') into l_clob FROM DUAL;
6 dbms_output.put_line('CLOB Length:'||dbms_lob.getlength(l_clob));
7 str:=dbms_lob.substr(l_clob,dbms_lob.getlength(l_clob),1);
8 dbms_output.put_line('DDL:'||str);
9 end;
12 /
Procedure created.
SQL> exec p1;
CLOB Length:73376
DDL:
PL/SQL procedure successfully completed.
I cannot see the DDL at all. Please help.Thanks Adam. The following piece of code is supposed to do that. But, its failing because the dbms_lob.substr(l_clob,4000,4000*v_intIdx +1); is putting newline and therefore dbms_sql.parse
is failing.
Please advice.
create table my_metadata(stmt_no number, ddl_stmt clob);
CREATE OR REPLACE package USER1.genTempTable is
procedure getDDL;
procedure createTempTab;
end;
CREATE OR REPLACE package body USER1.genTempTable is
procedure getDDL as
Description: get a DDL from a partitioned table and change the table name
Reference: Q: How Could I Format The Output From Dbms_metadata.Get_ddl Utility? [ID 394143.1]
l_clob clob := empty_clob();
str long;
l_dummy varchar2(25);
dbms_lob does not have any replace function; the following function is a trick to do that
procedure lob_replace( p_lob in out clob, p_what in varchar2, p_with in varchar2 )as
n number;
begin
n := dbms_lob.instr( p_lob, p_what );
if ( nvl(n,0) > 0 )
then
dbms_lob.copy( p_lob,
p_lob,
dbms_lob.getlength(p_lob),
n+length(p_with),
n+length(p_what) );
dbms_lob.write( p_lob, length(p_with), n, p_with );
if ( length(p_what) > length(p_with) )
then
dbms_lob.trim( p_lob,
dbms_lob.getlength(p_lob)-(length(p_what)-length(p_with)) );
end if;
end if;
end lob_replace;
begin
DBMS_METADATA.SET_TRANSFORM_PARAM(DBMS_METADATA.SESSION_TRANSFORM,'STORAGE',false);
DBMS_METADATA.SET_TRANSFORM_PARAM(DBMS_METADATA.SESSION_TRANSFORM,'SEGMENT_ATTRIBUTES',false);
DBMS_METADATA.SET_TRANSFORM_PARAM (DBMS_METADATA.SESSION_TRANSFORM,'SQLTERMINATOR',true);
DBMS_METADATA.SET_TRANSFORM_PARAM (DBMS_METADATA.SESSION_TRANSFORM,'SEGMENT_ATTRIBUTES',false);
execute immediate 'truncate table my_metadata';
-- Get DDL
SELECT dbms_metadata.get_ddl('TABLE', 'FACT','USER1') into l_clob FROM DUAL;
-- Insert the DDL into the metadata table
insert into my_metadata values(1,l_clob);
commit;
-- Change the table name into a temporary table
select ddl_stmt into l_clob from my_metadata where stmt_no =1 for update;
lob_replace(l_clob,'"FACT"','"FACT_T"');
insert into my_metadata values(2,l_clob);
commit;
-- execute immediate l_clob; <---- Cannot be executed in 10.2.0.5; supported in 11gR2
DBMS_METADATA.SET_TRANSFORM_PARAM(DBMS_METADATA.SESSION_TRANSFORM,'DEFAULT');
end getDDL;
Procedure to create temporary table
procedure createTempTab as
v_intCur pls_integer;
v_intIdx pls_integer;
v_intNumRows pls_integer;
v_vcStmt dbms_sql.varchar2a;
l_clob clob := empty_clob();
l_str varchar2(4000);
l_length number;
l_loops number;
begin
select ddl_stmt into l_clob from my_metadata where stmt_no=2;
l_length := dbms_lob.getlength(l_clob);
l_loops := ceil(l_length/4000);
for v_intIdx in 0..l_loops loop
l_str:=dbms_lob.substr(l_clob,4000,4000*v_intIdx +1);
l_str := replace(l_str,chr(10),'');
l_str := replace(l_str,chr(13),'');
l_str := replace(l_str,chr(9),'');
v_vcStmt(v_intIdx) := l_str;
end loop;
for v_intIdx in 0..l_loops loop
dbms_output.put_line(v_vcStmt(v_intIdx));
end loop;
v_intCur := dbms_sql.open_cursor;
dbms_sql.parse(
c => v_intCur,
statement => v_vcStmt,
lb => 0,
--ub => v_intIdx,
ub => l_loops,
lfflg => true,
language_flag => dbms_sql.native);
v_intNumRows := dbms_sql.execute(v_intCur);
dbms_sql.close_cursor(v_intCur);
end createTempTab;
end;
/ -
Partition pruning not working for partitioned table joins
Hi,
We are joining 4 partitioned tables on partition column & other key columns. And we are filtering the driving table on partition key. But explain plan is showing that all tables except the driving table are not partition pruning and scanning all partitions.Is there any limitation that filter condition cannot be dynamic?
Thanks a lot in advance.
Here are the details...
SELECT a.pay_prd_id,
a.a_id,
a.a_evnt_no
FROM b,
c,
a,
d
WHERE ( a.pay_prd_id = b.pay_prd_id ---partition range all
AND a.a_evnt_no = b.b_evnt_no
AND a.a_id = b.b_id
AND ( a.pay_prd_id = c.pay_prd_id---partition range all
AND a.a_evnt_no = c.c_evnt_no
AND a.a_id = c.c_id
AND ( a.pay_prd_id = d.pay_prd_id---partition range all
AND a.a_evnt_no = d.d_evnt_no
AND a.a_id = d.d_id
AND (a.pay_prd_id = ---partition range single
CASE '201202'
WHEN 'YYYYMM'
THEN (SELECT min(pay_prd_id)
FROM pay_prd
WHERE pay_prd_stat_cd = 2)
ELSE TO_NUMBER ('201202', '999999')
END
DDLs.
create table pay_prd
pay_prd_id number(6),
pay_prd_stat_cd integer,
pay_prd_stat_desc varchar2(20),
a_last_upd_dt DATE
insert into pay_prd
select 201202,2,'OPEN',sysdate from dual
union all
select 201201,1,'CLOSE',sysdate from dual
union all
select 201112,1,'CLOSE',sysdate from dual
union all
select 201111,1,'CLOSE',sysdate from dual
union all
select 201110,1,'CLOSE',sysdate from dual
union all
select 201109,1,'CLOSE',sysdate from dual
CREATE TABLE A
(PAY_PRD_ID NUMBER(6) NOT NULL,
A_ID NUMBER(9) NOT NULL,
A_EVNT_NO NUMBER(3) NOT NULL,
A_DAYS NUMBER(3),
A_LAST_UPD_DT DATE
PARTITION BY RANGE (PAY_PRD_ID)
INTERVAL( 1)
PARTITION A_0001 VALUES LESS THAN (201504)
ENABLE ROW MOVEMENT;
ALTER TABLE A ADD CONSTRAINT A_PK PRIMARY KEY (PAY_PRD_ID,A_ID,A_EVNT_NO) USING INDEX LOCAL;
insert into a
select 201202,1111,1,65,sysdate from dual
union all
select 201202,1111,2,75,sysdate from dual
union all
select 201202,1111,3,85,sysdate from dual
union all
select 201202,1111,4,95,sysdate from dual
CREATE TABLE B
(PAY_PRD_ID NUMBER(6) NOT NULL,
B_ID NUMBER(9) NOT NULL,
B_EVNT_NO NUMBER(3) NOT NULL,
B_DAYS NUMBER(3),
B_LAST_UPD_DT DATE
PARTITION BY RANGE (PAY_PRD_ID)
INTERVAL( 1)
PARTITION B_0001 VALUES LESS THAN (201504)
ENABLE ROW MOVEMENT;
ALTER TABLE B ADD CONSTRAINT B_PK PRIMARY KEY (PAY_PRD_ID,B_ID,B_EVNT_NO) USING INDEX LOCAL;
insert into b
select 201202,1111,1,15,sysdate from dual
union all
select 201202,1111,2,25,sysdate from dual
union all
select 201202,1111,3,35,sysdate from dual
union all
select 201202,1111,4,45,sysdate from dual
CREATE TABLE C
(PAY_PRD_ID NUMBER(6) NOT NULL,
C_ID NUMBER(9) NOT NULL,
C_EVNT_NO NUMBER(3) NOT NULL,
C_DAYS NUMBER(3),
C_LAST_UPD_DT DATE
PARTITION BY RANGE (PAY_PRD_ID)
INTERVAL( 1)
PARTITION C_0001 VALUES LESS THAN (201504)
ENABLE ROW MOVEMENT;
ALTER TABLE C ADD CONSTRAINT C_PK PRIMARY KEY (PAY_PRD_ID,C_ID,C_EVNT_NO) USING INDEX LOCAL;
insert into c
select 201202,1111,1,33,sysdate from dual
union all
select 201202,1111,2,44,sysdate from dual
union all
select 201202,1111,3,55,sysdate from dual
union all
select 201202,1111,4,66,sysdate from dual
CREATE TABLE D
(PAY_PRD_ID NUMBER(6) NOT NULL,
D_ID NUMBER(9) NOT NULL,
D_EVNT_NO NUMBER(3) NOT NULL,
D_DAYS NUMBER(3),
D_LAST_UPD_DT DATE
PARTITION BY RANGE (PAY_PRD_ID)
INTERVAL( 1)
PARTITION D_0001 VALUES LESS THAN (201504)
ENABLE ROW MOVEMENT;
ALTER TABLE D ADD CONSTRAINT D_PK PRIMARY KEY (PAY_PRD_ID,D_ID,D_EVNT_NO) USING INDEX LOCAL;
insert into c
select 201202,1111,1,33,sysdate from dual
union all
select 201202,1111,2,44,sysdate from dual
union all
select 201202,1111,3,55,sysdate from dual
union all
select 201202,1111,4,66,sysdate from dualBelow query generated from Business Objects and submitted to Database (the case statement is generated by BO). Cant we use Case/Subquery/Decode etc for the partitioned column? We are assuming that the case causing the issue to not to dynamic partition elimination on the other joined partitioned tables (TAB_B_RPT, TAB_C_RPT).
SELECT TAB_D_RPT.acvy_amt,
TAB_A_RPT.itnt_typ_desc,
TAB_A_RPT.ls_typ_desc,
TAB_A_RPT.evnt_no,
TAB_C_RPT.pay_prd_id,
TAB_B_RPT.id,
TAB_A_RPT.to_mdfy,
TAB_A_RPT.stat_desc
FROM TAB_D_RPT,
TAB_C_RPT fee_rpt,
TAB_C_RPT,
TAB_A_RPT,
TAB_B_RPT
WHERE (TAB_B_RPT.id = TAB_A_RPT.id)
AND ( TAB_A_RPT.pay_prd_id = TAB_D_RPT.pay_prd_id -- expecting Partition Range Single, but doing Partition Range ALL
AND TAB_A_RPT.evnt_no = TAB_D_RPT.evnt_no
AND TAB_A_RPT.id = TAB_D_RPT.id
AND ( TAB_A_RPT.pay_prd_id = TAB_C_RPT.pay_prd_id -- expecting Partition Range Single, but doing Partition Range ALL
AND TAB_A_RPT.evnt_no = TAB_C_RPT.evnt_no
AND TAB_A_RPT.id = TAB_C_RPT.id
AND ( TAB_A_RPT.pay_prd_id = fee_rpt.pay_prd_id -- expecting Partition Range Single
AND TAB_A_RPT.evnt_no = fee_rpt.evnt_no
AND TAB_A_RPT.id = fee_rpt.id
AND (TAB_A_RPT.rwnd_ind = 'N')
AND (TAB_A_RPT.pay_prd_id =
CASE '201202'
WHEN 'YYYYMM'
THEN (SELECT DISTINCT pay_prd.pay_prd_id
FROM pay_prd
WHERE pay_prd.stat_cd = 2)
ELSE TO_NUMBER ('201202', '999999')
END
And its explain plan is...
Plan
SELECT STATEMENT ALL_ROWS Cost: 79 K Bytes: 641 M Cardinality: 3 M
18 HASH JOIN Cost: 79 K Bytes: 641 M Cardinality: 3 M
3 PART JOIN FILTER CREATE SYS.:BF0000 Cost: 7 K Bytes: 72 M Cardinality: 3 M
2 PARTITION RANGE ALL Cost: 7 K Bytes: 72 M Cardinality: 3 M Partition #: 3 Partitions accessed #1 - #1048575
1 TABLE ACCESS FULL TABLE TAB_D_RPT Cost: 7 K Bytes: 72 M Cardinality: 3 M Partition #: 3 Partitions accessed #1 - #1048575
17 HASH JOIN Cost: 57 K Bytes: 182 M Cardinality: 874 K
14 PART JOIN FILTER CREATE SYS.:BF0001 Cost: 38 K Bytes: 87 M Cardinality: 914 K
13 HASH JOIN Cost: 38 K Bytes: 87 M Cardinality: 914 K
6 PART JOIN FILTER CREATE SYS.:BF0002 Cost: 8 K Bytes: 17 M Cardinality: 939 K
5 PARTITION RANGE ALL Cost: 8 K Bytes: 17 M Cardinality: 939 K Partition #: 9 Partitions accessed #1 - #1048575
4 TABLE ACCESS FULL TABLE TAB_C_RPT Cost: 8 K Bytes: 17 M Cardinality: 939 K Partition #: 9 Partitions accessed #1 - #1048575
12 HASH JOIN Cost: 24 K Bytes: 74 M Cardinality: 957 K
7 INDEX FAST FULL SCAN INDEX (UNIQUE) TAB_B_RPT_PK Cost: 675 Bytes: 10 M Cardinality: 941 K
11 PARTITION RANGE SINGLE Cost: 18 K Bytes: 65 M Cardinality: 970 K Partition #: 13 Partitions accessed #KEY(AP)
10 TABLE ACCESS FULL TABLE TAB_A_RPT Cost: 18 K Bytes: 65 M Cardinality: 970 K Partition #: 13 Partitions accessed #KEY(AP)
9 HASH UNIQUE Cost: 4 Bytes: 14 Cardinality: 2
8 TABLE ACCESS FULL TABLE PAY_PRD Cost: 3 Bytes: 14 Cardinality: 2
16 PARTITION RANGE JOIN-FILTER Cost: 8 K Bytes: 106 M Cardinality: 939 K Partition #: 17 Partitions accessed #:BF0001
15 TABLE ACCESS FULL TABLE TAB_C_RPT Cost: 8 K Bytes: 106 M Cardinality: 939 K Partition #: 17 Partitions accessed #:BF0001
Thanks Again. -
SYNC(EVERY interval ) deployment for Partitioned Tables
I am wondering if anyone has deployed the SYNC(EVERY "SYSDATE + interval") style in a Partition table environment where there is a large number of partitions but only a few the most recent 7days (lets say 30 days) have any inserts/updates. As I understand it, the SYNC(EVERY interval) creates a DBMS_SCHEDULER job for each partition and the job will submit as per the interval. We have about 5000 partitions on any given day; partitions get dropped and we add a new one for the fututre (we keep 30 days ahead).
1. Is it possible to modify the interval in these auto created Jobs? For Partitions older thasn X days i would want to run the job every Z hours
2. Disable the future jobs until the day required (enable 10 minutes before the partition becomes "active" -- gets data
RegardsHi,
you can read about this in the manual (http://docs.oracle.com/cd/E11882_01/text.112/e24436/csql.htm#i997677). The manual says: "Each partition of a locally partitioned index can have its own type of sync (ON COMMIT, EVERY, or MANUAL). The type of sync specified in master parameter strings applies to all index partitions unless a partition specifies its own type." So it is possible to set for each partition its own sync type. This is possible with an ALTER statement:
ALTER INDEX index_name MODIFY PARTITION partition_name PARAMETER (paramstring)1. With the above alter you can change it
2. You can put a partition to MANUAL and then synchronize when necessary.
So if you know when the partition needs to change, you can change it possible with another job or procedure.
Herald ten Dam
http://htendam.wordpress.com -
Keeping stats up to date for partitioned tables
Hi,
Oracle version 10.2.0.4
I have a partioned table. I would like to keep stats up-to-date.
Can I just run a single command to update table stats, indexes and partitions please?
exec dbms_stats.gather_table_stats(user, 'TABLE', cascade=>true)or I also need to run exec dbms_stats.gather_table_stats(user, 'TABLE', granularity=>partition)
thanks,
Ashok
Edited by: 902986 on 27-Oct-2012 11:06
Edited by: 902986 on 27-Oct-2012 11:07thanks
yes there were many indexes on the original non-partitioned table and I have created another table partitioned and now populating it with the data from the original table. the new table is partitioned on a date range column for all years before 2012, then for 2012, 2013 and so forth.
the indexes are all created locally bar a unique index (as per original table), created globally to enforce uniqueness across the table itself. the search will always look to year to date say 1st jan 2012 tilll today for risk analysis. the partition is on that date column and there is also a local index on that date column as well, to avoid table scan (tested with disabling that index, predictably did table scan and was less efficient).
in a DW environment, I don't see much value in having global index bar for primary key/unique constraint. I do realise that if the query crosses more than one partition, say 2 partitions, there will be two b-tree local index scans rather than one, but that would be rare (from the way they query the table).
therefore my plan is to perform a full table stats with cascade=>true and measure the time it takes and plan to do the same if the maintenance window allows it.
thanks again for your help
Edited by: 902986 on 28-Oct-2012 13:24 -
Set table level degree for partitioned table
Hi all,
Usually, we set degree 2 or 4 to big tables. In this case, CBO will choose parallel select for these tables if possible.
Let assume one case that is table1 joins table2. non-partitioned Table1 has 20m rows and has degree 2. partitioned table2 has 50m rows and has no parallel degree.
When I checked the execution plan, CBO uses parallel execution and uses PX BLOCK ITERATOR on table1 as expected. But I don't know whether table2 is selected in parallel, too.
I mean I am not sure whether CBO launches slave processes against table2 or just select table2 as a whole.
And with your tuning or architecture experiences, do you think whehther we should set degree for a partitioned table as the partitioned table can be parallelized based on partitions?
best regards,
Leonuser12064076 wrote:
And with your tuning or architecture experiences, do you think whether we should set degree for a partitioned table as the partitioned table can be parallelized based on partitions?What version of Oracle?
A site I worked at recently preferred not to hard-code the degree but to let Oracle choose it at runtime; they felt it offered better allocation of system load than hard-coding the values. They were on 10g release 2. -
Select for partitioned table, will this work with sign?
Hi,
I have partitioned table and select for it like :
PARTITION BY RANGE ( "INDATE" )
( PARTITION "PRT_20091201" VALUES LESS THAN (TO_DATE(' 2009-12-02 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')...
SELECT COLUMN_LIST FROM TABLE1 WHERE
( indate >= to_date(t_indate || t_timefrom, 'mm/dd/yyyy HH24:MI:SS')) AND
( indate <= to_date(t_indate || t_timeto, 'mm/dd/yyyy HH24:MI:SS')) AND... so selecting all info for the given date withing specifiied time period, and I'm using >= condition on partitioned column, do you think it will work correctly getting directly to the single partition, or Oralce requires me put strictly = sign for that column, and then additioanly I can probably select time period, something like:
SELECT COLUMN_LIST FROM TABLE1 WHERE
( indate = to_date(t_indate , 'mm/dd/yyyy')) AND
( trim_to_time(indate) >= to_char(t_timefrom, ' HH24:MI:SS')) AND
( trim_to_time(indate) <= to_char( t_timeto, ' HH24:MI:SS')) AND... Tx all
Trtrento wrote:
Hi,
I have partitioned table and select for it like :
PARTITION BY RANGE ( "INDATE" )
( PARTITION "PRT_20091201" VALUES LESS THAN (TO_DATE(' 2009-12-02 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')...
SELECT COLUMN_LIST FROM TABLE1 WHERE
( indate >= to_date(t_indate || t_timefrom, 'mm/dd/yyyy HH24:MI:SS')) AND
( indate <= to_date(t_indate || t_timeto, 'mm/dd/yyyy HH24:MI:SS')) AND... so selecting all info for the given date withing specifiied time period, and I'm using >= condition on partitioned column, do you think it will work correctly getting directly to the single partition, or Oralce requires me put strictly = sign for that column, and then additioanly I can probably select time period, something like:
SELECT COLUMN_LIST FROM TABLE1 WHERE
( indate = to_date(t_indate , 'mm/dd/yyyy')) AND
( trim_to_time(indate) >= to_char(t_timefrom, ' HH24:MI:SS')) AND
( trim_to_time(indate) <= to_char( t_timeto, ' HH24:MI:SS')) AND... Tx all
TrI agree with David that the first example looked okay, but you should test to make sure. You can check individual partition contents by executing a query using the PARTITION option to specifiy a specific partition to check the values there. -
EA 4.0 - Icon for partitioned tables changed
The icon in the tree list changed in the EA Version 4.0 to the normal table icon.
Best will be to get an icon with a small "p" inside so that partitioned tables can be seen in the tree list.CREATE TABLE "ANPQUALITY"."PART_REPLICATION"
( "UNIQUEPART_ID" VARCHAR2(80 BYTE) NOT NULL ENABLE,
"IDENTIFIER_TYPE" VARCHAR2(10 BYTE) NOT NULL ENABLE,
"DATE_CHANGED" TIMESTAMP (6) WITH TIME ZONE,
"TIME_STAMP" TIMESTAMP (6) WITH TIME ZONE,
"V_DATE_CHANGED" DATE GENERATED ALWAYS AS (TO_DATE(TO_CHAR("DATE_CHANGED",'YYYYMMDD HH24:MI:SS'),'YYYYMMDD HH24:MI:SS')) VIRTUAL VISIBLE ,
CONSTRAINT "PART_REPLICATION_PK" PRIMARY KEY ("UNIQUEPART_ID", "IDENTIFIER_TYPE") USING INDEX PCTFREE 5 INITRANS 8 MAXTRANS 255
COMPUTE STATISTICS STORAGE(INITIAL 104857600 NEXT 104857600 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE TRACE ENABLE)
PCTFREE 5 PCTUSED 40 INITRANS 8 MAXTRANS 255 COMPRESS FOR OLTP STORAGE
(BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
TABLESPACE "TRACE" LOB ("PART_DATA") STORE AS BASICFILE (
ENABLE STORAGE IN ROW CHUNK 32768 RETENTION NOCACHE LOGGING STORAGE( BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
PARTITION BY RANGE ("V_DATE_CHANGED") INTERVAL (NUMTOYMINTERVAL(1,'MONTH') )
(PARTITION "P_00" VALUES LESS THAN (TO_DATE(' 2012-07-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))
PCTFREE 5 PCTUSED 40 INITRANS 8 MAXTRANS 255
STORAGE(INITIAL 104857600 NEXT 104857600 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
TABLESPACE "TRACE" LOB ("PART_DATA") STORE AS BASICFILE (
TABLESPACE "TRACE" ENABLE STORAGE IN ROW CHUNK 32768 RETENTION NOCACHE LOGGING
STORAGE(INITIAL 104857600 NEXT 104857600 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT))
COMPRESS FOR OLTP -
SQL coding for partitioned tables
Hi My tables are partitioned into 4 different partitions.. each one representing each quarter of a year.. do i need to specify the partition name in my sql query to grab the data or does oracle have the intelligence to go this partition based on my select statement..
say q1, q2,q3,q4 table partitions and the table name is y1
can i say
<code> select * from y1 where date ='01/01/2005'</code>
does this above written code takes you directly to the partition where this data is located..
if it does how do we know that in the execution plan that it wasnot scanning the full table but rather one partition..
thanks in advancehave a look at the explain plan and you will see how oracle acces the partitioned table.
All Oracle documentation can be found under
http://otn.oracle.com/pls/db92/db92.docindex?remark=homepage
You will probably find answer to your question under
http://download-west.oracle.com/docs/cd/B10501_01/server.920/a96524/toc.htm
http://download-west.oracle.com/docs/cd/B10501_01/server.920/a96533/toc.htm
http://download-west.oracle.com/docs/cd/B10501_01/server.920/a96520/toc.htm -
Query Needed for Partitioning table
Hi,
I have created a table called Test. There is a column named business_name.
There are several businesses like ABC,BCD,ADE....
There will be lakhs of rows corresponding to each business, i mean there will be lakhs of entires corresponding to ABC,BCD....
So i like to partition the table according to business_name so that the search will be more faster.As we had partitioned according to the business_name, i hope we need to search only on the partition corresponding to the particular business.
can any one provide the Query to partition the table ' TEST ' according to the column ' business_name ' .
Also can anyone provide Query to modify the already existing table ' TEST ' to incorporate partition for the column ' business_name '.We can partiton a table by the following
create table Generalledger (
record_id number,
business_name varchar2(3)
sales_dt date,
amount number(10)
partition by list (business_name)
partition ct values ('ABC'),
partition ca values ('BCD'),
partition def values (default)
But if we dont know the values like 'ABC' , 'BCD'
....how can we do the partitionuse SQL to generate part (or all) of your DDL statement. The following will output one partition statement for each business_name:
SELECT DISTINCT 'partition p_' || BUSINESS_NAME || ' values (''' ||
BUSINESS_NAME || '''),'
FROM GENERALLEDGER; -
Open table/index node yields duplicates for partitioned objects
The generated query for this operation (extracted from the log) is:
select distinct t.table_name, t.num_rows, ao.status,
+(select count(*) from sys.Dba_tab_columns c where t.table_name = c.table_name and t.owner = c.owner) columns,+
+(select comments from sys.Dba_tab_comments c where t.table_name = c.table_name and t.owner = c.owner) comments,+
+(select count(*) from sys.Dba_indexes i where t.table_name = i.table_name and t.owner = i.table_owner) indexed_columns,+
t.avg_row_len,
t.tablespace_name,
t.avg_row_len * t.num_rows estimated_size,
ao.last_ddl_time,
ao.created,
+(select count(*) from sys.Dba_dependencies where REFERENCED_OWNER = t.owner and REFERENCED_NAME = t.table_name) referenced_objects,+
+(select count(*) from sys.Dba_triggers r where r.table_owner = t.owner and r.table_name = t.table_name) trigs+
from sys.Dba_tables t,sys.Dba_objects ao
where ao.owner = :OBJECT_OWNER
and ao.owner = t.owner and ao.object_name = t.table_name
and aO.GENERATED = 'N'
AND aO.OBJECT_NAME NOT IN (SELECT OBJECT_NAME FROM RECYCLEBIN)
AND aO.OBJECT_NAME NOT IN (SELECT MVIEW_NAME FROM SYS.Dba_MVIEWS WHERE :OBJECT_OWNER = OWNER)
AND aO.OBJECT_NAME NOT IN (SELECT QUEUE_TABLE from Dba_queue_tables WHERE :OBJECT_OWNER = OWNER)
AND not ( ao.object_name like 'AQ$_%_G'
or ao.object_name like 'AQ$_%_H'
or ao.object_name like 'AQ$_%_I'
or ao.object_name like 'AQ$_%_S'
or ao.object_name like 'AQ$_%_T' )
AND ( user = :OBJECT_OWNER or not ao.object_name like 'BIN$%' ) -- user != :SCHEMA --> object_name not like 'BIN$%'
-- RECYCLEBIN is USER_RECYCLEBIN!
order by 1
Trouble is that joining dba_tables to dba_objects produces duplicates for partitioned tables.
The same is true for the index node.
Should I file a bug, or is it already picked up ?
Cheers,
Olivier.No answer after 8 days -> Reactivation.
Tx.
Olivier. -
How to record partitioned tables in Data Modeler ?
Hi,
I have discovered the options for partitioned tables. Some questions remain, however.
1) Static partitions
For one table, a set of predefined partitions is set up in the data model. In certain situations, a new partition is added. Is it possible to generate alter table DDL from the model that will add this partition ?
2) Dynamic partitions
For another table, partitions are added and deleted on the fly (exhange partition). For this tabel, I would like to record just 1 partition, which is added when the tabels are created initially. It is not important to include the actual partitions when synchronizing with the database. Is it possible to skip this for a certain table (i.e. record this preference with the table, since it does not apply for all partitioned tables... ) ?
Thanks,
Richard.Hi Richard,
For one table, a set of predefined partitions is set up in the data model. In certain situations, a new partition is added. Is it possible to generate alter table DDL from the model that will add this partition ?
In Data Modeler version 4.1, ALTER TABLE ... ADD PARTITION statements are generated for new LIST partitions, but not for other types of partitions.
For another table, partitions are added and deleted on the fly (exhange partition). For this tabel, I would like to record just 1 partition, which is added when the tabels are created initially. It is not important to include the actual partitions when synchronizing with the database. Is it possible to skip this for a certain table (i.e. record this preference with the table, since it does not apply for all partitioned tables... ) ?
I've logged an enhancement request on this.
Regards,
David -
Datapump skipping partitioned tables in the database
I have run expdp on Oracle 10.2.0.4.0 on AIX 5.6 Platform, the export runs well exporting rows in the database but when it comes to partitioned tables in the database it export no rows for all the partitioned tables. When I run a normal exp/imp the partitioned tables are exported with all their rows.
I used the following commands:
expdp system/****** dumpfile=export_data.dmp directory=DATA_PUMP_DIR full=y logfile=export_dump.log
Output for expdp on partitioned table:
. . exported "SCOTT"."DEPT":"DEPT_2003_P1" 0 KB 0 rows
. . exported "SCOTT"."DEPT":"DEPT_2003_P10" 0 KB 0 rows
. . exported "SCOTT"."DEPT":"DEPT_2003_P11" 0 KB 0 rows
. . exported "SCOTT"."DEPT":"DEPT_2003_P12" 0 KB 0 rows
. . exported "SCOTT"."DEPT":"DEPT_2003_P2" 0 KB 0 rows
. . exported "SCOTT"."DEPT":"DEPT_2003_P3" 0 KB 0 rows
. . exported "SCOTT"."DEPT":"DEPT_2003_P4" 0 KB 0 rows
. . exported "SCOTT"."DEPT":"DEPT_2003_P5" 0 KB 0 rows
. . exported "SCOTT"."DEPT":"DEPT_2003_P6" 0 KB 0 rows
. . exported "SCOTT"."DEPT":"DEPT_2003_P7" 0 KB 0 rows
. . exported "SCOTT"."DEPT":"DEPT_2003_P8" 0 KB 0 rows
. . exported "SCOTT"."DEPT":"DEPT_2003_P9" 0 KB 0 rows
And for exp:
exp system/****** file=export_dump.dmp full=y log=export_log1.log
Result from the export log for partitioned tables:
. . exporting partition DEPT_2005_P1 881080 rows exported
. . exporting partition DEPT_2005_P2 1347780 rows exported
. . exporting partition DEPT_2005_P3 2002962 rows exported
. . exporting partition DEPT_2005_P4 2318227 rows exported
. . exporting partition DEPT_2005_P5 3122371 rows exported
. . exporting partition DEPT_2005_P6 3916020 rows exported
. . exporting partition DEPT_2005_P7 4217100 rows exported
. . exporting partition DEPT_2005_P8 4125915 rows exported
. . exporting partition DEPT_2005_P9 1913970 rows exported
. . exporting partition DEPT_2005_P10 1100156 rows exported
. . exporting partition DEPT_2005_P11 786516 rows exported
. . exporting partition DEPT_2005_P12 822976 rows exported
I am not sure about this behavour from datapump, my database is more than 800GB and we want to migrate the database from AIX to LINUX.
ThanksSorry I just copied and pasted some extracts from my exp and expdp logs:
For testing purposes I tried to run a datapump export of only 1 partitioned table in the database and its going through, but when I do the same on a full datapump export these partitioned tables are being exported with no rows.
Export: Release 10.2.0.4.0 - 64bit Production on Tuesday, 02 August, 2011 12:18:47
Copyright (c) 2003, 2007, Oracle. All rights reserved.
Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
Starting "SYSTEM"."SYS_EXPORT_TABLE_01": system/******** dumpfile=DEPT.dmp tables=scott.dept logfile=dept1.log
Estimate in progress using BLOCKS method...
Processing object type TABLE_EXPORT/TABLE/TABLE_DATA
Total estimation using BLOCKS method: 48.50 GB
Processing object type TABLE_EXPORT/TABLE/TABLE
Processing object type TABLE_EXPORT/TABLE/GRANT/OWNER_GRANT/OBJECT_GRANT
Processing object type TABLE_EXPORT/TABLE/INDEX/INDEX
Processing object type TABLE_EXPORT/TABLE/CONSTRAINT/CONSTRAINT
Processing object type TABLE_EXPORT/TABLE/INDEX/STATISTICS/INDEX_STATISTICS
Processing object type TABLE_EXPORT/TABLE/COMMENT
Processing object type TABLE_EXPORT/TABLE/RLS_POLICY
Processing object type TABLE_EXPORT/TABLE/CONSTRAINT/REF_CONSTRAINT
Processing object type TABLE_EXPORT/TABLE/TRIGGER
Processing object type TABLE_EXPORT/TABLE/INDEX/FUNCTIONAL_AND_BITMAP/INDEX
Processing object type TABLE_EXPORT/TABLE/INDEX/STATISTICS/FUNCTIONAL_AND_BITMAP/INDEX_STATISTICS
Processing object type TABLE_EXPORT/TABLE/STATISTICS/TABLE_STATISTICS
. . exported "SCOTT"."DEPT":"DEPT_2009_P6" 1.452 GB 7377736 rows
. . exported "SCOTT"."DEPT":"DEPT_2009_P7" 1.363 GB 6935687 rows
. . exported "SCOTT"."DEPT":"DEPT_2008_P6" 1.304 GB 6656096 rows
. . exported "SCOTT"."DEPT":"DEPT_2010_P7" 1.410 GB 7300618 rows
. . exported "SCOTT"."DEPT":"DEPT_2008_P7" 1.296 GB 6641073 rows
. . exported "SCOTT"."DEPT":"DEPT_2010_P6" 1.328 GB 6863885 rows
. . exported "SCOTT"."DEPT":"DEPT_2007_P6" 1.158 GB 6568075 rows
. . exported "SCOTT"."DEPT":"DEPT_2009_P5" 1.141 GB 5801822 rows
. . exported "SCOTT"."DEPT":"DEPT_2011_P5" 1.162 GB 6027466 rows
. . exported "SCOTT"."DEPT":"DEPT_2007_P7" 1.100 GB 6214680 rows
. . exported "SCOTT"."DEPT":"DEPT_2011_P6" 1.106 GB 5762303 rows
. . exported "SCOTT"."DEPT":"DEPT_2010_P5" 1.133 GB 5859492 rows
. . exported "SCOTT"."DEPT":"DEPT_2007_P5" 1.001 GB 5664315 rows
. . exported "SCOTT"."DEPT":"DEPT_2008_P5" 1.023 GB 5229356 rows
. . exported "SCOTT"."DEPT":"DEPT_2010_P8" 1.078 GB 5549666 rows
. . exported "SCOTT"."DEPT":"DEPT_2007_P8" 940.3 MB 5171379 rows
. . exported "SCOTT"."DEPT":"DEPT_2008_P8" 989.0 MB 4920276 rows
. . exported "SCOTT"."DEPT":"DEPT_2009_P8" 918.6 MB 4553523 rows
. . exported "SCOTT"."DEPT":"DEPT_2006_P6" 821.0 MB 5220879 rows
. . exported "SCOTT"."DEPT":"DEPT_2008_P4" 766.6 MB 3832262 rows
. . exported "SCOTT"."DEPT":"DEPT_2006_P8" 747.9 MB 4753538 rows
. . exported "SCOTT"."DEPT":"DEPT_2006_P7" 741.8 MB 4708242 rows
. . exported "SCOTT"."DEPT":"DEPT_2010_P4" 734.2 MB 3713567 rows
. . exported "SCOTT"."DEPT":"DEPT_2005_P7" 661.4 MB 4217100 rows
. . exported "SCOTT"."DEPT":"DEPT_2005_P8" 647.1 MB 4125915 rows
. . exported "SCOTT"."DEPT":"DEPT_2011_P4" 677.8 MB 3428887 rows
I also tried to run a normal schema by schema export with the normal exp system/password command the and got my dump file which is about 300GB, when I run the imp system/password command and specify fromuser=<system > and touser=<schemas_in_the_dumpfile> seperated by commas, it just comes up with this message:
Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
Export file created by EXPORT:V10.02.01 via conventional path
import done in WE8ISO8859P9 character set and AL16UTF16 NCHAR character set
Import terminated successfully without warnings.
No tables are exported.
If I specify the parameter imp system/password file=dept_export.dmp full=y log=dept_imp.log with the same dumpfile and it imports data from the dumpfile into my database.
I am not sure what could be wrong with my dumpfile or my imp command and its parameters.
Maybe you are looking for
-
New Front-End Editor is Dumping when I try to check an ABAP source code
Hi Experts I'm trying to check the source code of any ABAP in SE38 with the new front-end editor, but I'm facing a dump, maybe there is missing a patch or something like that. if any of you have information about that I really appreciate your aswers.
-
Greetings, Today I started using a secondary Display with my Macbook using the miniDvi to Dvi original Apple adaptor. After few minutes (10 max) the airport loses the connection with my wireless router and can not detect any wireless networks. I rest
-
Shared Services question....
Hi all, I have a question regarding managing Shared Services. Hopefully, I'm posting the subject in the right area. I'm trying to restructure the whole security management process for a client and I'd like to verify with everyone if this is the stand
-
Where did Print Preview go in Firesworks CS5?
I upgraded from Fireworks 8 to Fireworks CS5 and I can't find Print Preview. Where did it go. I'm wasting multiple sheets of paper trying to print a group of images.
-
Multiple Keypresses in FL 1.1
Hi guys, How do you capture simultaneous multiple keypresses in FL 1.1? I used a key catcher (button) to catch all events like: quote: on(keyPress "1"){call("moveUp1")} on(keyPress "7"){call("moveDown1")} on(keyPress "3"){call("moveUp2")} on(keyPress