두 데이터베이스에 동일한 적용 테이블이 있습니다. 데이터베이스 중 하나에 다른 데이터베이스에 대한 링크가 있습니다. Applies 테이블을 제외하고 대부분의 데이터를 채웠습니다 (따라서 삽입 또는 연결에 오류가 없음).
내가 실행하는 명령은 다음과 같습니다.
CREATE SYNONYM APP FOR Applies@"DB.DATA-PC10";
insert into Applies select * from APP where APP.a# in ( select a# from Applicant) and APP.p# in ( select p# from Position);
내가받는 오류는 다음과 같습니다.
ERROR at line 1:
ORA-01502: index 'BKG988.APPLICANT_PKEY' or partition of such index is in unusable state
양쪽에서 임시 PK를 비활성화하려고했습니다.
alter table applies disable constraint applies_pkey;
Table altered.
하지만 여전히 같은 오류가 발생합니다. 누군가 나에게 해결책을 주면 감사합니다.
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
CREATE TABLE Applies(
a# NUMBER(6) NOT NULL, /* Applicant number */
p# NUMBER(8) NOT NULL, /* Position number */
appdate DATE NOT NULL, /* Application date */
CONSTRAINT Applies_pkey PRIMARY KEY ( a#, p# ),
CONSTRAINT Applies_fkey1 FOREIGN KEY ( a# )
REFERENCES Applicant ( a# )
ON DELETE CASCADE,
CONSTRAINT Applies_fkey2 FOREIGN KEY ( p# )
REFERENCES Position ( p# )
ON DELETE CASCADE);
위치 표 :
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
CREATE TABLE Position(
p# NUMBER(8) NOT NULL, /* Position number */
ptitle VARCHAR(30) NOT NULL, /* Position title */
employer VARCHAR(100) NOT NULL, /* Institution name */
salary NUMBER(9,2) NOT NULL, /* Salary */
extras VARCHAR(50) , /* Extras */
specification LONG , /* Specification */
CONSTRAINT Position_pkey PRIMARY KEY ( p# ),
CONSTRAINT Position_fkey1 FOREIGN KEY ( ptitle )
REFERENCES LPTitle ( title ) );
다음은 지원자 표입니다.
CREATE TABLE Applicant(
a# NUMBER(6) NOT NULL, /* Staff number */
fname VARCHAR(20) NOT NULL, /* First name */
lname VARCHAR(30) NOT NULL, /* Last name */
address VARCHAR(50) NOT NULL, /* Street, home number, etc. */
city VARCHAR(30) NOT NULL, /* City */
state VARCHAR(20) NOT NULL, /* State */
phone# NUMBER(10) NOT NULL, /* Phone number */
fax# NUMBER(10) , /* Fax number */
email VARCHAR(50) , /* E-mail address */
acomment LONG , /* Interesting comments from interviews */
CONSTRAINT Applicant_pkey PRIMARY KEY ( a# ),
CONSTRAINT Applicant_fkey1 FOREIGN KEY ( state )
REFERENCES LState ( state ) );
지금까지 다음과 같은 해결책을 찾았습니다.
/* Other option is to define the table DEFERRABLE accrding to Q/A Tom in https://asktom.oracle.com/pls/asktom/f?p=100:11:0%3a%3a%3a%3aP11_QUESTION_ID:8806498660292*/
Alter table applies disable constraint applies_pkey;
Alter table applies disable constraint Applies_fkey1;
Alter table applies disable constraint Applies_fkey2;
CREATE SYNONYM APP FOR Applies@"DB.DATA-PC10";
insert into Applies select * from APP where APP.a# in ( select a# from Applicant) and APP.p# in ( select p# from Position);
Alter table applies enable constraint applies_pkey;
Alter table applies enable constraint Applies_fkey1;
Alter table applies enable constraint Applies_fkey2;
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다