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
Similar Messages
-
How to move a partitioned table
Hi,
i have a partitioned table where i am inserting records using direct-path and deleting records( no conventional load) . Now coz of deletions there are many blocks that are free below High Water Mark. so it thought of moving table from one tablespace to another tablespace. And when i treid to do that it gave an error and i found that i cant mov a partitioned table. i can move only partitions. and the table has 60 partitions. So can anyone help me in this? ANy other way to reclaim those free space below HWM? i am in 9i R2
Thanks in advanceDid you try "shrink" command??
Rgrds,
Paulo Portugal. -
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?
RegardsNo, 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. -
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 move lob segment in partitioned table
On my Oracle 11.2, I have a partitioned table wich I would like to move to another tablespace
After invoking script, there's still unmoved lob segment withing table
CREATE TABLE BONGO.AAA_3
ID NUMBER,
DATUM DATE,
OBJEKAT BLOB
TABLESPACE BONGODATA_HUGE
PCTUSED 40
PCTFREE 10
INITRANS 1
MAXTRANS 255
LOGGING
PARTITION BY RANGE (DATUM)
PARTITION P_MAXVALUE VALUES LESS THAN (MAXVALUE)
LOGGING
NOCOMPRESS
TABLESPACE BONGODATA_HUGE
LOB (OBJEKAT) STORE AS
( TABLESPACE BONGODATA
ENABLE STORAGE IN ROW
CHUNK 8192
RETENTION
NOCACHE
STORAGE (
INITIAL 64K
NEXT 1M
MINEXTENTS 1
MAXEXTENTS UNLIMITED
PCTINCREASE 0
FREELISTS 1
FREELIST GROUPS 1
BUFFER_POOL DEFAULT
PCTUSED 40
PCTFREE 10
INITRANS 1
MAXTRANS 255
STORAGE (
INITIAL 64K
NEXT 1M
MINEXTENTS 1
MAXEXTENTS UNLIMITED
FREELISTS 1
FREELIST GROUPS 1
BUFFER_POOL DEFAULT
NOCOMPRESS
NOCACHE
NOPARALLEL
MONITORING;how to move this lob segment in partitioned table?
or, is there some package for data move within tablespaces?
regardstnx...
now, I have another problem..
I have a nested table within partitioned table, and I'm trying to move it to another tablespace.
I tried to move child table (of nested type colum), but I didn't succedeed... -
Migrating a new partition table with transportable tablespace
I created a partitioned table with 2 partitions (2010 and 2011) and used transportable tablespace to migrate the data over to a new envionment. My question is, if I decide to add a partition (2012) in the future, can I simply move that new partition along with the associated datafile via transportable tablespace or would I have to move all the partitions (2010, 2011, 2012).
user564785 wrote:
I created a partitioned table with 2 partitions (2010 and 2011) and used transportable tablespace to migrate the data over to a new envionment. My question is, if I decide to add a partition (2012) in the future, can I simply move that new partition along with the associated datafile via transportable tablespace or would I have to move all the partitions (2010, 2011, 2012).Yes why not.
1) create a table as CTAS from 2012 in new Tablespace on source
2) transport the tablespace
3) Add partition to existing partition table Or exchange partition
Oracle has also documented this procedure:
http://docs.oracle.com/cd/B28359_01/server.111/b28310/tspaces013.htm#i1007549 -
Tablespace about partitioned table
Guys,
I've had some issues with the partitioned tables. Scenario is like this..
I have had a table, which was partitioned. I had to move all the partitions of this table to a new one, which worked fine and dropped the old tablespace. But now when i try to split the partition, the table still referes to the old tablespace name at a higer level. How do i change this..
I am refering to the USER_DATA on top, which is the default tablespace for the user.
It looks something like :
CREATE TABLE XCM_CU19_ASGN_DLR
XCM_CONSUMER_PK VARCHAR2(14 BYTE) NOT NULL,
COUNTRY_ISO3_C VARCHAR2(3 BYTE) NOT NULL,
CUST_CUSTOMER_R NUMBER(11) NOT NULL,
CUD_DLR_CTRY_C VARCHAR2(3 BYTE) NOT NULL,
CUD_DLR_C VARCHAR2(8 BYTE) NOT NULL,
CUD_DLR_ROLE_C INTEGER,
CUD_DLR_REF_X VARCHAR2(15 BYTE),
CUD_DLR_ST_Y DATE,
CUD_DLR_END_Y DATE,
P_CUD_DLR_SRC_C INTEGER,
P_UPDATE_ID_C VARCHAR2(8 BYTE),
P_UPDATE_S DATE,
XCM_UPDATE_S DATE,
IBMSNAP_LOGMARKER TIMESTAMP(6)
TABLESPACE USER_DATA
PCTUSED 40
PCTFREE 10
INITRANS 1
MAXTRANS 255
PARTITION BY RANGE (COUNTRY_ISO3_C)
PARTITION PRT001 VALUES LESS THAN ('CZE')
LOGGING
NOCOMPRESS
TABLESPACE XCM04_DATA
PCTUSED 40
PCTFREE 10
INITRANS 10
MAXTRANS 255
STORAGE (
INITIAL 20M
NEXT 20M
MINEXTENTS 1
MAXEXTENTS 501
PCTINCREASE 0
FREELISTS 1
FREELIST GROUPS 1
BUFFER_POOL DEFAULT
PARTITION PRT002 VALUES LESS THAN ('DNK')
LOGGING
NOCOMPRESS
TABLESPACE XCM04_DATA
PCTUSED 40
PCTFREE 10
INITRANS 10
MAXTRANS 255
STORAGE (
INITIAL 20M
NEXT 20M
MINEXTENTS 1
MAXEXTENTS 501
PCTINCREASE 0
FREELISTS 1
FREELIST GROUPS 1
BUFFER_POOL DEFAULT
PARTITION PRT003 VALUES LESS THAN ('FIN')
LOGGING
NOCOMPRESS
TABLESPACE XCM04_DATA
PCTUSED 40
PCTFREE 10
INITRANS 10
MAXTRANS 255
STORAGE (
INITIAL 20M
NEXT 20M
MINEXTENTS 1
MAXEXTENTS 501
PCTINCREASE 0
FREELISTS 1
FREELIST GROUPS 1
BUFFER_POOL DEFAULT
PARTITION PRT004 VALUES LESS THAN ('GBR')
LOGGING
NOCOMPRESS
TABLESPACE XCM04_DATA
PCTUSED 40
PCTFREE 10
INITRANS 10
MAXTRANS 255
STORAGE (
INITIAL 20M
NEXT 20M
MINEXTENTS 1
MAXEXTENTS 501
PCTINCREASE 0
FREELISTS 1
FREELIST GROUPS 1
BUFFER_POOL DEFAULT
PARTITION PRT005 VALUES LESS THAN ('GIB')
LOGGING
NOCOMPRESS
TABLESPACE XCM04_DATA
PCTUSED 40
PCTFREE 10
INITRANS 10
MAXTRANS 255
STORAGE (
INITIAL 20M
NEXT 20M
MINEXTENTS 1
MAXEXTENTS 501
PCTINCREASE 0
FREELISTS 1
FREELIST GROUPS 1
BUFFER_POOL DEFAULT
PARTITION PRT006 VALUES LESS THAN ('ITA')
LOGGING
NOCOMPRESS
TABLESPACE XCM04_DATA
PCTUSED 40
PCTFREE 10
INITRANS 10
MAXTRANS 255
STORAGE (
INITIAL 20M
NEXT 20M
MINEXTENTS 1
MAXEXTENTS 501
PCTINCREASE 0
FREELISTS 1
FREELIST GROUPS 1
BUFFER_POOL DEFAULT
PARTITION PRT007 VALUES LESS THAN ('USA')
LOGGING
NOCOMPRESS
TABLESPACE XCM04_DATA
PCTUSED 40
PCTFREE 10
INITRANS 10
MAXTRANS 255
STORAGE (
INITIAL 20M
NEXT 20M
MINEXTENTS 1
MAXEXTENTS 501
PCTINCREASE 0
FREELISTS 1
FREELIST GROUPS 1
BUFFER_POOL DEFAULT
PARTITION PRT008 VALUES LESS THAN (MAXVALUE)
LOGGING
NOCOMPRESS
TABLESPACE XCM04_DATA
PCTUSED 40
PCTFREE 10
INITRANS 10
MAXTRANS 255
STORAGE (
INITIAL 20M
NEXT 20M
MINEXTENTS 1
MAXEXTENTS 501
PCTINCREASE 0
FREELISTS 1
FREELIST GROUPS 1
BUFFER_POOL DEFAULT
NOCACHE
PARALLEL ( DEGREE 8 INSTANCES 1 )
ENABLE ROW MOVEMENT;ThanksI've done this before but I couldn't find it quickly... hence I thought it was the MOVE TABLESPACE clause. But now I think what I did was:
ALTER TABLE xxx MODIFY DEFAULT ATTRIBUTES TABLESPACE yyy;See
http://download-east.oracle.com/docs/cd/B19306_01/server.102/b14200/statements_3001.htm#i2131000
Cheers,
Colin -
How to import partitioned tables in different tablespace
Hi everyone,
I try to import the partitioned tables in different tablespace.
Consider the following situation:
I have a dump file which is created by using "Export" utility. Some data are in partitioned tables, some of them are in non-partitioned tables. Also, all tables are located in "MYTBS" tablesapce. I try to import all data from this dump file to another database. I didn't get error messages when importing the data from non-partitioned tables. However, I got error message when importing the data from partitioned tables. The error message is: tablespace 'MYTBS' does not exist.
I just want to how I can solve this problem other than create 'MYTBS' tablespace for my new database.
Thanks in advance.
AngelHi,
I got the following error message:
IMP-00017: following statement failed with ORACLE error 959:
"CREATE TABLE "FACILITYCONNECTION",....., "CONNECTIONTYPE" "
"NUMBER(1, 0) NOT NULL ENABLE) PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 25"
"5 PARALLEL ( DEGREE DEFAULT INSTANCES 1) NOLOGGING STORAGE( PCTINCREASE 0) "
"TABLESPACE "MYTBS" PARTITION BY RANGE ("CONNECTIONTYPE" ) (PARTITION "
""EXT" VALUES LESS THAN (1) PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 S"
"TORAGE(INITIAL 65536) TABLESPACE "MYTBS" NOLOGGING, PARTITION "FAC" VA"
"LUES LESS THAN (2) PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 STORAGE(I"
"NITIAL 65536) TABLESPACE "MYTBS" NOLOGGING )"
IMP-00003: ORACLE error 959 encountered
ORA-00959: tablespace 'MYTBS' does not exist
Thanks.
Angel -
Oracle 11gR2 Partition tables not creating in default user tablespace
Hi all:
Not sure if i'm missing something or overlooked but when i create a partition table in a user schema, it is not creating in the schema's default tablespace instead creating with no assigned to any and using SYSTEM tablesspace.
create user dgp identified by dgp default tablespace dgp temporary tablespace temp;
grant connect, resource to dgp;select USERNAME,DEFAULT_TABLESPACE from dba_users where username ='DGP';
USERNAME DEFAULT_TABLESPACE
DGP DG
select table_name, tablespace_name, partitioned from all_tables where owner='DGP';
TABLE_NAME TABLESPACE_NAME PAR
AUDITLOG_P2 DG NO
AUDITLOG_P YES
This is the partition script i used --i also gave the tablespace name:
CREATE TABLE dgp.AUDITLOG_P(
entry_time DATE,
username VARCHAR2(14),
groupname VARCHAR2(100),
ip VARCHAR2(15),
command VARCHAR2(15),
directory VARCHAR2(300)
PARTITION BY RANGE (entry_time)
partition P_PAST VALUES LESS THAN (TO_DATE('2010-01-01','YYYY-MM-DD')),
tablespace DG;
============
What is it i'm missing? Anything different with Oracle 11gR2 on the partition creations?
Thanks for your help..
Regards,
AshYes, i tried using the schema login adn creating the table as well as system with schemaname prefix....
this is what i get from the below
SQL> select def_tablespace_name from dba_part_tables where table_name ='AUDITLOG_P';
DEF_TABLESPACE_NAME
DG
SQL> select partition_name, tablespace_name from dba_tab_partitions where table_name='AUDITLOG_P';
PARTITION_NAME TABLESPACE_NAME
P_PAST DG
P_20100101 DG
P_20100102 DG
P_20100103 DG
P_20100104 DG
P_20100105 DG
P_20100106 DG
P_20100107 DG
P_20100108 DG
P_20100109 DG
P_20100110 DG
P_20100111 DG
P_20100112 DG
P_20100113 DG
P_20100114 DG
P_20100115 DG
P_20100116 DG
P_20100117 DG
P_20100118 DG
P_20100119 DG
P_20100120 DG
P_20100121 DG
P_20100122 DG
P_20100123 DG
P_20100124 DG
P_20100125 DG
P_20100126 DG
P_20100127 DG
P_20100128 DG
P_20100129 DG
P_FUTURE DG
31 rows selected. -
How to move all the tables from one tablespace to other for a whole schema
Hi,
Is there any way to move all the tables in a schema from one tablespace to other?
If so please help me out to do that.
Thanks
Regards
Gathahi,
here is the steps to move SCOTT's objects from their current tablespace to a NEW_TABLESPACE
would be:
1) do an export of all of scott's objects. Make sure no one modifies them after you
begin this process. You will lose these changes if they do.
$ exp userid=scott/tiger owner=scott
2) you would drop all of scotts tables. This will get the indexes as well. I don't
suggest dropping the user SCOTT but rather dropping scott's objects. Dropping scott
would cause any system priveleges SCOTT has to disappear and the import would not restore
them. This script can be used to drop someones tables:
set heading off
set feedback off
set verify off
set echo off
spool tmp.sql
select 'drop table &1..' || table_name || ' cascade constraints;'
from dba_tables
where owner = upper('&1')
spool off
@tmp.sql
3) You would modify the user to not have unlimited tablespace (else the IMP will just
put the objects right back into the tablespace they came from) and then give them
unlimited quota's on the new tablespace you want the objects to go into and on their
temporary tablespace (for the sorts the index creates will do)
alter user SCOTT default tablespace NEW_TABLESPACE
revoke unlimited tablespace from SCOTT
alter user SCOTT quota unlimited on NEW_TABLESPACE
alter user SCOTT quota unlimited on SCOTTS_TEMPORARY_TABLESPACE
4) you will IMP the data back in for that user. IMP will rewrite the create statements
to use the users default tablespace when it discovers that it cannot create the objects
in their original tablespace. Please make sure to review the file imp.log after you do
this for any and all errors after you import.
imp userid=scott/tiger full=y ignore=y log=imp.log
5) you can optionally restore 'unlimited tablespace' to this user (or not). If you do
not, this user can only create objects in this new tablespace and temp (which in itself
is not a bad thing)...
Regards,
Mohd Mehraj Hussain
http://mehrajdba.wordpress.com -
Assigning dedicated tablespaces to partitioned table 11g
Hi,
I'm facing an issue trying to assign a dedicated tablespace to a range partitioned table using the NUMTOYMINTERVAL clause.
I'm working on Oracle 11g version and I would use the auto partition creation feature in order to create
each month a new partition to use in a log table.
Using the create statement, all work fine.
If I try to use the alter table statement, i got an error.
I understand that i cannot add a new partition (Oracle automatic feature)
but I need to assign a dedicated tablespace to the new partition Oracle is going to create.
Someone could help me?
Thank you in advance.Adding an example on MyTable:
CREATE TABLE "MyTable"
( "ID" NUMBER,
"CREATION_DATE" TIMESTAMP (6) DEFAULT SYSTIMESTAMP,
"PARTITION_DATE" DATE DEFAULT TRUNC(SYSDATE),
"TIMESTAMP" VARCHAR2(50 BYTE),
"FAULT_GENERATING_REQUEST" CLOB
PARTITION BY RANGE(PARTITION_DATE)
INTERVAL(NUMTOYMINTERVAL(1,'MONTH')) STORE IN (LOGTBS0512,LOGTBS0612,LOGTBS0712,LOGTBS0812)
(PARTITION NEWCO_P_LOG0512 VALUES LESS THAN (TO_DATE('01-05-2012', 'DD-MM-YYYY'))
TABLESPACE LOGTBS0512
LOB ("FAULT_GENERATING_REQUEST") STORE AS(TABLESPACE LOG_LOB_0512 cache storage(freelists 10)),
PARTITION NEWCO_P_LOG0612 VALUES LESS THAN (TO_DATE('01-06-2012', 'DD-MM-YYYY'))
TABLESPACE LOGTBS0612
LOB ("FAULT_GENERATING_REQUEST") STORE AS(TABLESPACE LOG_LOB_0612 cache storage(freelists 10)),
PARTITION NEWCO_P_LOG0712 VALUES LESS THAN (TO_DATE('01-07-2012', 'DD-MM-YYYY'))
TABLESPACE LOGTBS0712
LOB ("FAULT_GENERATING_REQUEST") STORE AS(TABLESPACE LOG_LOB_0712 cache storage(freelists 10)),
PARTITION P_LOG0812 VALUES LESS THAN (TO_DATE('01-08-2012', 'DD-MM-YYYY'))
TABLESPACE LOGTBS0812
LOB ("FAULT_GENERATING_REQUEST") STORE AS(TABLESPACE LOG_LOB_0812 cache storage(freelists 10)); -
Assign dedicated tablespaces to partitioned table
Hi,
I'm facing an issue trying to assign a dedicated tablespace to a range partitioned table using the NUMTOYMINTERVAL clause. I'm working on Oracle 11g version and I would use the auto partition creation feature in order to create each month a new partition to use in a log table. Using the create statement, all work fine. If I try to use the alter table statement, i got an error. I understand that i cannot add a new partition (Oracle automatic feature) but I need to assign a dedicated tablespace to the new partition Oracle is going to create. Someone could help me?
Thank you in advance.I also searching for same solutions. If anyone has an idea please let me know.
-
Move data from Non Partitioned Table to Partitioned Table
Hi Friends,
I am using Oracle 11.2.0.1 DB
Please let me know how can i copy /move the data from Non -Partitioned Oracle table to the currently created Partiotioned table.
Regards,
DB839396 wrote:
Hi All,
Created Partitioned table but unable to copy the data from Non Partitioned table:
SQL> select * from sales;
SNO YEAR NAME
1 01-JAN-11 jan2011
1 01-FEB-11 feb2011
1 01-JAN-12 jan2012
1 01-FEB-12 feb2012
1 01-JAN-13 jan2013
1 01-FEB-13 feb2013into which partition should row immediately above ("01-FEB-13") be deposited?
[oracle@localhost ~]$ oerr ora 14400
14400, 00000, "inserted partition key does not map to any partition"
// *Cause: An attempt was made to insert a record into, a Range or Composite
// Range object, with a concatenated partition key that is beyond
// the concatenated partition bound list of the last partition -OR-
// An attempt was made to insert a record into a List object with
// a partition key that did not match the literal values specified
// for any of the partitions.
// *Action: Do not insert the key. Or, add a partition capable of accepting
// the key, Or add values matching the key to a partition specification>
6 rows selected.
>
SQL>
SQL> create table sales_part(sno number(3),year date,name varchar2(10))
2 partition by range(year)
3 (
4 partition p11 values less than (TO_DATE('01/JAN/2012','DD/MON/YYYY')),
5 partition p12 values less than (TO_DATE('01/JAN/2013','DD/MON/YYYY'))
6 );
Table created.
SQL> SELECT table_name,partition_name, num_rows FROM user_tab_partitions;
TABLE_NAME PARTITION_NAME NUM_ROWS
SALES_PART P11
SALES_PART P12
UNPAR_TABLE UNPAR_TABLE_12 776000
UNPAR_TABLE UNPAR_TABLE_15 5000
UNPAR_TABLE UNPAR_TABLE_MX 220000
SQL>
SQL> insert into sales_part select * from sales;
insert into sales_part select * from sales
ERROR at line 1:
ORA-14400: inserted partition key does not map to any partition
Regards,
DB -
Should we have to mention tablespace while we partition a table???
Should we have to mention our new tablespace while we partition a table???
You can create a table with multiple partitions and put all each those partitions into one tablespace
Take a look at this example:
http://www.oracle-dba-online.com/sql/oracle_table_partition.htm
And from Documentation:
Although you are not required to keep each table or index partition (or subpartition) in a separate tablespace, it is to your advantage to do so. Storing partitions in separate tablespaces enables you to:
Reduce the possibility of data corruption in multiple partitions
Back up and recover each partition independently
Control the mapping of partitions to disk drives (important for balancing I/O load)
Improve manageability, availability, and performance
http://download.oracle.com/docs/cd/B19306_01/server.102/b14231/partiti.htm#sthref2606
Kamran Agayev A. (10g OCP)
http://kamranagayev.wordpress.com -
Local Vs Global Index on partitioned table?
Hello All,
DESC PS_P1_EMP_QRYSCRTY
Name Null? Type
EMPLID NOT NULL VARCHAR2(11)
EMPL_RCD NOT NULL NUMBER(38)
ROWSECCLASS NOT NULL VARCHAR2(30)
ACCESS_CD CHAR(1)
MY SQL QUERY IS:-
SELECT DISTINCT OPR.OPRID , EMP.EMPLID ,EMP.EMPL_RCD , OPR.CLASSID ,'Y'
FROM PS_SJT_OPR_CLS OPR , PS_P1_EMP_QRYSCRTY EMP
WHERE EMP.ROWSECCLASS=OPR.CLASSID
This query was taking around 15 mins to run at sql-prompt
I have created a partitioned table based on PS_P1_EMP_QRYSCRTY :-
CREATE TABLE PS_P1_EMP_QRYSCRTY_BAK
TABLESPACE PSNEWTAB
PARTITION BY HASH(ROWSECCLASS)
( PARTITION PART1 ,
PARTITION PART2 ,
PARTITION PART3 ,
PARTITION PART4 ,
PARTITION PART5 ,
PARTITION PART6 ,
PARTITION PART7 ,
PARTITION PART8 ,
PARTITION PART9 ,
PARTITION PART10 ,
PARTITION PART11 ,
PARTITION PART12 ,
PARTITION PART13 ,
PARTITION PART14 ,
PARTITION PART15 ,
PARTITION PART16
ENABLE ROW MOVEMENT
AS SELECT * FROM PS_P1_EMP_QRYSCRTY
I created a local index like on PS_P1_EMP_QRYSCRTY_BAK
CREATE INDEX PS_P1_EMP_QRYSCRTY_BAK
ON PS_P1_EMP_QRYSCRTY_BAK(ROWSECCLASS,EMPLID,EMPL_RCD)
TABLESPACE PSINDEX
LOCAL;
The Following is an extract From PS_P1_EMP_QRYSCRTY_BAK
1ST COLUMN =TABLE NAME
2ND COLUMN = PARTITION NAME
3RD COLUMN = NUM OF DISTINCT ROWSECCLASS IN THE PARTITION
4TH COLUMN = NUM OF TOTAL ROWS IN THE PARTITION
TABLE_NAME PARTITION_NAME NUM_OF_DISTINCT_ROWSECCLASS NUM_OF_ROWS
PS_P1_EMP_QRYSCRTY_BAK | PART1 | 25 | 289058
PS_P1_EMP_QRYSCRTY_BAK | PART2 | 25 | 154537
PS_P1_EMP_QRYSCRTY_BAK | PART3 | 27 | 364219
PS_P1_EMP_QRYSCRTY_BAK | PART4 | 33 | 204528
PS_P1_EMP_QRYSCRTY_BAK | PART5 | 23 | 527974
PS_P1_EMP_QRYSCRTY_BAK | PART6 | 22 | 277210
PS_P1_EMP_QRYSCRTY_BAK | PART7 | 23 | 517125
PS_P1_EMP_QRYSCRTY_BAK | PART8 | 30 | 307634
PS_P1_EMP_QRYSCRTY_BAK | PART9 | 28 | 523169
PS_P1_EMP_QRYSCRTY_BAK | PART10 | 38 | 192565
PS_P1_EMP_QRYSCRTY_BAK | PART11 | 27 | 120062
PS_P1_EMP_QRYSCRTY_BAK | PART12 | 33 | 407829
PS_P1_EMP_QRYSCRTY_BAK | PART13 | 37 | 522349
PS_P1_EMP_QRYSCRTY_BAK | PART14 | 25 | 275991
PS_P1_EMP_QRYSCRTY_BAK | PART15 | 21 | 259676
PS_P1_EMP_QRYSCRTY_BAK | PART16 | 23 | 468071
SELECT DISTINCT OPR.OPRID , EMP.EMPLID ,EMP.EMPL_RCD , OPR.CLASSID ,'Y'
FROM PS_SJT_OPR_CLS OPR , PS_P1_EMP_QRYSCRTY_BAK EMP
WHERE EMP.ROWSECCLASS=OPR.CLASSID
Now when i run this query it gives result in around 5-6 mins
MY PS_P1_EMP_QRYSCRTY_BAK table contains sumwhat 6 million rows...
Now My Questions are:-
1) Is the number of partition done by me optimal under these circumstances...i mean can i get better performance By increasing or decreasing the number of partitions.
2) I created local index on PS_P1_EMP_QRYSCRTY_BAK.
Whether creating local or global index will be more beneficial keeping in mind the where clause and Select clause of the query....
SELECT DISTINCT OPR.OPRID , EMP.EMPLID ,EMP.EMPL_RCD , OPR.CLASSID ,'Y'
FROM PS_SJT_OPR_CLS OPR , PS_P1_EMP_QRYSCRTY_BAK EMP
WHERE EMP.ROWSECCLASS=OPR.CLASSID
i mean in where clause rowsecclass is used thats why i partitioned my table on ROWSECCLASS.
And in select clause i m selecting EMPLID and EMPL_RCD
Thats y i made a local index on ROWSECCLASS,EMPLID ,EMPL_RCD .
Thanks
--Pradeep1) Is the number of partition done by me optimal under these circumstances...i mean can i get better performance >By increasing or decreasing the number of partitions.
2) I created local index on PS_P1_EMP_QRYSCRTY_BAK.
Whether creating local or global index will be more beneficial keeping in mind the where clause and Select clause of >the query....You'll have to see for yourself what is optimal. Every system is different. Here are some ideas, though.
Your query
SELECT DISTINCT OPR.OPRID , EMP.EMPLID ,EMP.EMPL_RCD , OPR.CLASSID ,'Y'
FROM PS_SJT_OPR_CLS OPR , PS_P1_EMP_QRYSCRTY_BAK EMP
WHERE EMP.ROWSECCLASS=OPR.CLASSIDappears to read all qualifying rows across all qualifying partitions. Since you are partitioning by an id that would appear to exclude range and list partitioning instead so the hash partition is probably the best for your application.
Regarding global vs local partitions, I have seen timings indicate that global indexes can improve cross-partition queries slighly. I have not worked with partitions for a while but remember that global partition maintenance is difficult; anything the partition structure changes the global index had to be rebuild. You can check the documentation to see if that has changed.
If possible creating a unique index should give better performance than using an index allowing duplicates.
Maybe you are looking for
-
Sharing iMove Projects Libraries with different users on the same machine
I was wonder how two different users on the same machine can share project libraries. Some Context: My daughter has some finished projects in her project library and I either want to import those project into my library or share them so both user acc
-
Repeating structure through the receiver file adapter
I wanted to ask wheter it is possible to create repeating structure through the SAP xi receiver file adapter. What I'm trying to accomplish is this: Item1 Item2 Item1 Item2 (variable number of times). I can accomplish the following: Item1 Item1 Item2
-
Report in R/3 for vendor line item details
Dear friends, Please provide direction on how we can run a report (SAP R3 or BW) that provides the vendor name/and number for all A/P transactions (both via purchase orders and direct pay) by G/L account?. Is it possible in SAP R/3 or do we need to d
-
Direct print a pdf document when download from a website
Hi, all Is that possible to print automatically when a pdf is download from a website with a acrobat plugin? Jack
-
I need to be able to transfer data from a spreadsheet (not from my address book) to create address labels. I have not been able to do this in iWorks so I have been told to buy Office for Mac. I have purchased Office for Mac 2008 Home & Student editio