Subject | Add FK Constraint fails with "... object .. is in use" |
---|---|
Author | Bill Meaney |
Post date | 2002-07-09T21:38:20Z |
While running this script in 5.6 we get an error. This error happens quite
frequently but not always, when we try to add a FK constraint.
The GPCSet table in the error message is just created and there is no one
else attached to the database;
===================
Summary version:
CREATE TABLE GPCSet ...;
CREATE TABLE GPCPrd ...;
ALTER TABLE GPCPrd
ADD CONSTRAINT refGPCPrdSet
FOREIGN KEY (GPCSetId)
REFERENCES GPCSet;
ISC ERROR MESSAGE:
unsuccessful metadata update
object GPCSET is in use
===================
Long version:
CREATE TABLE GPCSet (
GPCSetId link NOT NULL,
SetNam uVCSml NOT NULL,
Dsc uVCMed NOT NULL,
CONSTRAINT GPCSetPK
PRIMARY KEY (GPCSetId)
);
COMMIT;
GRANT ALL ON GPCSet TO HARVUSER;
COMMIT;
CREATE TABLE GPCPrd (
PrdId link NOT NULL,
CntEntId link NOT NULL,
EffDt DateTime NOT NULL,
GPCSetId link NOT NULL,
CONSTRAINT GPCPrdPK
PRIMARY KEY (PrdId, CntEntId, EffDt)
);
COMMIT;
GRANT ALL ON GPCPrd TO HARVUSER;
COMMIT;
ALTER TABLE GPCPrd
ADD CONSTRAINT refGPCPrdSet
FOREIGN KEY (GPCSetId)
REFERENCES GPCSet;
/* get error here <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
ISC ERROR MESSAGE:
unsuccessful metadata update
object GPCSET is in use
*/
COMMIT;
===================
Bill Meaney
wameaney@...
[Non-text portions of this message have been removed]
frequently but not always, when we try to add a FK constraint.
The GPCSet table in the error message is just created and there is no one
else attached to the database;
===================
Summary version:
CREATE TABLE GPCSet ...;
CREATE TABLE GPCPrd ...;
ALTER TABLE GPCPrd
ADD CONSTRAINT refGPCPrdSet
FOREIGN KEY (GPCSetId)
REFERENCES GPCSet;
ISC ERROR MESSAGE:
unsuccessful metadata update
object GPCSET is in use
===================
Long version:
CREATE TABLE GPCSet (
GPCSetId link NOT NULL,
SetNam uVCSml NOT NULL,
Dsc uVCMed NOT NULL,
CONSTRAINT GPCSetPK
PRIMARY KEY (GPCSetId)
);
COMMIT;
GRANT ALL ON GPCSet TO HARVUSER;
COMMIT;
CREATE TABLE GPCPrd (
PrdId link NOT NULL,
CntEntId link NOT NULL,
EffDt DateTime NOT NULL,
GPCSetId link NOT NULL,
CONSTRAINT GPCPrdPK
PRIMARY KEY (PrdId, CntEntId, EffDt)
);
COMMIT;
GRANT ALL ON GPCPrd TO HARVUSER;
COMMIT;
ALTER TABLE GPCPrd
ADD CONSTRAINT refGPCPrdSet
FOREIGN KEY (GPCSetId)
REFERENCES GPCSet;
/* get error here <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
ISC ERROR MESSAGE:
unsuccessful metadata update
object GPCSET is in use
*/
COMMIT;
===================
Bill Meaney
wameaney@...
[Non-text portions of this message have been removed]