Team,
Was doing this and found that after import those table(s) having default sequence.nextval is not available for import.
did i missing something here?
demo@ORA12C> create sequence s;
Sequence created.
demo@ORA12C> create table t1(x int,y int,z int generated by default as identity);
Table created.
demo@ORA12C> create table t2(x int,y int,z int default s.nextval);
Table created.
demo@ORA12C> insert into t1(x,y) values(1,1);
1 row created.
demo@ORA12C> insert into t2(x,y) values(1,1);
1 row created.
demo@ORA12C> select * from t1;
X Y Z
---------- ---------- ----------
1 1 1
demo@ORA12C> select * from t2;
X Y Z
---------- ---------- ----------
1 1 1
demo@ORA12C> host
Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation. All rights reserved.
C:\Users\179818>expdp demo/demo@ora12c directory=TMP tables=T1,T2 dumpfile =demo_exp.dmp log=demo_exp.log
Export: Release 12.2.0.1.0 - Production on Mon Jul 9 12:09:08 2018
Copyright (c) 1982, 2017, Oracle and/or its affiliates. All rights reserved.
Connected to: Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production
Legacy Mode Active due to the following parameters:
Legacy Mode Parameter: "log=demo_exp.log" Location: Command Line, Replaced with: "logfile=demo_exp.log"
Legacy Mode has set reuse_dumpfiles=true parameter.
Starting "DEMO"."SYS_EXPORT_TABLE_01": demo/********@ora12c directory=TMP tables=T1,T2 dumpfile=demo_exp.dmp logfile=demo_exp.log reuse_dumpfiles=true
Processing object type TABLE_EXPORT/TABLE/TABLE_DATA
Processing object type TABLE_EXPORT/TABLE/STATISTICS/TABLE_STATISTICS
Processing object type TABLE_EXPORT/TABLE/STATISTICS/MARKER
Processing object type TABLE_EXPORT/TABLE/TABLE
Processing object type TABLE_EXPORT/TABLE/IDENTITY_COLUMN
. . exported "DEMO"."T1" 0 KB 0 rows
. . exported "DEMO"."T2" 0 KB 0 rows
Master table "DEMO"."SYS_EXPORT_TABLE_01" successfully loaded/unloaded
******************************************************************************
Dump file set for DEMO.SYS_EXPORT_TABLE_01 is:
D:\TRASH\DEMO_EXP.DMP
Job "DEMO"."SYS_EXPORT_TABLE_01" successfully completed at Mon Jul 9 12:10:37 2018 elapsed 0 00:01:13
C:\Users\179818>impdp rajesh/oracle@ora12c directory=TMP dumpfile=demo_exp.dmp logfile=demo2_imp.log remap_schema=DEMO:DEMO2 table_exists_action=REPLACE
Import: Release 12.2.0.1.0 - Production on Mon Jul 9 12:13:39 2018
Copyright (c) 1982, 2017, Oracle and/or its affiliates. All rights reserved.
Connected to: Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production
Master table "RAJESH"."SYS_IMPORT_FULL_01" successfully loaded/unloaded
Starting "RAJESH"."SYS_IMPORT_FULL_01": rajesh/********@ora12c directory=TMP dumpfile=demo_exp.dmp logfile=demo2_imp.log remap_schema=DEMO:DEMO2 table_exists_action=REPLACE
Processing object type TABLE_EXPORT/TABLE/TABLE
Processing object type TABLE_EXPORT/TABLE/TABLE_DATA
. . imported "DEMO2"."T1" 0 KB 0 rows
. . imported "DEMO2"."T2" 0 KB 0 rows
Processing object type TABLE_EXPORT/TABLE/IDENTITY_COLUMN
Processing object type TABLE_EXPORT/TABLE/STATISTICS/TABLE_STATISTICS
Processing object type TABLE_EXPORT/TABLE/STATISTICS/MARKER
Job "RAJESH"."SYS_IMPORT_FULL_01" successfully completed at Mon Jul 9 12:14:10 2018 elapsed 0 00:00:29
C:\Users\179818>exit
demo@ORA12C> conn demo2/demo2@ora12c
Connected.
demo2@ORA12C>
demo2@ORA12C> select * from t1;
no rows selected
demo2@ORA12C> select * from t2;
no rows selected
demo2@ORA12C> insert into t1(x,y) values(1,1);
1 row created.
demo2@ORA12C> insert into t2(x,y) values(1,1);
insert into t2(x,y) values(1,1)
*
ERROR at line 1:
ORA-00942: table or view does not exist
demo2@ORA12C> desc t2
Name Null? Type
-------------------- -------- ---------------
X NUMBER(38)
Y NUMBER(38)
Z NUMBER(38)
demo2@ORA12C> select dbms_metadata.get_ddl('TABLE','T2') from dual;
DBMS_METADATA.GET_DDL('TABLE','T2')
--------------------------------------------------------------------------------
CREATE TABLE "DEMO2"."T2"
( "X" NUMBER(*,0),
"Y" NUMBER(*,0),
"Z" NUMBER(*,0) DEFAULT "DEMO"."S"."NEXTVAL"
) SEGMENT CREATION IMMEDIATE
PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255
NOCOMPRESS LOGGING
STORAGE(INITIAL 65536 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_DATA"
demo2@ORA12C> col object_name format a10
demo2@ORA12C> select object_name, object_type from user_objects where object_name ='T2';
OBJECT_NAM OBJECT_TYPE
---------- -----------------------
T2 TABLE
demo2@ORA12C>
demo2@ORA12C> create sequence s ;
Sequence created.
demo2@ORA12C> insert into t2(x,y) values(1,1);
insert into t2(x,y) values(1,1)
*
ERROR at line 1:
ORA-00942: table or view does not exist
demo2@ORA12C> insert into t2(x,y,z) values(1,2,3);
1 row created.
demo2@ORA12C> insert into t2(x,y) values(1,2);
insert into t2(x,y) values(1,2)
*
ERROR at line 1:
ORA-00942: table or view does not exist
demo2@ORA12C> select * from t2;
X Y Z
---------- ---------- ----------
1 2 3
demo2@ORA12C>