지금 하려는 일이 A라는 유저에 있는 테이블 스크립트를 추출해서 B라는 유저에 생성하려고 아래처럼 추출했습니다.
--- 테이블 스크립드 생성
SELECT dbms_metadata.get_ddl('TABLE', TABLE_NAME, owner)
FROM all_tables
WHERE 1=1
and TABLE_NAME = 'TFA_ASET';
아래처럼 추출해서 B라는 유저에 접속해서 실행시키면
ORA-02261 : 고유키 또는 기본키가 이미 존재하고 있습니다.
라고 뜨는데 붉은색 으로 된 부분에서 에러가 발생합니다. 어떤식으로 처리해야 될까요?
CREATE TABLE "US_OTR"."TFA_ASET"
( "COMP_CD" VARCHAR2(3) NOT NULL ENABLE,
"FDST_YN" VARCHAR2(1) NOT NULL ENABLE,
"ASET_NO" VARCHAR2(20) NOT NULL ENABLE,
"ACNT_CD" VARCHAR2(7) DEFAULT NULL,
"ASET_NM" VARCHAR2(100) DEFAULT NULL,
"ACQS_DIV" VARCHAR2(6) DEFAULT NULL,
"ASET_STAT_DIV" VARCHAR2(6) DEFAULT NULL,
"ASET_LCLASS" VARCHAR2(10) DEFAULT NULL,
"ASET_MCLASS" VARCHAR2(10) DEFAULT NULL,
"ASET_SCLASS" VARCHAR2(10) DEFAULT NULL,
"PURC_DEPT_CD" VARCHAR2(7) DEFAULT NULL,
"USE_DEPT_CD" VARCHAR2(7) DEFAULT NULL,
"ACQDT" VARCHAR2(8) DEFAULT NULL,
"ASET_QTY" NUMBER(7,2) DEFAULT 0,
"ASET_PRICE" NUMBER(22,5) DEFAULT 0,
"ACQS_PCST" NUMBER(22,5) DEFAULT 0,
"VTAX" NUMBER(22,5) DEFAULT 0,
"FIX_DPRT_METH" VARCHAR2(1) DEFAULT NULL,
"CNTN_YC" NUMBER(3,0) DEFAULT 0,
"DEPRE_RATE" NUMBER(22,5) DEFAULT 0,
"CO_CNTN_YC" NUMBER(3,0) DEFAULT 0,
"APPRO_SUM_AMT" NUMBER(22,5) DEFAULT 0,
"SPCE" NUMBER(22,5) DEFAULT 0,
"BUY_CUST_CD" VARCHAR2(50) DEFAULT NULL,
"DPRT_END_YYMM" VARCHAR2(6) DEFAULT NULL,
"CO_DPRT_END_DIV" VARCHAR2(1) DEFAULT NULL,
"RMRK" VARCHAR2(4000) DEFAULT NULL,
"FCUR_ACQS_PCST" NUMBER(22,2) DEFAULT 0,
"FRXCG" VARCHAR2(3) DEFAULT NULL,
"EXCHANGE_RT" NUMBER(22,5) DEFAULT 0,
"BUSI_UNIT_CD" VARCHAR2(6) DEFAULT NULL,
"BRND_CD" VARCHAR2(6) DEFAULT NULL,
"CHNL_UNIT_CD" VARCHAR2(6) DEFAULT NULL,
"GOOD_KIND_CD" VARCHAR2(6) DEFAULT NULL,
"ASSETSREVAL_MDL" VARCHAR2(6) DEFAULT NULL,
"SREVAL_FIX_DPRT_METH" VARCHAR2(6) DEFAULT NULL,
"TBUSI_DIV" VARCHAR2(6) DEFAULT NULL,
"OLNLP" NUMBER(22,5) DEFAULT 0,
"PROF_NO" VARCHAR2(20) DEFAULT NULL,
"FSTRM_DAMG_TOT_SUM" NUMBER(22,5) DEFAULT 0,
"FSTRM_REVAL_SUPL" NUMBER(22,5) DEFAULT 0,
"DAMG_DFNLOS_ACNT" VARCHAR2(7) DEFAULT NULL,
"DAMG_DFNLOS_ECHNG_ACNT" VARCHAR2(7) DEFAULT NULL,
"DAMG_DFNLOS_TOT_ACNT" VARCHAR2(7) DEFAULT NULL,
"DEPR_ACNT" VARCHAR2(7) DEFAULT NULL,
"DEPR_TOT_ACNT" VARCHAR2(7) DEFAULT NULL,
"REVAL_LOSS_ACNT" VARCHAR2(7) DEFAULT NULL,
"REVAL_PRFT_ACNT" VARCHAR2(7) DEFAULT NULL,
"REVAL_SUPL_ACNT" VARCHAR2(7) DEFAULT NULL,
"MNG_NO" VARCHAR2(50) DEFAULT NULL,
"INVEST_MNG_NO" VARCHAR2(50) DEFAULT NULL,
"INVEST_MNG_NM" VARCHAR2(100) DEFAULT NULL,
"SOR_ASET_NO" VARCHAR2(20) DEFAULT NULL,
"SLIP_DE" VARCHAR2(8) DEFAULT NULL,
"SLIP_NO" VARCHAR2(5) DEFAULT NULL,
"SLIP_ROW" VARCHAR2(5) DEFAULT NULL,
"PROG_ID" VARCHAR2(30) DEFAULT NULL,
"REGI_ID" VARCHAR2(20) DEFAULT NULL,
"REGI_DT" DATE DEFAULT SYSDATE NOT NULL ENABLE,
"UPDT_ID" VARCHAR2(20) DEFAULT NULL,
"UPDT_DT" DATE NOT NULL ENABLE,
"MNG_DEPR_YN" VARCHAR2(1),
"MNG_CNTN_YC" NUMBER(3,0),
"MNG_DEPRE_RATE" NUMBER(22,5),
"ASET_EXCP_ACNT" VARCHAR2(7),
"ASET_EXCP_AMT" NUMBER(22,5),
"BPLC_CD" VARCHAR2(8),
"SCHD_OVERSITE_DIV" VARCHAR2(1),
"ELCTRN_PRUF_YN" VARCHAR2(1),
"FUND_SCHD_DE" VARCHAR2(8),
"SHOP_CD" VARCHAR2(5),
"MNG_DEPRE_END_YYMM" VARCHAR2(6),
"THERM_END_DEPR_TOT_AMT" NUMBER(22,5),
CONSTRAINT "TFA_ASET_PK" PRIMARY KEY ("COMP_CD", "FDST_YN", "ASET_NO")
USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS
STORAGE(INITIAL 1048576 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
TABLESPACE "TS_OTR_INDX" ENABLE,
SUPPLEMENTAL LOG GROUP "SR_74856" ("COMP_CD", "FDST_YN", "ASET_NO") ALWAYS
) SEGMENT CREATION IMMEDIATE
PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255
NOCOMPRESS LOGGING
STORAGE(INITIAL 1048576 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
TABLESPACE "TS_OTR_DATA"