Dropping tablespace for a partitionned table
Hi all,
I have a table partitionned and I want to drop the tablespace for a specific partition. So what happen in the table if I drop one tablespace with a commande drop tablespace tbs including contents and datafiles;
Does the index unusable in this table?
Regards
No, you can not drop a tablespace which contains tables whose partitions are not completely contained in this tablespace.
db9i :SQL> create tablespace users2 datafile '/u02/oradata/db9i/users201.dbf' size 10M;
Tablespace created.
db9i :SQL> CREATE TABLE sales_by_region (item# INTEGER, qty INTEGER,
2 store_name VARCHAR(30), state_code VARCHAR(2),
3 sale_date DATE)
4 STORAGE(INITIAL 10K NEXT 20K) TABLESPACE test
5 PARTITION BY LIST (state_code)
6 (
7 PARTITION region_east
8 VALUES ('MA','NY','CT','NH','ME','MD','VA','PA','NJ')
9 STORAGE (INITIAL 20K NEXT 40K PCTINCREASE 50)
TABLESPACE users,
10 11 PARTITION region_west
12 VALUES ('CA','AZ','NM','OR','WA','UT','NV','CO')
13 PCTFREE 25
14 TABLESPACE users2,
15 PARTITION region_unknown
16 VALUES (DEFAULT)
17 TABLESPACE test
18 );
Table created.
db9i :SQL> insert into sales_by_region values (1, 100, 'store 1','NY',sysdate);
1 row created.
db9i :SQL> insert into sales_by_region values (2, 200, 'store 2','UT',sysdate);
1 row created.
db9i :SQL> insert into sales_by_region values (3, 300, 'store 3','ZZ',sysdate);
1 row created.
db9i :SQL> commit;
Commit complete.
db9i :SQL> select count(*) from sales_by_region
2 /
COUNT(*)
3
--insure all data went to the right partition
db9i :SQL> alter table sales_by_region truncate PARTITION region_east;
Table truncated.
db9i :SQL> select count(*) from sales_by_region
2 /
COUNT(*)
2
db9i :SQL> alter table sales_by_region truncate PARTITION region_west;
Table truncated.
db9i :SQL> select count(*) from sales_by_region
2 /
COUNT(*)
1
db9i :SQL> alter table sales_by_region truncate PARTITION region_unknown;
Table truncated.
db9i :SQL> select count(*) from sales_by_region
2 /
COUNT(*)
0
db9i :SQL> insert into sales_by_region values (1, 100, 'store 1','NY',sysdate);
insert into sales_by_region values (2, 200, 'store 2','UT',sysdate);
insert into sales_by_region values (3, 300, 'store 3','ZZ',sysdate);
1 row created.
db9i :SQL>
1 row created.
db9i :SQL>
1 row created.
db9i :SQL>
db9i :SQL>
db9i :SQL> commit;
Commit complete.
db9i :SQL> select count(*) from sales_by_region
2 /
COUNT(*)
3
--now drop one tablespace
db9i :SQL> drop tablespace users2 including contents and datafiles
2 /
drop tablespace users2 including contents and datafiles
ERROR at line 1:
ORA-14404: partitioned table contains partitions in a different tablespace
db9i :SQL> !oerr ora 14404
14404, 00000, "partitioned table contains partitions in a different tablespace"
// *Cause: An attempt was made to drop a tablespace which contains tables
// whose partitions are not completely contained in this tablespace
// *Action: find tables with partitions which span the tablespace being
// dropped and some other tablespace(s). Drop these tables or move
// partitions to a different tablespace
--move table partition from users2 to users
db9i :SQL> alter table sales_by_region move partition region_west
tablespace users; 2
Table altered.
--drop tablespace again
db9i :SQL> drop tablespace users2 including contents and datafiles
2 /
Tablespace dropped.
Similar Messages
-
Tablespace of a partitioned Table
Hi,
what is the meaning of the outer tablespace clause in a 'create table' statement, when in the table the tablespaces are defined for each partition?
f.e.:
create table PST_ER_ZIEL (
ID NUMBER(18) not null,
PST_ZIEL_ID NUMBER(9) not null,
PST_NODE_ID NUMBER(9) not null,
MESSOBJECT VARCHAR2(100) not null,
VSTKNR VARCHAR2(11) not null,
EVENT_STATUS NUMBER(2) not null,
EVENT_TIME DATE not null
partition by range
EVENT_TIME
partition
Day1
values less than
TO_DATE('2003: 2' , 'YYYY: DDD')
tablespace PST_EV_RT,
partition
Day2
values less than
TO_DATE('2003: 3' , 'YYYY: DDD')
tablespace PST_EV_RT
tablespace DATA1;
What will be stored in DATA1 after creating the table?
Thanx,
BalazsThe outer tablespace clause is the 'default' tablespace for new partitions. When you add a new partition without adefinition for a tablespace, it is stored in DATA1.
-
HOW to enable oracle advance compression for EXIST partitioned table
Hi All,
I have to enable oracle advance compression for existing table which PARTITION BY RANGE then SUBPARTITION BY HASH.
ORacle version: 11.2.0.2.0
Please provide me any relevant doc or any exp.
Thanks in advance.could not see any text for how to enable oracle advance compression for EXIST partitioned table.RTFM.
From the resource above:
How do I compress an existing table?
There are multiple options available to compress existing tables. For offline compression, one could use ALTER TABLE Table_Name MOVE COMPRESS statement. A compressed copy of an existing table can be created by using CREATE TABLE Table_Name COMPRESS FOR ALL OPERATIONS AS SELECT *. For online compression, Oracle’s online redefinition utility can be used. More details for online redefinition are available here.
" -
Tablespace move in partitioned tables
I moved partitioned tables in new tablespace dedicated for 2006 data, do i need to move table relaed indexes in new tablespace also.?
No,
global Indexes will be invalid and have to be rebuild. If you have local Indexes you only have to rebuild the affected partitions. Nothing else to do.
Dim -
Drop column from compressed partitioned table
Hi,
DB version is 11.2.02.
We have table which is range partitioned and sub-partitioned by list.
Table is also compressed.
When I try to drop a column, I get error.
CREATE TABLE DWH_REP.P_RATING (
id_source$ NUMBER(38,0) NULL,
time_insert$ DATE ,
time_update$ DATE ,
FLG_CURRENT$ NUMBER(38,0) ,
FLG_CHANGED$ NUMBER(38,0) ,
id_audit$ NUMBER(38,0) ,
ID_DATE_PSTING NUMBER(38,0) ,
partner_rating_id VARCHAR2(256) ,
partner_id VARCHAR2(256) ,
id_partner NUMBER(38,0) ,
rating_system_id VARCHAR2(256) ,
rating_id VARCHAR2(256) ,
date_rating DATE ,
date_follow_up DATE ,
risk_team_id VARCHAR2(256) ,
risk_team_descr VARCHAR2(256) ,
risk_team_changed_id VARCHAR2(256) ,
risk_team_changed_descr VARCHAR2(256) ,
date_risk_team_changed DATE ,
assignment_id VARCHAR2(256) ,
date_assignment DATE ,
date_assignment_confirmed DATE ,
date_assignment_expiration DATE ,
flg_exception VARCHAR2(256) ,
exception_id VARCHAR2(256) ,
date_exception DATE
-- TABLESPACE DWH_REP_DATA
PARTITION BY RANGE (FLG_CURRENT$, ID_DATE_PSTING)
SUBPARTITION BY LIST (ID_SOURCE$)
(PARTITION P_RATING_2010
VALUES LESS THAN (0, 20110101)
SUBPARTITION P_RATING_2010_UCS VALUES (10) TABLESPACE DWH_O_2010_TBS,
SUBPARTITION P_RATING_2010_UCM VALUES (11) TABLESPACE DWH_O_2010_TBS,
-- SUBPARTITION P_RATING_2010_ORBI30 VALUES (30) TABLESPACE DWH_O_2010_TBS,
-- SUBPARTITION P_RATING_2010_ORBI31 VALUES (31) TABLESPACE DWH_O_2010_TBS,
SUBPARTITION P_RATING_2010_CETELEM VALUES (40) TABLESPACE DWH_O_2010_TBS,
-- SUBPARTITION P_RATING_2010_MILES VALUES (60) TABLESPACE DWH_O_2010_TBS,
-- SUBPARTITION P_RATING_2010_BHI VALUES (80) TABLESPACE DWH_O_2010_TBS,
SUBPARTITION P_RATING_2010_DF VALUES (DEFAULT) TABLESPACE DWH_O_2010_TBS),
PARTITION P_RATING_2011
VALUES LESS THAN (0, 20120101)
SUBPARTITION P_RATING_2011_UCS VALUES (10) TABLESPACE DWH_O_2011_TBS,
SUBPARTITION P_RATING_2011_UCM VALUES (11) TABLESPACE DWH_O_2011_TBS,
-- SUBPARTITION P_RATING_2011_ORBI30 VALUES (30) TABLESPACE DWH_O_2011_TBS,
-- SUBPARTITION P_RATING_2011_ORBI31 VALUES (31) TABLESPACE DWH_O_2011_TBS,
SUBPARTITION P_RATING_2011_CETELEM VALUES (40) TABLESPACE DWH_O_2011_TBS,
-- SUBPARTITION P_RATING_2011_MILES VALUES (60) TABLESPACE DWH_O_2011_TBS,
-- SUBPARTITION P_RATING_2011_BHI VALUES (80) TABLESPACE DWH_O_2011_TBS,
SUBPARTITION P_RATING_2011_DF VALUES (DEFAULT) TABLESPACE DWH_O_2011_TBS),
PARTITION P_RATING_current
VALUES LESS THAN (maxvalue, maxvalue)
SUBPARTITION P_RATING_CUR_UCS VALUES (10) TABLESPACE DWH_O_CRT_UCS_TBS,
SUBPARTITION P_RATING_CUR_UCM VALUES (11) TABLESPACE DWH_O_CRT_UPM_TBS,
-- SUBPARTITION P_RATING_CUR_ORBI30 VALUES (30) TABLESPACE DWH_O_CRT_ORBI30_TBS,
-- SUBPARTITION P_RATING_CUR_ORBI31 VALUES (31) TABLESPACE DWH_O_CRT_ORBI31_TBS,
SUBPARTITION P_RATING_CUR_CETELEM VALUES (40) TABLESPACE DWH_O_CRT_CETELEM_TBS,
-- SUBPARTITION P_RATING_CUR_MILES VALUES (60) TABLESPACE DWH_O_CRT_MILES_TBS,
-- SUBPARTITION P_RATING_CUR_BHI VALUES (80) TABLESPACE DWH_O_CRT_BHI_TBS,
SUBPARTITION P_RATING_CUR_DF VALUES (DEFAULT) TABLESPACE DWH_O_CRT_DF_TBS))
ENABLE ROW MOVEMENT
NOLOGGING
COMPRESS
NOCACHE
NOPARALLEL
MONITORING;
ALTER TABLE DWH_REP.P_RATING DROP COLUMN ID_PARTNER;
ORA-39726: unsupported add/drop column operation on compressed tableslittleboy wrote:
Hi,
DB version is 11.2.02.
We have table which is range partitioned and sub-partitioned by list.
Table is also compressed.
When I try to drop a column, I get error.
CREATE TABLE DWH_REP.P_RATING (
id_source$ NUMBER(38,0) NULL,
time_insert$ DATE ,
time_update$ DATE ,
FLG_CURRENT$ NUMBER(38,0) ,
FLG_CHANGED$ NUMBER(38,0) ,
id_audit$ NUMBER(38,0) ,
ID_DATE_PSTING NUMBER(38,0) ,
partner_rating_id VARCHAR2(256) ,
partner_id VARCHAR2(256) ,
id_partner NUMBER(38,0) ,
rating_system_id VARCHAR2(256) ,
rating_id VARCHAR2(256) ,
date_rating DATE ,
date_follow_up DATE ,
risk_team_id VARCHAR2(256) ,
risk_team_descr VARCHAR2(256) ,
risk_team_changed_id VARCHAR2(256) ,
risk_team_changed_descr VARCHAR2(256) ,
date_risk_team_changed DATE ,
assignment_id VARCHAR2(256) ,
date_assignment DATE ,
date_assignment_confirmed DATE ,
date_assignment_expiration DATE ,
flg_exception VARCHAR2(256) ,
exception_id VARCHAR2(256) ,
date_exception DATE
-- TABLESPACE DWH_REP_DATA
PARTITION BY RANGE (FLG_CURRENT$, ID_DATE_PSTING)
SUBPARTITION BY LIST (ID_SOURCE$)
(PARTITION P_RATING_2010
VALUES LESS THAN (0, 20110101)
SUBPARTITION P_RATING_2010_UCS VALUES (10) TABLESPACE DWH_O_2010_TBS,
SUBPARTITION P_RATING_2010_UCM VALUES (11) TABLESPACE DWH_O_2010_TBS,
-- SUBPARTITION P_RATING_2010_ORBI30 VALUES (30) TABLESPACE DWH_O_2010_TBS,
-- SUBPARTITION P_RATING_2010_ORBI31 VALUES (31) TABLESPACE DWH_O_2010_TBS,
SUBPARTITION P_RATING_2010_CETELEM VALUES (40) TABLESPACE DWH_O_2010_TBS,
-- SUBPARTITION P_RATING_2010_MILES VALUES (60) TABLESPACE DWH_O_2010_TBS,
-- SUBPARTITION P_RATING_2010_BHI VALUES (80) TABLESPACE DWH_O_2010_TBS,
SUBPARTITION P_RATING_2010_DF VALUES (DEFAULT) TABLESPACE DWH_O_2010_TBS),
PARTITION P_RATING_2011
VALUES LESS THAN (0, 20120101)
SUBPARTITION P_RATING_2011_UCS VALUES (10) TABLESPACE DWH_O_2011_TBS,
SUBPARTITION P_RATING_2011_UCM VALUES (11) TABLESPACE DWH_O_2011_TBS,
-- SUBPARTITION P_RATING_2011_ORBI30 VALUES (30) TABLESPACE DWH_O_2011_TBS,
-- SUBPARTITION P_RATING_2011_ORBI31 VALUES (31) TABLESPACE DWH_O_2011_TBS,
SUBPARTITION P_RATING_2011_CETELEM VALUES (40) TABLESPACE DWH_O_2011_TBS,
-- SUBPARTITION P_RATING_2011_MILES VALUES (60) TABLESPACE DWH_O_2011_TBS,
-- SUBPARTITION P_RATING_2011_BHI VALUES (80) TABLESPACE DWH_O_2011_TBS,
SUBPARTITION P_RATING_2011_DF VALUES (DEFAULT) TABLESPACE DWH_O_2011_TBS),
PARTITION P_RATING_current
VALUES LESS THAN (maxvalue, maxvalue)
SUBPARTITION P_RATING_CUR_UCS VALUES (10) TABLESPACE DWH_O_CRT_UCS_TBS,
SUBPARTITION P_RATING_CUR_UCM VALUES (11) TABLESPACE DWH_O_CRT_UPM_TBS,
-- SUBPARTITION P_RATING_CUR_ORBI30 VALUES (30) TABLESPACE DWH_O_CRT_ORBI30_TBS,
-- SUBPARTITION P_RATING_CUR_ORBI31 VALUES (31) TABLESPACE DWH_O_CRT_ORBI31_TBS,
SUBPARTITION P_RATING_CUR_CETELEM VALUES (40) TABLESPACE DWH_O_CRT_CETELEM_TBS,
-- SUBPARTITION P_RATING_CUR_MILES VALUES (60) TABLESPACE DWH_O_CRT_MILES_TBS,
-- SUBPARTITION P_RATING_CUR_BHI VALUES (80) TABLESPACE DWH_O_CRT_BHI_TBS,
SUBPARTITION P_RATING_CUR_DF VALUES (DEFAULT) TABLESPACE DWH_O_CRT_DF_TBS))
ENABLE ROW MOVEMENT
NOLOGGING
COMPRESS
NOCACHE
NOPARALLEL
MONITORING;
ALTER TABLE DWH_REP.P_RATING DROP COLUMN ID_PARTNER;
ORA-39726: unsupported add/drop column operation on compressed tables
can you checkwith following?
SQL>alter table t set unused column x;
SQL>alter table t drop unused columns;Tom explains it ->http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:69076630635645 -
Skip gather stats for a partition | table from the gather_stats_job in 10g
Hi all,
Can we skip gather statistics for a table or a partition in a partitioned-table from the GATHER_STATS_JOB in Oracle 10g ?
(cause that partition store in an offline-datafile, so GATHER_STATS_JOB had errors when running in sheduled).
Thanks.
Edited by: user8710247 on Nov 26, 2011 6:41 PMGATHER_TABLE_STATS will default to GRANULARITY 'AUTO' which will include Global and Partition Statistics. Global Statistics have to be across all the Partitions -- so Oracle will attempt to read all the partitions for this !
You need to run GATHER_TABLE_STATS with GRANULARITY 'PARTITION' and naming the other Partitions --- i.e. run it for each of the online partitions.
See :
SQL> create table XYZ (col_1 number, col_2 varchar2(5))
2 partition by range (col_1)
3 (partition P1 values less than (10) tablespace HEMANT,
4 partition P2 values less than (100) tablespace USERS)
5 /
Table created.
SQL> insert into XYZ values (5,'Five');
1 row created.
SQL> insert into XYZ values (50,'Fifty');
1 row created.
SQL> exec dbms_stats.gather_table_stats('','XYZ',estimate_percent=>100,granularity=>'ALL');
PL/SQL procedure successfully completed.
SQL> select partition_name, tablespace_name , num_rows, sample_size from user_tab_partitions
2 where table_name = 'XYZ'
3 /
PARTITION_NAME TABLESPACE_NAME NUM_ROWS
SAMPLE_SIZE
P1 HEMANT 1
1
P2 USERS 1
1
SQL>
SQL> exec dbms_stats.lock_table_stats('','XYZ');
PL/SQL procedure successfully completed.
SQL> alter tablespace HEMANT offline;
Tablespace altered.
SQL> exec dbms_stats.gather_table_stats('','XYZ',estimate_percent=>100,granularity=>'ALL');
BEGIN dbms_stats.gather_table_stats('','XYZ',estimate_percent=>100,granularity=>'ALL'); END;
ERROR at line 1:
ORA-20005: object statistics are locked (stattype = ALL)
ORA-06512: at "SYS.DBMS_STATS", line 13159
ORA-06512: at "SYS.DBMS_STATS", line 13179
ORA-06512: at line 1
SQL>
SQL> exec dbms_stats.unlock_table_stats('','XYZ');
PL/SQL procedure successfully completed.
SQL> exec dbms_stats.lock_partition_stats('','XYZ','P1');
PL/SQL procedure successfully completed.
SQL> exec dbms_stats.gather_table_stats('','XYZ',estimate_percent=>100,granularity=>'ALL');
BEGIN dbms_stats.gather_table_stats('','XYZ',estimate_percent=>100,granularity=>'ALL'); END;
ERROR at line 1:
ORA-00376: file 2 cannot be read at this time
ORA-01110: data file 2:
'/usr/oracle/oradata/MONDB/datafile/o1_mf_hemant_7d6m8zkx_.dbf'
ORA-06512: at "SYS.DBMS_STATS", line 13159
ORA-06512: at "SYS.DBMS_STATS", line 13179
ORA-06512: at line 1
SQL>
SQL> exec dbms_stats.gather_table_stats('','XYZ',estimate_percent=>100,partname=>'P2');
BEGIN dbms_stats.gather_table_stats('','XYZ',estimate_percent=>100,partname=>'P2'); END;
ERROR at line 1:
ORA-00376: file 2 cannot be read at this time
ORA-01110: data file 2:
'/usr/oracle/oradata/MONDB/datafile/o1_mf_hemant_7d6m8zkx_.dbf'
ORA-06512: at "SYS.DBMS_STATS", line 13159
ORA-06512: at "SYS.DBMS_STATS", line 13179
ORA-06512: at line 1
SQL> exec dbms_stats.gather_table_stats('','XYZ',estimate_percent=>100,partname=>'P2',granularity=>'GLOBAL AND PARTITION');
BEGIN dbms_stats.gather_table_stats('','XYZ',estimate_percent=>100,partname=>'P2',granularity=>'GLOBAL AND PARTITION'); END;
ERROR at line 1:
ORA-00376: file 2 cannot be read at this time
ORA-01110: data file 2:
'/usr/oracle/oradata/MONDB/datafile/o1_mf_hemant_7d6m8zkx_.dbf'
ORA-06512: at "SYS.DBMS_STATS", line 13159
ORA-06512: at "SYS.DBMS_STATS", line 13179
ORA-06512: at line 1
SQL>
SQL> exec dbms_stats.gather_table_stats('','XYZ',estimate_percent=>100,partname=>'P2',granularity=>'PARTITION');
PL/SQL procedure successfully completed.
SQL>Hemant K Chitale -
Need to alter maxvalue for one Partition table
Hi Guru's,
We have a table xyz with monthly partitions but tablespaces are in yearly basis.
we created the required partitions using exchange partition. Now the Partition for Dec 2007 is having range of MAXVALUE.
But our requirement is to add partition for 2008 now.
So we want to create 12 monthly partitions for 2008 and with a tablespace for that.
but how to change the MAXVALUE to 2008010100 for the partition DEC2007.
Appreciate any quick help !!You can split the last partition to change the partition boundaries.
SQL> r
1 create table t(a date)
2 partition by range(a)(
3 partition p1 values less than (to_date('01.12.2007','dd.mm.yyyy')),
4* partition p2 values less than (maxvalue))
Table created.
SQL> alter table t split partition p2 at (to_date('01.01.2008','dd.mm.yyyy'))
2 into (partition p2,partition p3);
Table altered.
SQL> set lines 200
SQL> r
1 select PARTITION_NAME,HIGH_VALUE from user_tab_partitions
2* where table_name='T'
PARTITION_NAME HIGH_VALUE
P1 TO_DATE(' 2007-12-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIA
P2 TO_DATE(' 2008-01-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIA
P3 MAXVALUE -
Best practice for replicating Partitioned table
Hi SQL Gurus,
Requesting your help on the design consideration for replicating a partitioned table.
1. 4 Partitioned tables (1 master table with foreign key constraints to 3 tables) partitioned based on monthly YYYYMM
2. 1 table has a XML column in it
3. Monthly switch partition to remove old data, since it is having foreign key constraint; disable until the switch is complete
4. 1 month partitioned data is 60 GB
having said the above, wanted to create a copy of the same tables to a different servers.
I can think of
1. Transactional replication, but then worried about the XML column,snapshot size and the alter switch will make the same thing
on the subscriber or row by row delete.
2. Logshipping with standby with every 15 minutes, but then it will be for the entire database; because I have other partitioned monthly table which is of 250 GB worth.
3. Thinking about replicating the Partitioned table as Non Partitioned, in that case how the alter switch will work. Is it possible to ignore delete when setting up the replication.
3. SSIS or Stored procedure method of moving data on a daily basis.
4. Backup and restore on a daily basis, but this will not work when the source partition is removed.
GaneshPlz refer to
http://msdn.microsoft.com/en-us/library/cc280940.aspx -
Default partition name for Interval partitioned tables
Hi ,
Can we change the default partition names which are generated by Oracle.
For Example :
CREATE TABLE part_interval (
id NUMBER,
created_date DATE
PARTITION BY RANGE (created_date)
INTERVAL (NUMTOYMINTERVAL(1,'MONTH'))
PARTITION part_01 values LESS THAN (TO_DATE('01-NOV-2007','DD-MON-YYYY'))
Now if I insert values which doesn't fall in the 01-NOV-2007 date, a new partition is created like SYS_P43. Can I change this default partition name in the SQL statement itself . Not through procedures or functions.
Regards,
Raghunathan A
Edited by: 869187 on Jun 29, 2011 6:08 AM869187 wrote:
Hi ,
Can we change the default partition names which are generated by Oracle. post SQL & results that show you can change partition names generated by YOU. -
GG replication for interval partitioned tables while issuing drop partition command
Hi all, we have golden gate replication between two databses 1 and 2. table A in 1 and 2 is interval partitioned but the partition names are different. whats the best way to achieve GG replication using drop partition. We want to drop partition automatically in DB 2 if done in DB 1.
Hi,
In this scenario ypu would better to drop manually on both the database, especially for drop you could filter based on operation type and do it manually. -
Help needed in EXPLAIN PLAN for a partitioned table
Oracle Version 9i
(Paste execution plan in a spreadsheet to make sense out of it)
I am trying to tune this query -
select * from comm c ,dates d
where
d.active_period = 'Y'
and c.period = d.period;
Operation Object Name Rows Bytes Cost Object Node In/Out PStart PStop
SELECT STATEMENT Optimizer Mode=CHOOSE 5 M 278887
HASH JOIN 5 M 5G 278887
TABLE ACCESS FULL SCHEMA.DATES 24 1 K 8
PARTITION LIST ALL 1 8
TABLE ACCESS FULL SCHEMA.COMM 6 M 5G 277624 1 8
However, I know that the dates table will return only one record. So, if I add another condition to the above query, I get this execution plan. The comm table is huge but it is partitioned on period.
select * from comm c ,dates d
where
d.active_period = 'Y'
and c.period = qd.period
and c.period = 'OCT-07'
Operation Object Name Rows Bytes Cost Object Node In/Out PStart PStop
SELECT STATEMENT Optimizer Mode=CHOOSE 1 8
MERGE JOIN CARTESIAN 1 9 K 8
TABLE ACCESS FULL SCHEMA.DATES 1 69 8
BUFFER SORT 1 9 K
TABLE ACCESS BY LOCAL INDEX ROWID SCHEMA.COMM 1 9 K 7 7
INDEX RANGE SCAN SCHEMA.COMM_NP9 1 7 7
How can I make the query such that the comm table does not have to traverse all of its partitions? The partitioning is based on quarters so it will get its data in one partition only (in the above example - partition no. 7)
Thanks in advance for writing in your replies :)You need to specify period = 'OCT-07', otherwise there is no way the optimizer can know it needs to access only one partition.
Alternatively, partition the DATES table in exactly the same way on "period", and partition-wise joins should kick in, and effectively accessing only the active partition. -
How to find the partition/overflow tablespace for hash partition?
CREATE TABLE sales(acct_no NUMBER(5),
acct_name CHAR(30),
amount_of_sale NUMBER(6),
week_no INTEGER,
sale_details VARCHAR2(1000),
PRIMARY KEY (acct_no, acct_name, week_no))
ORGANIZATION INDEX
INCLUDING week_no
OVERFLOW
PARTITION BY HASH (week_no)
PARTITIONS 16
STORE IN (tsp101, tbs_scott01)
OVERFLOW STORE IN (tsp101, tbs_scott01);
Query the partition tablespace like below, get null instead of 'tsp101' and 'tbs_scott01':
SELECT tp.PARTITION_NAME, tp.TABLESPACE_NAME
FROM ALL_TAB_PARTITIONS tp, ALL_PART_TABLES pt
WHERE tp.TABLE_NAME='SALES'
AND tp.TABLE_OWNER = pt.OWNER(+) AND tp.TABLE_NAME = pt.TABLE_NAME(+)
ORDER BY PARTITION_POSITIONCREATE TABLE sales(acct_no NUMBER(5),
acct_name CHAR(30),
amount_of_sale NUMBER(6),
week_no INTEGER,
sale_details VARCHAR2(1000),
PRIMARY KEY (acct_no, acct_name, week_no))
ORGANIZATION INDEX
INCLUDING week_no
OVERFLOW
PARTITION BY HASH (week_no)
PARTITIONS 16
STORE IN (tsp101, tbs_scott01)
OVERFLOW STORE IN (tsp101, tbs_scott01);
Query the partition tablespace like below, get null instead of 'tsp101' and 'tbs_scott01':
SELECT tp.PARTITION_NAME, tp.TABLESPACE_NAME
FROM ALL_TAB_PARTITIONS tp, ALL_PART_TABLES pt
WHERE tp.TABLE_NAME='SALES'
AND tp.TABLE_OWNER = pt.OWNER(+) AND tp.TABLE_NAME = pt.TABLE_NAME(+)
ORDER BY PARTITION_POSITION -
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 -
Two billion record limit for non-partitioned HANA tables?
Is there a two billion record limit for non-partitioned HANA tables? I've seen discussion on SCN, but can't find any official SAP documentation.
Hi John,
Yes there is a limit for non-partitioned tables in HANA. In the first page of this document says: SAP HANA Database – Partitioning and Distribution of Large Tables
A non - partitioned table cannot store more than 2 billion rows. By using partitioning, this
limit may overcome by distributing the rows to several partitions. Please note, each partition must not contain more than 2 billion rows.
Cheers,
Sarhan. -
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.
Maybe you are looking for
-
SWA: Web Services call with attachment using 10.1.3 preview?
Has anyone managed to figure out how to invoke a web service with an attachment (using SWA, SOAP with Attachments) with the new 10.1.3 preview release? Or are there any samples/documents that can point me in the right direction on how to do this? Tha
-
Failure to embed Mp4 video [From hard disk and host]
Hi guys, Im Terra - new here and learning DW even more everyday... But I've come stuck the last few hours, so I could do with a little assitance, thanks in advance... I've been trying to insert an mp4 file into a div; which is successful. But when I
-
My Satellite C660 is running very slow
Hi I have a C660-2E1 which has always run very slow since I bought it two years ago and I know I should have done something about it before now. I noticed that it only has 1GB RAM, could this be the problem? I was going to replace the 1 GB with a 4 G
-
Can you connect a iPad USB port into a TV and show the videos you play?
Can you sue the USB to plug into a TV and show the videos?
-
Where is the optimization feature for iMovie 10.0.6?
In the older iMovie, when you imported a movie into your project using iMovie's File >> Import >> Movies... there was an "Optimize Video" checkbox that could be checked or unchecked. Is there a way to do this in the new iMovie? I have a snowfall over