Add default partition to composite partition key
I am partitioning :
PARTITION BY RANGE (key, DATE)
partition p1 VALUES LESS THAN (key value, quarter 1)
partition p_default values (default)
above is not letting me add the default partition:
ORA-14007: missing LESS keyword
How do I add the default partition
What is a "default" partition?
For partitioning demos go to Morgan's Library at www.psoug.org and look up PARTITIONING.
Similar Messages
-
Why does the default install make a partition for boot?
The installer, if one lets it prepare one's hard drive, makes a partition for boot, and formats it as a second extended filesystem. I know that people debate the need for/desirability of a partition for boot, and I do not mean to revive that debate. Rather, I am interested in knowing why the Arch developers, like the developers of some other distributions, such as Gentoo, but unlike some, such as Slackware, call for a boot partition, with ext2fs file system, on a default install. Should Arch users interpret this as a recommendation? Also, why is the partition quite a bit larger (although tiny compared to the available space on hard drives these days) than seems necessary?
Thanks.I've looked at a couple of books and a fair number of internet posts on this, and I must say that these responses are a good deal more concise and clear than what I have come across. I did find it interesting that the Slackware on-line manual doesn't make any effort to encourage it. On the other hand, what you guys are saying sounds sensible enough.
I have both Arch and Gentoo running, sharing a boot partition, which I set at 50MB. I'm using 25% of it, which is why I ask about size - obviously not in terms of overall capacity, but in terms of need.
Why not a lot less - say, even if one is considering dual boot, 20MB? And where do numbers like 32MB come from (the Arch, and indeed Gentoo, default, also referred to by T-Dawg)? Why not use round numbers?
Does 32MB have some rational/irrational/astrological/lucky 7 connection to 64MB RAM, sort of like designating 128MB as swap instead of using numbers like 120MB or 125MB or 130MB?
As you probably know, in Gentoo this stuff is done on the command line in fdisk, and I found it quite odd to be told in their manual to tell fdisk that the boot partition should be 32MB (assuming a single operating system) and swap should be 256MB, especially since fdisk and my hard drive took these numbers with a grain of salt and conspired to adjust them to slightly different numbers complete with decimals. Arch, on default, does the same.
Then I find out that with two operating systems, I'm using about 13MB out of 50MB (or rather 49.9MB, as fdisk and my hard drive decreed)
To change the subject a bit, I think that it is a good idea that the current version of Arch .08 would create, on the default track, a /home partition. There are some nice ideas in the install dialogue, including in the section on setting up a hard drive. -
Drop partition without disabling foreign key
Hi All,
I have parent and child table.
Parent table
create table parent_1
(id number,
create_date date,
constraint parent_1_pk001 PRIMARY KEY (id))
PARTITION BY RANGE (create_date)
INTERVAL (NUMTODSINTERVAL(1,'DAY'))
(PARTITION parent_1_part VALUES LESS THAN ('01-JAN-2010'));
Child Table
create table child_1
(id number,
create_date date,
constraint child_1_fk001 FOREIGN KEY (id)
REFERENCES parent_1 (id))
PARTITION BY RANGE (create_date)
INTERVAL (NUMTODSINTERVAL(1,'DAY'))
(PARTITION create_date_part VALUES LESS THAN ('01-JAN-2010'));
I am having problems dropping partition.
Parent_1
1 26-JUL-12
2 26-JUL-12
Child_1
1 26-JUL-12
alter table CHILD_1 drop partition SYS_P274;
table CHILD_1 altered.
ON DROPPING PARENT PARTITION
alter table parent_1 drop partition SYS_P273;
Error report:
SQL Error: ORA-02266: unique/primary keys in table referenced by enabled foreign keys
02266. 00000 - "unique/primary keys in table referenced by enabled foreign keys"
*Cause: An attempt was made to truncate a table with unique or
primary keys referenced by foreign keys enabled in another table.
Other operations not allowed are dropping/truncating a partition of a
partitioned table or an ALTER TABLE EXCHANGE PARTITION.
*Action: Before performing the above operations the table, disable the
foreign key constraints in other tables. You can see what
constraints are referencing a table by issuing the following
command:
SELECT * FROM USER_CONSTRAINTS WHERE TABLE_NAME = "tabnam";
PLEASE CAN I KNOW IF THERE IS ANY WAY TO DROP PARENT PARTITION WITHOUT DISABLE/ENABLE FOREIGN CONSTRAINTS
ThanksSQL Error: ORA-02266: unique/primary keys in table referenced by enabled foreign keys
02266. 00000 - "unique/primary keys in table referenced by enabled foreign keys"
*Cause: An attempt was made to truncate a table with unique or
primary keys referenced by foreign keys enabled in another table.
Other operations not allowed are dropping/truncating a partition of a
partitioned table or an ALTER TABLE EXCHANGE PARTITION.
*Action: Before performing the above operations the table, disable the
foreign key constraints in other tables. You can't do that until you disable the foreign key constraint
http://jonathanlewis.wordpress.com/2006/12/10/drop-parent-partition/
Hope this helps
Mohamed Houri
www.hourim.wordpress.com -
Errors with partitioning by callback or keys (JNI/Java), bug?
Hello,
Just upgraded to 4.8, to test new partitioning features. Seems to be not working for me, or maybe I'm doing something wrong?
Vista 64-bit, Java 1.6.0_16 32-bit, BDB 4.8.24 32-bit.
Callback-based partitioning:
public class InfoDataPartitionHandler implements PartitionHandler {
@Override
public int partition(Database db, DatabaseEntry key) {
return 0; // just testing
DatabaseConfig cfg = new DatabaseConfig();
cfg.setAllowCreate(true);
cfg.setPartitionByCallback(4, new InfoDataPartitionHandler());
cfg.setType(DatabaseType.BTREE);
Database db = env.openDatabase(null,"test",null,cfg);
And this is what I get when running, looks like a bug actually:
Exception in thread "main" java.lang.IllegalArgumentException: DatabaseEntry must not be null
at com.sleepycat.db.internal.db_javaJNI.Db_set_partition(Native Method)
at com.sleepycat.db.internal.Db.set_partition(Db.java:497)
at com.sleepycat.db.DatabaseConfig.configureDatabase(DatabaseConfig.java:2206)
at com.sleepycat.db.DatabaseConfig.openDatabase(DatabaseConfig.java:2105)
at com.sleepycat.db.Environment.openDatabase(Environment.java:314)
Key-based partitioning
Things are even worse.
DatabaseEntry k1 = new DatabaseEntry();
StringBinding.stringToEntry("111111111111111111111111", k1);
int sz = k1.getSize();
MultipleDataEntry keys = new MultipleDataEntry(new byte[sz]);
keys.append(k1);
DatabaseConfig cfg = new DatabaseConfig();
cfg.setAllowCreate(true);
cfg.setPartitionByRange(2, keys);
cfg.setType(DatabaseType.BTREE);
Database db = new Database("/tmp/test.db", null, cfg);
db.close();
Exception in thread "main" com.sleepycat.db.DatabaseException: DB_NOTFOUND: No matching key/data pair found: DB_NOTFOUND: No matching key/data pair found
at com.sleepycat.db.internal.db_javaJNI.Db_open(Native Method)
at com.sleepycat.db.internal.Db.open(Db.java:449)
at com.sleepycat.db.DatabaseConfig.openDatabase(DatabaseConfig.java:2106)
at com.sleepycat.db.Database.<init>(Database.java:103)
at Temp.main(Temp.java:23)
Please help.Hello. Thanks for this report, both situations you've reported are bugs in Berkeley DB. We are currently validating patches internally.
Please contact me directly at ben dot schmeckpeper at the obvious domain.
Thanks,
Ben -
ORA-14291: cannot EXCHANGE a composite partition with a non-partitioned ta
How do I resolve the below issue. I need to create a temp table and then do a exchange partition to the temp table using certain condition . The main table
edc.edc_log_test has partition and subpartition. I used the below sql to create the temp table. How can I create the temp table with partition so that I do not get the mentioned error.
edc.edc_log_test has
PARTITION BY RANGE(CAPTURE_DATE)
SUBPARTITION BY LIST(TRAN_NBR)
l_ddl := 'create table ' || p_object_owner_in || '.' ||
p_part_subpart_name || ' as select * from ' ||
p_object_owner_in || '.' || p_object_name_in || ' where 1=2';
l_ddl := ' ALTER TABLE ' || p_object_owner_in || '.' ||
p_object_name_in || ' EXCHANGE PARTITION ' ||
p_part_subpart_name || ' WITH TABLE ' ||
p_object_owner_in || '.' || p_part_subpart_name ||
' EXCLUDING INDEXES WITHOUT VALIDATION '; *
ORA-14291: cannot EXCHANGE a composite partition with a non-partitioned tableThe subpartitioning scheme of the composite partitioned table must be matched by a partitioning scheme on the temporary table.
In your case you need to list partition your temporary table on TRAN_NBR -
Any practical experience with composite partitioning range/list?
Hi,
I'm working on Oracle 9.2.0.4 and I plan to migrate several large range partitioned tables into range/list partitioned tables. I was wondering I anybody has some practical experience with this new feature (range/list composite partitioning) and if he encountered any bugs or "undocumented features" ?
Thanks for any feedback
Maurcie
PS: I'm not looking for any documentation about how to do it, I'm just wondering if anyone has some experience in a PRODUCTIVE environment.You can also put the query in a parameter file so you don't have to worry about escaping characters.
Dean -
Moving Composite Partition table
Hi,
i am using 11.2.0.3.0 version of oracle. I am planning to move a composite partition(range-hash) table into a different tablespace. And i was under assumption by moving the table/index subpartition , it will move the wholw table. Below is the scenario.
Now i have moved all the table/Index subpartition into the new tablespace, using below command.
Alter table t1 move subpartition t1_sub1 tablespace new_tablespace;
Alter index id1 rebuild subpartition id1_sub1 tablespace new_ind1_tablespace;
but when i query dba_tab_subpartition i can see the new tablespace against the subpartition name but when i query the data dictionary dba_tab_partitions i am seeing the name of old tablespace against the partition name. And i execute below statement for moving the partition
Alter table t1 move partition t1_p1 tablespace new_tablespace;
It gives error saying : ORA-14257: cannot move partition other than a range,list,system or hash partition.933257 wrote:
Hi,
i am using 11.2.0.3.0 version of oracle. I am planning to move a composite partition(range-hash) table into a different tablespace. And i was under assumption by moving the table/index subpartition , it will move the wholw table. Below is the scenario.
Now i have moved all the table/Index subpartition into the new tablespace, using below command.
Alter table t1 move subpartition t1_sub1 tablespace new_tablespace;
Alter index id1 rebuild subpartition id1_sub1 tablespace new_ind1_tablespace;
but when i query dba_tab_subpartition i can see the new tablespace against the subpartition name but when i query the data dictionary dba_tab_partitions i am seeing the name of old tablespace against the partition name. And i execute below statement for moving the partition
Alter table t1 move partition t1_p1 tablespace new_tablespace;
It gives error saying : ORA-14257: cannot move partition other than a range,list,system or hash partition.
Notice that PARTITION & SUBPARTITION are separate object; which need to be moved independently
06:46:11 SQL> SELECT OBJECT_TYPE, COUNT(*) FROM DBA_OBJECTS GROUP BY OBJECT_TYPE ORDER BY 1;
OBJECT_TYPE COUNT(*)
CLUSTER 10
CONSUMER GROUP 25
CONTEXT 7
DESTINATION 2
DIMENSION 5
DIRECTORY 9
EDITION 2
EVALUATION CONTEXT 14
FUNCTION 309
INDEX 4502
INDEX PARTITION 406
OBJECT_TYPE COUNT(*)
INDEXTYPE 9
JAVA CLASS 22945
JAVA DATA 303
JAVA RESOURCE 840
JAVA SOURCE 6
JOB 18
JOB CLASS 14
LIBRARY 185
LOB 1367
LOB PARTITION 1
MATERIALIZED VIEW 3
OBJECT_TYPE COUNT(*)
OPERATOR 55
PACKAGE 1445
PACKAGE BODY 1385
PROCEDURE 176
PROGRAM 19
QUEUE 45
RESOURCE PLAN 10
RULE 1
RULE SET 23
SCHEDULE 3
SCHEDULER GROUP 4
OBJECT_TYPE COUNT(*)
SEQUENCE 264
SYNONYM 28070
TABLE 3144
TABLE PARTITION 246
TABLE SUBPARTITION 32
TRIGGER 731
TYPE 2891
TYPE BODY 237
UNDEFINED 11
VIEW 5261
WINDOW 9
OBJECT_TYPE COUNT(*)
XML SCHEMA 58
45 rows selected.
06:46:49 SQL> -
Hi all,
I want to understand composite partitioning what i know is the data is first Range partitioned and then List or Hash partitioned and then store. So if we consider the example
CREATE TABLE bimonthly_regional_sales
(deptno NUMBER,
item_no VARCHAR2(20),
txn_date DATE,
txn_amount NUMBER,
state VARCHAR2(2))
PARTITION BY RANGE (txn_date)
SUBPARTITION BY LIST (state)
SUBPARTITION TEMPLATE(
SUBPARTITION east VALUES('NY', 'VA', 'FL') TABLESPACE ts1,
SUBPARTITION west VALUES('CA', 'OR', 'HI') TABLESPACE ts2,
SUBPARTITION central VALUES('IL', 'TX', 'MO') TABLESPACE ts3)
( PARTITION janfeb_2000 VALUES LESS THAN (TO_DATE('1-MAR-2000','DD-MON-YYYY')), PARTITION marapr_2000 VALUES LESS THAN (TO_DATE('1-MAY-2000','DD-MON-YYYY')), PARTITION mayjun_2000 VALUES LESS THAN (TO_DATE('1-JUL-2000','DD-MON-YYYY')) ); here the data is first range partitioned and then list partitioned and then place in a partitioned.
Now what i was thinking was that a particular table space will contain only the data that belongs to a particular range say sales_jan2000 and then that particular table space the data would be subpartioned by list.
but thing is exactly opposite a particular table space contains data of particular hash or list say janfeb_2000_east is created and placed in tablespace ts1 while janfeb_2000_central is created and placed in tablespace ts3.
i am not able to get this how a table is first portioned by range then list when it stored according to list?
please correct me if i am wrongHello
I'm not quite sure what you mean but is this not the result you expect? (changed the tablespace names to existing ones I have)
CREATE TABLE bimonthly_regional_sales
(deptno NUMBER,
item_no VARCHAR2(20),
txn_date DATE,
txn_amount NUMBER,
state VARCHAR2(2))
PARTITION BY RANGE (txn_date)
SUBPARTITION BY LIST (state)
SUBPARTITION TEMPLATE(
SUBPARTITION east VALUES('NY', 'VA', 'FL') tablespace p_app,
SUBPARTITION west VALUES('CA', 'OR', 'HI') tablespace p_indx,
SUBPARTITION central VALUES('IL', 'TX', 'MO') tablespace l_app)
( PARTITION janfeb_2000 VALUES LESS THAN (TO_DATE('1-MAR-2000','DD-MON-YYYY')), PARTITION marapr_2000 VALUES LESS THAN (TO_DATE('1-MAY-2000','DD-MON-YYYY')), PARTITION mayjun_2000 VALUES LESS THAN (TO_DATE('1-JUL-2000','DD-MON-YYYY')) );
SQL> select table_name,partition_name,subpartition_name,tablespace_name from user_tab_subpartitions where table_name='BIMONTHLY_REGIONAL_SALES';
TABLE_NAME PARTITION_NAME SUBPARTITION_NAME TABLESPACE_NAME
BIMONTHLY_REGIONAL_SALES JANFEB_2000 JANFEB_2000_CENTRAL L_APP
BIMONTHLY_REGIONAL_SALES JANFEB_2000 JANFEB_2000_WEST P_INDX
BIMONTHLY_REGIONAL_SALES JANFEB_2000 JANFEB_2000_EAST P_APP
BIMONTHLY_REGIONAL_SALES MARAPR_2000 MARAPR_2000_CENTRAL L_APP
BIMONTHLY_REGIONAL_SALES MARAPR_2000 MARAPR_2000_WEST P_INDX
BIMONTHLY_REGIONAL_SALES MARAPR_2000 MARAPR_2000_EAST P_APP
BIMONTHLY_REGIONAL_SALES MAYJUN_2000 MAYJUN_2000_CENTRAL L_APP
BIMONTHLY_REGIONAL_SALES MAYJUN_2000 MAYJUN_2000_WEST P_INDX
BIMONTHLY_REGIONAL_SALES MAYJUN_2000 MAYJUN_2000_EAST P_APP
9 rows selected.David -
Can I add a new column to a composite primary key without dropping it?
Hi
I need to modify the composite primary key of a table so as to include an another additional column to it?
Can I do that without dropping the PRIMARY KEY constraint on the table?user13410062 wrote:
Hi
I need to modify the composite primary key of a table so as to include an another additional column to it?
Can I do that without dropping the PRIMARY KEY constraint on the table?post results from ALTER TABLE command -
Composite Primary key & Primary key questions
Background:
1.5 TB data warehouse. All tables use at least a 3 column composite Primary key. Most use 3. col1||col2||col3 to achieve uniqueness.
col1= very low cardinality. 99% of the values are '0'
col2 = high cardinality. (SSN's, loaded monthly)
col3 = low cardinality. (monthly sequence number used for partitioning)
From what I've read, the first column used in a composite primary key also receives its own index. If that is correct, then the primary key being used is losing its effectiveness by putting a very low cardinality column as the first column of the Primary key. By moving col2 to the first position of the composite key, I would be obtaining an index on SSN which would be much more useful. (Please correct me if I'm wrong) Or since the index would be so large anyway, the CBO would just do full table scans which is what I'm trying to get away from.
This Primary key is used to ensure uniqueness during loads. Other than that, it really has no purpose and is never queried by the user. (WHERE col1||col2||col3 = xxxxxxxxx)
As a DBA, I see this massive tablespace for holding the primary keys now reaching in excess of 157 GB and it seems like such a waste of space. The problem I'm running across is how to ensure uniqueness during the loads w/o having to store the unique values. (the 157 GB) If I drop the PK's, then create unique indexes just for the loads, then the unique index would be generated against the entire table, which would take forever.
If you create a local index (what I want in the end) it still has to create the index for all previous partitions (250+ partitions). You can't create a specific 'local' index on a partition. You create a local index on the table and when a new partition is added, the index is then added as well. That's what I want to do with some of my fields like SSN but for loading purposes, this isn't going to help me.
I need a way to ensure uniqueness during a monthly load of a new partition (col1||col2||col3) but w/o having to store these values for eternity. Right now it's the primary key, so it has to be stored. I hope I'm making sense here. Any ideas?I think you need some clarification about the index supporting the primary key.
The primary key is unique - the database will enforce this for you.
All of the columns in the primary key are in the index that enforces the key (not just the first column).
Usually this index is a unique index, but you can have a non-unique index supporting a primary key.
I'm a little confused with some of your other statements
how to ensure uniqueness during the loads w/o having to store the unique valuesIf you don't store the value how do you know it is unique?
Did you mean that you don't want to store the key values in both the table and the index?
You may want to consider making col3 (the partition key) the leading column of the index, so you can create a local (instead of global) PK index.
I wouldn't worry too much about col1 (the column full of mostly zeros) - numbers are stored variable length. A NUMBER(38) that holds a zero takes no more space than a NUMBER(1) that holds a zero. -
Update enrolled table which has 6 composite primary key
Hi Everyone,
I am trying to update a grade column in table called enrolled which has 6 composite primary key column including SID, TERMYEAR, FACCODE, DEPCODE, COURSENO, SECNO and 2 extra column including GRADE, IDD all of them are of type VARCHAR2 as describe below:
To update this table I used the command below:
UPDATE enrolled
SET grade = :COURSE_BLOCK.GRADE_TEXT
WHERE IID = :GLOBAL.logUserid
AND SID = :COURSE_BLOCK.SID_TEXT
AND FACCODE = :COURSE_BLOCK.FACULTY_TEXT
AND DEPCODE = :COURSE_BLOCK.DEPARTMENT_TEXT
AND COURSENO = :COURSE_BLOCK.COURSE_TEXT
AND SECNO = :COURSE_BLOCK.SECTION_TEXT;
Note: the :GLOBAL.logUserid is a global variable that I assigned the user id when the user log on to the application.
When I run the application and fill out the form in order to update the table this doesn't update the table and if I use SQL*PLUS as well with the values that I use for the form to update the table I get message: o rows updated
Can Someone help please?Here is the solution.
The problem:
The problem was that the enrolled table was designed in a way that a student can enrolled in the lecture(LEC type column) and Laboratory(LAB type column). When a student is given a grade, it is given a grade for the course 100 (eg: 03-60-100) this course has a lecture and lab. this course belong to the faculty code 03(science) department 60 (computer Science) so when a student register to a course, will register to a lecture and a lab but he will receive a grade for the course 100 lec in this case Oracle couldn't update the table because there was two column with course 100 for that particular student Id
The solution:
There are many solution I believe but my quickest solution is when a student register to the course by default is given a grade 'I' means Incomplete then when the instructor add the grade, he can just update a grade from incomplete to the final grade (eg A) now the code will be to get only the course 100 that has grade and discard that doesn't have grade this means that I need only to make sure that the WHERE Clause grade is not null shown below.
UPDATE enrolled
SET grade = BLOCK_NAME.FIELD_NAME
WHERE grade IS NOY NULL
AND IID = BLOCK_NAME.FIELD
AND faccode = BLOCK_NAME.FIELD
AND depcode = BLOCK_NAME.FIELD
AND courseno= BLOCK_NAME.FIELD_NAME
NAD secno = BLOCK_NAME.FIELD_NAME
AND SID = BLOCK_NAME.FIELD_NAME -
Composite primary key on very large tables...
Hello
So I'm building a database where one of the tables will eventually have > 1 billion rows and was wondering about the primary key. The table will have 3 columns (sample_id, object_id, value) and so I was thinking instead of creating a surrogate key I would create a composite primary key on those 3 columns.... People will query either for sample_id = X or object_id = Y. I've created a composite index on object_id, sample_id and value and the query times have been fast < 2-3s per object_id. Although building that index takes some time (7-8 hrs) what would be the pros/cons to composite PK vs a unique index? I plan to do massive bulk uploads (50M records at a time) so I'll disable the constraints before loading.... These records will also be loaded in order so would a clustered table be appropriate?
thanks
steveHi,
As correctly said by steve,partition the table.
Create a unique index on single column and then even if ur query is not using that column which has index,use a HINT and make it to use the index.
If ur using joins on this table with other tables u can use use_hash hint which will improve performance.
Hope it helps.
Thanks -
Is list partition and hash partition one and the same
I am creating table with partition with the commands
CREATE TABLE ABD (ENO NUMBER(5),CID NUMBER(3),ENAME VARCHAR2(10))
PARTITION BY LIST (ENO)
(PARTITION P1 VALUES (123),
PARTITION P2 VALUES (143),
PARTITION CLIENT_ID VALUES (746))
ALTER TABLE ABD
ADD PARTITION CLIENT_756 VALUES (756)
but when i describe the table script it is showing like this
CREATE TABLE ABD (
ENO NUMBER (5),
ENAME VARCHAR2 (10),
CID NUMBER (3) )
PARTITION BY HASH (ENO)
PARTITIONS 4
STORE IN ( USERS,USERS,USERS,
USERS);
actually i am creating list partition but it is showing hash partition why is it so?when i describe the table script it is showing like thisHow do you describe it, and which version are you on ?
TEST@db102 SQL> CREATE TABLE ABD (ENO NUMBER(5),CID NUMBER(3),ENAME VARCHAR2(10))
2 PARTITION BY LIST (ENO)
3 (PARTITION P1 VALUES (123),
4 PARTITION P2 VALUES (143),
5* PARTITION CLIENT_ID VALUES (746))
TEST@db102 SQL> /
Table created.
TEST@db102 SQL> ALTER TABLE ABD
2* ADD PARTITION CLIENT_756 VALUES (756)
TEST@db102 SQL> /
Table altered.
TEST@db102 SQL> select dbms_metadata.get_ddl('TABLE','ABD','TEST') from dual;
DBMS_METADATA.GET_DDL('TABLE','ABD','TEST')
CREATE TABLE "TEST"."ABD"
( "ENO" NUMBER(5,0),
"CID" NUMBER(3,0),
"ENAME" VARCHAR2(10)
) PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255
STORAGE(
BUFFER_POOL DEFAULT)
TABLESPACE "USERS"
PARTITION BY LIST ("ENO")
(PARTITION "P1" VALUES (123)
PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255
STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
TABLESPACE "USERS" NOCOMPRESS ,
PARTITION "P2" VALUES (143)
PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255
STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
TABLESPACE "USERS" NOCOMPRESS ,
PARTITION "CLIENT_ID" VALUES (746)
PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255
STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
TABLESPACE "USERS" NOCOMPRESS ,
PARTITION "CLIENT_756" VALUES (756)
PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255
STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
TABLESPACE "USERS" NOCOMPRESS )
TEST@db102 SQL> -
How to define Composite primary key for a Table
Hi ,
I am basically more into Java Programming , with little bit knowledge on Oracle as DataBase .so please excuse for my silly doubts .
Can anybody please tell me how to define a Composite Primary Key on a Table .
Thanks in advance .
Edited by: user672373773 on Sep 25, 2009 8:54 AMHere is an example right out of the Oracle documentation and the syntax for adding PK since you mention adding a composite PK.
Example creating composite index
http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14251/adfns_indexing.htm#sthref594
Syntax for adding a PK (composite or not)
alter table oooooooo.tttttttt
add constraint tttttttt_PK
primary key (sample_column2,
sample_column1)
using index
tablespace IDXSPC
pctfree 05
initrans 04
maxtrans 08
storage (initial 16k
next 16k
maxextents 32
pctincrease 0);
-- dictionary management with restricted storage, change as desired.
HTH -- Mark D Powell -- -
In which case composite primary key allows NULL values in it
Hi to all
In what case composite primary key allows nulls in it.
Let us suppose, I created a composite primary key with 2 attributes.
CREATE TABLE sample
BNK_Id NUMBER(6),
BNK_Name VARCHAR2(20),
CONSTRAINT BNK_Id_Name_PK PRIMARY KEY(BNK_Id,BNK_Name)
When it allows null values in it.
thanks in advanceAre you sure that your instructor was not talking about unique keys? As Solomon said, a primary key always implies not null on all of the columns of the PK. However a unique key does not automatically imply not null, and can have nulls in a column as long as the values in the populated columns are unique.
SQL> create table test (
2 id number,
3 pid number,
4 descr varchar2(10));
Table created.
SQL> alter table test add constraint test_unq
2 unique (id, pid);
Table altered.
SQL> insert into test values (1, null, 'desc1');
1 row created.
SQL> insert into test values (2, null, 'desc2');
1 row created.
SQL> insert into test values (2, null, 'fail1');
insert into test values (2, null, 'fail1')
ERROR at line 1:
ORA-00001: unique constraint (OPS$ORACLE.TEST_UNQ) violatedJohn
Maybe you are looking for
-
Number of records in FAGLFLEXT table
Dear colleagues, Could You please tell me what the maximum number of records FAGLFLEXT table may contain. I was said during FI-GL migration project in 2008 that the optimal number of records is 500 000 per year. After having implemented new project w
-
What do I need to edit? Script for Citrix Receiver; <# .SYNOPSIS This script performs the installation or uninstallation of an application(s). .DESCRIPTION The script is provided as a template to perform an install or uninstall of an applic
-
My BB Pearl 8100 is always losing battery charge. Anybody else having this issue and how can I fix it? I charge my BB at least 3 times a day. Once in the morning plugged into the outlet, once during the day at work through a USB port on my compute
-
Sun Java Communications Suite questions
Hi all! This is my first post to these boards so please excuse any board fobars. Anyway, I have been charge with replacing our existing mail system based on POSTFIX, IMAP and SMTP with a better solution and have come to Sun Java Communications Suite
-
Insallation of SAP NW : Error occurred during initialization of VM !!!
Hi everyone, I have reinstalled the SAP NetWeaver 2004s SP9, the installation went well, but this time i have some problems with the J2EE Server (with an exit code equal to -2) The result of the Developer trace is : [Thr 3100] JStartupICheckFramework