User_cons_columns Gives All constraint [SOLVED]
user_cons_columns Gives All constraint on the table, But is there data dictinary that tell me if that column is PRIMARY KEY constraint or not
Message was edited by: jus
I got it , It is
SELECT col.column_name , c.table_name FROM User_Constraints C , user_cons_columns col WHERE c.constraint_name = col.constraint_name AND C.CONSTRAINT_TYPE = 'P'
DBA_/ALL_/USER_CONSTRAINTS have a CONSTRAINT_TYPE column. A value of 'P' indicates a primary key constraint.
Justin
Similar Messages
-
Function module to give all partner functions for given customer
Can anyone tell me function module name which gives all partner functions for a customer. For ex if we give customer number and sales area then it should give the list of all partner functions of this customer.
I know 'CUSTOMER_PARTNERFS_GET' function module. But I want other than this.Hi,
U can join VBAK and VBPA table and get the parrtners of the customer..
Regards,
Nagaraj -
Is there any standard report which give all information about purchase orde
hi
is there any standard report which give all information about purchase order.
i need following information from Purchase Order.
Vendor No, vendorname, PO No, basic , Excise , insurance , Frieght.
thanks .Hi,
Try following
MC$G PURCHIS: Material Purchase Val Selection
MC$I PURCHIS: Material Purch Qty Selection
Kedar K -
Is there any standard report which give all info about purchase order.
hi
is there any standard report which give all information about purchase order.
i need following information from Purchase Order.
Vendor No, vendorname, PO No, basic Excise insurance Frieght.
Thanks.Hi,
Following are reports for PO list.
ME2C Purchase Orders by Material Group
ME2J Purchase Orders for Project
ME2K Purch. Orders by Account Assignment
ME2L Purchase Orders by Vendor
ME2M Purchase Orders by Material
ME2N Purchase Orders by PO Number
Message was edited by:
Vigneswaran S -
I have 2 GB CompactFlash card that continues to give all my images ...
I have 2 GB CompactFlash card that continues to give all my images the wrong capture date of December 31,1903, I have checked the camera's date, it is correct.
I have deleted all images and formatted the card several times, and problem persists, how do I correct the date for once and for all.
Thank You,
SebastianIt is extremely unlikely that this is a problem with the card. Are you sure that everything is fine with another card? Doing exactly the same thing?
RB -
Root. how to give all the privileges to user?
hi! im root and i want to give all the privileges to my user so he can open any program and any root folder. not in terminal (sudo gparted... for example) but i want to double click the program and open it. im using gnome. also i dont want to right click and open as admin. how can i do that?
thanksjowilkin wrote:
manolos wrote:
eldragon wrote:
no, no, no.....if you really want to do this...get a mac..
there are really good reasons for these limitations in user access..
if you want to stay away from the terminal, i think gksu should help you with that. (still need to type your password though)... if you dont like the terminal, maybe arch linux isnt the right distro for you, how about ubuntu?
its not a solution for me but thanks! ubuntu is very simple. i want to learn from linux... not just install!
Well, first lesson...what you want to do is a really bad idea.
hahaha! ill stay in terminal thanks for the advice! -
Hi I am new to Apple devices, i got a new Ipad mini and i am trying to download skype from the Istore,it asks me to review my account and if i give all the details and click on next, it come to the same page,please help
Oh thank you very much, i was worried after a whole day's hard work but most important that i had lost my photos, i don't understan the photo,shared and albums? I have a lot of photos in my albums that it didn't let me delete, yet i could delete a lot of others, could you explain this to me please
-
Estimate time to enable all constraints and create all indexes
Hi,
To prepare a project to export/import for a whole database,
How can I estimate time required to enable all constraints and create all indexes
* Assume one full table scan per one FK constraint
* Assume one full table scan plus one sort/merge operation per one index
* Check it out whether we can use parallel DDL feature to speed up enabling of FK constraints
how can I use core schema (which will be exp/imp) in the production db to get needed metric for the calcualtion?
thanks
JerryThere is no definative way to find the time it takes to enable a constraint / create a Index
It toatally depends on the Size of the table / execution plan / resources available (In terms of CPU and Physical Memory ) /
Amount of Temporary tablespace -
How to disable all constraints on a table
Hi ,
I want to disable all constraints on a table
select 'ALTER TABLE '||substr(c.table_name,1,35)||
' DISABLE CONSTRAINT '||constraint_name||' ;'
from user_constraints c
where c.table_name = MY_table;
thanks in advanceWhat is wrong with query you have?
Why do you have substr around the table name?
If you want to execute the output as well, do this,
SET SERVEROUT ON
BEGIN
FOR i IN (SELECT 'ALTER TABLE ' || c.table_name || ' DISABLE CONSTRAINT ' || constraint_name AS l_sql, table_name, constraint_name
FROM user_constraints c
WHERE c.table_name = my_table_name)
LOOP
EXECUTE IMMEDIATE i.l_sql;
DBMS_OUTPUT.PUT_LINE ('Disabled constraint ' || i.constraint_name || ' on table ' || i.table_name);
END LOOP;
END;
/ -
PLEASE SEND ME SQL query to list ALL CONSTRAINTS ON EMPLOYEES TABLE FROM OU
PLEASE SEND ME SQL query to list ALL CONSTRAINTS ON EMPLOYEES TABLE FROM OUTSIDE PP SCHEMA INCLUDING SCHEMA NAME AND CONSTraint NAME
Username : PP
Table : EmployeesI think you are looking for below query :
SQL> SHOW USER;
USER is "SCOTT"
SQL> select owner,constraint_name,constraint_type,table_name,r_owner,r_constraint_name
2 from all_constraints
3 where constraint_type='R'
4 and r_constraint_name in (select constraint_name from all_constraints
5 where constraint_type in ('P','U') and table_name='EMP');
OWNER CONSTRAINT_NAME C TABLE_NAME R_OWNER R_CONSTRAINT_NAME
TEST1 ERL_EMP_FK_1 R EMPLOYEE SCOTT PK_EMP
1 row selected.Means, TEST1 user is having a constraint ERL_EMP_FK_1 on his table EMPLOYEE. Which is using PK_EMP (primary key of SCOTT user's 'EMP' [in the query])
Regards
Girish Sharma -
How to disable all Constraints for a Table
Hi There,
So I have a table that I need to delete a significant amount of records from. Using some advice I found it better to select the records that I wanted to keep into a temporary table and then truncate the original table. After that I insert the contents of the temp table into the original table.
So now I am thinking I could speed this up even more if I disable all the constraints on the original table.
Is there an easy way to do this or do I need to disable each constraint individually?
thanks
Johnhttp://forums.oracle.com/forums/search.jspa?threadID=&q=disable+all+constraints+&objID=c84&dateRange=all&userID=&numResults=15
-
How to drop all constraints on a table?
Oracle 11gR2
I tried this but no luck!
ALTER TABLE testDB.dbo.testTable1
DROP ALL CONSTRAINT
GOOracle 11gR2
I tried this but no luck!
ALTER TABLE testDB.dbo.testTable1
DROP ALL CONSTRAINT
GO
You never will have any 'luck' trying to execute SQL SERVER statements on an Oracle database.
There is no Oracle command to drop all constraints from a table.
1. create a new table using CTAS - CREATE newtable AS SELECT * FROM oldtable
2. drop the orginal table - DROP oldtable
3. rename the new table to the old name - RENAME newtable to oldtable
Constraints will be gone. -
Create same table (all constraints)
Hi all
I have a table and I want to duplicate this table. Including all constraints...
I used
create table new_table as
select * from old_table
I created this table, but there's no constraints...
Thanks...Hi,
Then you need use DBMS_METADATA.GET_DDL as others said before.
SGMS@ORACLE10> set linesize 1000
SGMS@ORACLE10> set pagesize 1000
SGMS@ORACLE10> set long 9999999
SGMS@ORACLE10> SELECT DBMS_METADATA.GET_DDL('TABLE','MYTABLE','SGMS') FROM DUAL;
DBMS_METADATA.GET_DDL('TABLE','MYTABLE','SGMS')
CREATE TABLE "SGMS"."MYTABLE"
( "IEM_ENTIDADE" VARCHAR2(2) NOT NULL ENABLE,
"IEM_ANO" CHAR(4) NOT NULL ENABLE,
"IEM_FORMA_ENTRADA" NUMBER(1,0) NOT NULL ENABLE,
"IEM_DOC" NUMBER(6,0) NOT NULL ENABLE,
"IEM_LANC" NUMBER(3,0) NOT NULL ENABLE,
"IEM_ORDEM" NUMBER(3,0) NOT NULL ENABLE,
"IEM_DATA" DATE NOT NULL ENABLE,
"IEM_ALMOX" NUMBER(3,0) NOT NULL ENABLE,
"IEM_ORIGEM" CHAR(3) NOT NULL ENABLE,
"IEM_GRUPO" NUMBER(3,0) NOT NULL ENABLE,
"IEM_CLASSE" NUMBER(3,0) NOT NULL ENABLE,
"IEM_ITEM" NUMBER(4,0) NOT NULL ENABLE,
"IEM_UN_AQUISICAO" VARCHAR2(3) NOT NULL ENABLE,
"IEM_QUANT" NUMBER(15,4) NOT NULL ENABLE,
"IEM_VAL_UNITARIO" NUMBER(11,4) NOT NULL ENABLE,
"IEM_FATOR_CONV" NUMBER(6,0) NOT NULL ENABLE,
"IEM_OPERACAO" CHAR(1) NOT NULL ENABLE,
"IEM_QUANT_DIST" NUMBER(15,4) NOT NULL ENABLE,
"IEM_IPI_VALOR" NUMBER(11,2),
"IEM_IPI_PERCENT" NUMBER(11,2),
"IEM_LOTE" VARCHAR2(20),
"IEM_LOTE_DEST" NUMBER NOT NULL ENABLE,
"IEM_DESCONTO" NUMBER(15,2) DEFAULT 0,
"IEM_DATA_VENC" DATE,
"IEM_GARANTIA" DATE,
"IEM_ASSIST_TECNICA" VARCHAR2(2000),
CONSTRAINT "AETIEM_PK" PRIMARY KEY ("IEM_ENTIDADE", "IEM_ANO", "IEM_FORMA_ENTRADA", "IEM_DOC", "IEM_LANC")
USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS
STORAGE(INITIAL 327680 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
TABLESPACE "SIGMA" ENABLE,
CONSTRAINT "AETIEM_FK" FOREIGN KEY ("IEM_ENTIDADE", "IEM_GRUPO", "IEM_CLASSE", "IEM_ITEM")
REFERENCES "SGMS"."AET_PRO" ("PRO_ENTIDADE", "PRO_GRUPO", "PRO_CLASSE", "PRO_ITEM") ENABLE,
CONSTRAINT "AETIEM_FK1" FOREIGN KEY ("IEM_UN_AQUISICAO")
REFERENCES "SGMS"."AET_PRO_UN" ("UN_SIGLA") ENABLE,
CONSTRAINT "AETIEM_FK2" FOREIGN KEY ("IEM_ENTIDADE", "IEM_ANO", "IEM_FORMA_ENT
RADA", "IEM_DOC")
REFERENCES "SGMS"."AET_EM" ("EM_ENTIDADE", "EM_ANO", "EM_FORMA_ENTRADA", "EM_DOC") ON DELETE CASCADE ENABLE
) PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
STORAGE(INITIAL 786432 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
TABLESPACE "SIGMA"And after this you change the name of the table and perform a insert into select statement
But if you wanted get separeted DDL commands, you can use these options below too:
FK -> select dbms_metadata.get_dependent_ddl ('REF_CONSTRAINT','<table_name>') text from dual;
PK,CHK,UK -> select dbms_metadata.get_dependent_ddl ('CONSTRAINT','<table_name>') text from dual;
TRIGGER -> select dbms_metadata.get_dependent_ddl('TRIGGER','<table_name>') from dual;
INDEX -> select dbms_metadata.get_dependent_ddl('INDEX','<table_name>') from dual;
Example to get just the Foreign Keys:
SGMS@ORACLE10> select dbms_metadata.get_dependent_ddl ('REF_CONSTRAINT','MYTABLE') text from dual;
TEXT
ALTER TABLE "SGMS"."MYTABLE" ADD CONSTRAINT "AETIEM_FK" FOREIGN KEY ("IEM_ENTIDADE", "IEM_GRUPO", "IEM_CLASSE", "IEM_ITEM")
REFERENCES "SGMS"."AET_PRO" ("PRO_ENTIDADE", "PRO_GRUPO", "PRO_CLASSE", "PRO_ITEM") ENABLE
ALTER TABLE "SGMS"."MYTABLE" ADD CONSTRAINT "AETIEM_FK1" FOREIGN KEY ("IEM_UN_AQUISICAO") REFERENCES "SGMS"."AET_PRO_UN" ("UN_SIGLA") ENABLE
ALTER TABLE "SGMS"."MYTABLE" ADD CONSTRAINT "AETIEM_FK2" FOREIGN KEY ("IEM_ENTIDADE", "IEM_ANO", "IEM_FORMA_ENTRADA", "IEM_DOC")
REFERENCES "SGMS"."AET_EM" ("EM_ENTIDADE", "EM_ANO", "EM_FORMA_ENTRADA", "EM_DOC") ON DELETE CASCADE ENABLECheers -
Give all resources to a service/session/user
Hi,
I'm looking for a way to let one user/session/service consume all availabe database resources. A short overview over our system: We've got a primary three node RAC and a physical standby database running on the same host using a different storage subsystem. The standby is primarily used for reporting purposes (active dataguard). We've got a software running that produces highly complex queries. There are about 100 such "datawarehouse" queries running at the same time taking a lot of physical and logical I/O. The problem: Sometimes we receive queries that have highest priority and which must be completed as fast as possible. But as you can imagine there is no chance of getting a fast result when there are 100 other queries running in the background all of which consume lots of I/O.
When I first came to this problem I thought of using the Resource manager. I would create a consumer group, give it about 95% of the resources in every resource plan and map it to a specific service which then can be used to issue critical queries. But when I decided to set this up I came across the documentation which told me that the resource manager only cares about CPU. There is no way to give the session 100% of all availible I/O. Then I read a posting in a forum which told "If there is no CPU for a session it cannot issue I/O requests. So restricting CPU access also restricts I/O". Ok, great.. But the problem is: The critical session will NEVER consume all available CPU power. And because of the Resource managers philosophy that it will only take action when a resource is at it's limit there will never be an restriction on cpu power.
My second approach was to quiesce the database, but that seems to require the sysdba privilege, which I will never give to any software. So my question is: Is there any way to solve this problem?
Many thanks in advance
ThomasHi,
since your are using Active Data Guard, which means you are on 11g, you should take a closer look on DBRM new features - switching plan based on the number of IO requests and active session pool constraints. If I understand your requirements correctly, you can switch your sessions which took too many IO to the constrained consumer group (either automatically or manually) and for that group you can set maximum number of active sessions. In this case, sessions which uses IO and should be constrained can be reduced in their number, which, I think, should reduce their IO needs in total. -
How to view list of all constraints,triggers,procedures ...etc
hi,
how to view a list of all the available constraints, triggers, procedures, functions, packages in a database.And how to view its definition ?user12222356 wrote:
And how to view its definition ?If by definition you mean DDL to create it, use DBMS_METADATA:
SELECT DBMS_METADATA.GET_DDL(object_type,object_name,owner)
FROM DBA_OBJECTS
WHERE OBJECT_TYPE IN ('TRIGGER','PROCEDURE','FUNCTION' )
/For example:
SET LONG 10000
SELECT DBMS_METADATA.GET_DDL(object_type,object_name,owner)
FROM DBA_OBJECTS
WHERE OBJECT_TYPE IN ('TRIGGER','PROCEDURE','FUNCTION' )
DBMS_METADATA.GET_DDL(OBJECT_TYPE,OBJECT_NAME,OWNER)
CREATE OR REPLACE PROCEDURE "SYS"."SUBPTXT2" (name varchar2, subname varchar2,
usr varchar2,
dbname varchar2, dbowner varchar2,
txt in out varchar2) is
status diutil.ub4;
begin -- main
diutil.subptxt(name, subname, usr, dbname, dbowner, txt, status);
if (status <> diutil.s_ok) then
if (status = diutil.s_subpNotFound) then
DBMS_METADATA.GET_DDL(OBJECT_TYPE,OBJECT_NAME,OWNER)
txt := '$$$ s_subpNotFound';
elsif (status = diutil.s_stubTooLong) then
txt := '$$$ s_stubTooLong';
elsif (status = diutil.s_logic) then
txt := '$$$ s_logic';
elsif (status = diutil.s_notInPackage) then
txt := '$$$ s_notInPackage';
else txt := '$$$ s_other';
end if;
end if;
end subptxt2;
DBMS_METADATA.GET_DDL(OBJECT_TYPE,OBJECT_NAME,OWNER)
SQL> SY.
Maybe you are looking for
-
Calculated members in cross tab
Hi all, I have a profit and losses in a cross tab created by a group and I need to add some rows to have the totals. For example Revenue 1 Revenue 2 Revenue 3 Total Revenue Cost 1 Cost 2 Total Costs For total revenue I used a calculated members with
-
How is a digital signature deleted?
I'd like to know where a digital signature is saved on a PC when one is created to sign a PDF file. I remember created one but I have no idea where it is and want to delete it. Any suggestions?
-
Dear All, was looking at LED Cinema display , its came with a cables to connect macbook pro to the LED and its also came with MegaSafe i'm wondering if i can buy this adapter/cables separate if no , which adapter or cables i need to buy 2 connect my
-
Hi, I am trying to setup the OSB Routing a Loan Application which comes with the OSB installation. I followed the steps mentioned in the below URL http://docs.oracle.com/cd/E13171_01/alsb/docs21/tutorial/tutGettingStarted.html#1046994 When I go to St
-
Symbols with MacBook Pro in Windows
I am sorry if this is not the correct place for this question or if it has been asked before, I have been looking but could not find anything about this: I am using a macbook pro with boot camp but I can't manage to get the @ and # key working, is th