91超碰碰碰碰久久久久久综合_超碰av人澡人澡人澡人澡人掠_国产黄大片在线观看画质优化_txt小说免费全本

溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

expdp/impdp導入導出后索引約束統計信息情況

發布時間:2020-08-18 15:40:12 來源:ITPUB博客 閱讀:388 作者:不一樣的天空w 欄目:關系型數據庫
實驗如下:
SQL> conn scott/tiger;

Connected.
SQL> select * from tab;

TNAME                                                        TABTYPE         CLUSTERID
------------------------------------------------------------ --------------
BONUS                                                        TABLE
DEPT                                                         TABLE
EMP                                                          TABLE
SALGRADE                                                     TABLE

SQL>
SQL> create table test (id number,name varchar2(10));

Table created.

SQL> alter table test add constraint pk_id primary key(id);

Table altered.

SQL> create index idx_name on test(name);

Index created.

SQL> insert into test values(1,'wagn');

1 row created.

SQL> insert into test values(2,'xue');

1 row created.

SQL> commit;

Commit complete.

SQL> select * from test;

        ID NAME
---------- --------------------
         1 wagn
         2 xue

--分析表:

         
--查詢:
SQL>  set lines 200
SQL>  col owner for a10
SQL>  col SEGMENT_NAME for a25
SQL>  col TABLESPACE_NAME for a25
SQL>  col PARTITION_NAME for a25
SQL> select OWNER, SEGMENT_NAME,TABLESPACE_NAME,PARTITION_NAME, BYTES / 1024 / 1024 size_m from dba_segments where segment_name='TEST';

OWNER      SEGMENT_NAME              TABLESPACE_NAME           PARTITION_NAME                SIZE_M
---------- ------------------------- ------------------------- ------------------------- ----------
SCOTT      TEST                      USERS                                                    .0625
SQL> select OWNER,TABLE_NAME,TABLESPACE_NAME,STATUS,LAST_ANALYZED,PARTITIONED from dba_tables where table_name ='TEST';

OWNER      TABLE_NAME                TABLESPACE_NAME           STATUS   LAST_ANALYZED       PAR
---------- ------------------------- ------------------------- -------- ------------------- ---
SCOTT      TEST                      USERS                     VALID    2018-01-24 00:58:46 NO

SQL>  col index_name for a25
SQL>  col TABLE_OWNER for a15
SQL>  col TABLE_NAME for a25
SQL> select OWNER,INDEX_NAME,TABLE_OWNER,TABLE_NAME,TABLESPACE_NAME,status from dba_indexes where table_name='TEST';

OWNER      INDEX_NAME                TABLE_OWNER     TABLE_NAME                TABLESPACE_NAME           STATUS
---------- ------------------------- --------------- ------------------------- ------------------------- --------
SCOTT      IDX_NAME                  SCOTT           TEST                      USERS                     VALID
SCOTT      PK_ID                     SCOTT           TEST                      USERS                     VALID
 
--創建目錄對象:
SQL> create directory dir as '/home/oracle';

Directory created.

SQL>

--執行導出:
expdp \'\/ as sysdba\' dumpfile=test.dmp directory=dir LOGFILE=test.log  TABLES=scott.test

[oracle@testdb ~]$ expdp \'\/ as sysdba\' dumpfile=test.dmp directory=dir LOGFILE=test.log  TABLES=scott.test

Export: Release 11.2.0.4.0 - Production on Wed Jan 24 01:03:04 2018

Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.

Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
Starting "SYS"."SYS_EXPORT_TABLE_01":  "/******** AS SYSDBA" dumpfile=test.dmp directory=dir LOGFILE=test.log TABLES=scott.test
Estimate in progress using BLOCKS method...
Processing object type TABLE_EXPORT/TABLE/TABLE_DATA
Total estimation using BLOCKS method: 64 KB
Processing object type TABLE_EXPORT/TABLE/TABLE
Processing object type TABLE_EXPORT/TABLE/INDEX/INDEX
Processing object type TABLE_EXPORT/TABLE/CONSTRAINT/CONSTRAINT
Processing object type TABLE_EXPORT/TABLE/INDEX/STATISTICS/INDEX_STATISTICS
Processing object type TABLE_EXPORT/TABLE/STATISTICS/TABLE_STATISTICS
. . exported "SCOTT"."TEST"                              5.414 KB       2 rows
Master table "SYS"."SYS_EXPORT_TABLE_01" successfully loaded/unloaded
******************************************************************************
Dump file set for SYS.SYS_EXPORT_TABLE_01 is:
  /home/oracle/test.dmp
Job "SYS"."SYS_EXPORT_TABLE_01" successfully completed at Wed Jan 24 01:03:15 2018 elapsed 0 00:00:10

[oracle@wang ~]$
--查看導出文件:
[oracle@wang ~]$ ll test*
-rw-r----- 1 oracle oinstall 122880 Jan 24 01:03 test.dmp
-rw-r--r-- 1 oracle oinstall   1308 Jan 24 01:03 test.log
[oracle@wang ~]$
授權:
[oracle@wang ~]$ chmod u+x test*
[oracle@wang ~]$
[oracle@wang ~]$ ll test*
-rwxr----- 1 oracle oinstall 122880 Jan 24 01:03 test.dmp
-rwxr--r-- 1 oracle oinstall   1308 Jan 24 01:03 test.log


導入實驗一:參數exclude不指定,都導入
執行導入:導入到hr用戶、test表空間

impdp \'\/ as sysdba\' dumpfile=test.dmp directory=dir LOGFILE=impdp.log remap_schema=scott:hr REMAP_TABLESPACE=USERS:test tables=scott.test

導入報錯:ORA-01950: no privileges on tablespace 'TEST'
執行:alter user hr quota unlimited on test;
再次執行,如下:

oracle@testdb ~]$ impdp \'\/ as sysdba\' dumpfile=test.dmp directory=dir LOGFILE=impdp.log remap_schema=scott:hr REMAP_TABLESPACE=USERS:test tables=scott.test

Import: Release 11.2.0.4.0 - Production on Wed Jan 24 01:10:50 2018

Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.

Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
Master table "SYS"."SYS_IMPORT_TABLE_01" successfully loaded/unloaded
Starting "SYS"."SYS_IMPORT_TABLE_01":  "/******** AS SYSDBA" dumpfile=test.dmp directory=dir LOGFILE=impdp.log remap_schema=scott:hr REMAP_TABLESPACE=USERS:test tables=scott.test
Processing object type TABLE_EXPORT/TABLE/TABLE
Processing object type TABLE_EXPORT/TABLE/TABLE_DATA
. . imported "HR"."TEST"                                 5.414 KB       2 rows
Processing object type TABLE_EXPORT/TABLE/INDEX/INDEX
Processing object type TABLE_EXPORT/TABLE/CONSTRAINT/CONSTRAINT
Processing object type TABLE_EXPORT/TABLE/INDEX/STATISTICS/INDEX_STATISTICS
Processing object type TABLE_EXPORT/TABLE/STATISTICS/TABLE_STATISTICS
Job "SYS"."SYS_IMPORT_TABLE_01" successfully completed at Wed Jan 24 01:10:54 2018 elapsed 0 00:00:03


[oracle@testdb ~]$

--驗證:
SQL> select OWNER, SEGMENT_NAME,TABLESPACE_NAME,PARTITION_NAME, BYTES / 1024 / 1024 size_m from dba_segments where segment_name='TEST';

OWNER      SEGMENT_NAME              TABLESPACE_NAME           PARTITION_NAME                SIZE_M
---------- ------------------------- ------------------------- ------------------------- ----------
SCOTT      TEST                      USERS                                                    .0625
HR         TEST                      TEST                                                     .0625

SQL> select OWNER,TABLE_NAME,TABLESPACE_NAME,STATUS,LAST_ANALYZED,PARTITIONED from dba_tables where table_name ='TEST';

OWNER      TABLE_NAME                TABLESPACE_NAME           STATUS   LAST_ANALYZED       PAR
---------- ------------------------- ------------------------- -------- ------------------- ---
SCOTT      TEST                      USERS                     VALID    2018-01-24 00:58:46 NO
HR         TEST                      TEST                      VALID    2018-01-24 00:58:46 NO

SQL> select OWNER,INDEX_NAME,TABLE_OWNER,TABLE_NAME,TABLESPACE_NAME,status from dba_indexes where table_name='TEST';

OWNER      INDEX_NAME                TABLE_OWNER     TABLE_NAME                TABLESPACE_NAME           STATUS
---------- ------------------------- --------------- ------------------------- ------------------------- --------
HR         PK_ID                     HR              TEST                      TEST                      VALID
HR         IDX_NAME                  HR              TEST                      TEST                      VALID
SCOTT      IDX_NAME                  SCOTT           TEST                      USERS                     VALID
SCOTT      PK_ID                     SCOTT           TEST                      USERS                     VALID



導入實驗二:指定參數exclude=index,statistics,constraint

--hr用戶下刪除表test:
SQL> conn hr/hr;
Connected.
SQL> drop table test purge;

Table dropped.

--執行導入:
[oracle@wang ~]$ impdp \'\/ as sysdba\' dumpfile=test.dmp directory=dir LOGFILE=impdp.log remap_schema=scott:hr REMAP_TABLESPACE=USERS:test tables=scott.test exclude=index,statistics,constraint

Import: Release 11.2.0.4.0 - Production on Wed Jan 24 01:19:47 2018

Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.

Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
Master table "SYS"."SYS_IMPORT_TABLE_01" successfully loaded/unloaded
Starting "SYS"."SYS_IMPORT_TABLE_01":  "/******** AS SYSDBA" dumpfile=test.dmp directory=dir LOGFILE=impdp.log remap_schema=scott:hr REMAP_TABLESPACE=USERS:test tables=scott.test exclude=index,statistics,constraint
Processing object type TABLE_EXPORT/TABLE/TABLE
Processing object type TABLE_EXPORT/TABLE/TABLE_DATA
. . imported "HR"."TEST"                                 5.414 KB       2 rows
Job "SYS"."SYS_IMPORT_TABLE_01" successfully completed at Wed Jan 24 01:19:50 2018 elapsed 0 00:00:02

[oracle@wang ~]$

--驗證:
SQL> select OWNER, SEGMENT_NAME,TABLESPACE_NAME,PARTITION_NAME, BYTES / 1024 / 1024 size_m from dba_segments where segment_name='TEST';

OWNER      SEGMENT_NAME              TABLESPACE_NAME           PARTITION_NAME                SIZE_M
---------- ------------------------- ------------------------- ------------------------- ----------
SCOTT      TEST                      USERS                                                    .0625
HR         TEST                      TEST                                                     .0625

SQL> select OWNER,TABLE_NAME,TABLESPACE_NAME,STATUS,LAST_ANALYZED,PARTITIONED from dba_tables where table_name ='TEST';

OWNER      TABLE_NAME                TABLESPACE_NAME           STATUS   LAST_ANALYZED       PAR
---------- ------------------------- ------------------------- -------- ------------------- ---
SCOTT      TEST                      USERS                     VALID    2018-01-24 00:58:46 NO
HR         TEST                      TEST                      VALID                        NO

SQL> select OWNER,INDEX_NAME,TABLE_OWNER,TABLE_NAME,TABLESPACE_NAME,status from dba_indexes where table_name='TEST';

OWNER      INDEX_NAME                TABLE_OWNER     TABLE_NAME                TABLESPACE_NAME           STATUS
---------- ------------------------- --------------- ------------------------- ------------------------- --------
SCOTT      IDX_NAME                  SCOTT           TEST                      USERS                     VALID
SCOTT      PK_ID                     SCOTT           TEST                      USERS                     VALID

發現索引和約束都沒有在hr的test表中都沒有,且hr下的test表統計信息也沒有收集!


導入實驗三:指定參數exclude=index

--hr用戶下刪除表test:

SQL> conn hr/hr;
Connected.
SQL> drop table test purge;

Table dropped.

--執行導入:

[oracle@wang ~]$ impdp \'\/ as sysdba\' dumpfile=test.dmp directory=dir LOGFILE=impdp.log remap_schema=scott:hr REMAP_TABLESPACE=USERS:test tables=scott.test exclude=index

Import: Release 11.2.0.4.0 - Production on Wed Jan 24 01:24:54 2018

Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.

Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
Master table "SYS"."SYS_IMPORT_TABLE_01" successfully loaded/unloaded
Starting "SYS"."SYS_IMPORT_TABLE_01":  "/******** AS SYSDBA" dumpfile=test.dmp directory=dir LOGFILE=impdp.log remap_schema=scott:hr REMAP_TABLESPACE=USERS:test tables=scott.test exclude=index
Processing object type TABLE_EXPORT/TABLE/TABLE
Processing object type TABLE_EXPORT/TABLE/TABLE_DATA
. . imported "HR"."TEST"                                 5.414 KB       2 rows
Processing object type TABLE_EXPORT/TABLE/CONSTRAINT/CONSTRAINT
Processing object type TABLE_EXPORT/TABLE/STATISTICS/TABLE_STATISTICS
Job "SYS"."SYS_IMPORT_TABLE_01" successfully completed at Wed Jan 24 01:24:56 2018 elapsed 0 00:00:02

[oracle@wang ~]$ 

--驗證:
SQL> select OWNER, SEGMENT_NAME,TABLESPACE_NAME,PARTITION_NAME, BYTES / 1024 / 1024 size_m from dba_segments where segment_name='TEST';

OWNER      SEGMENT_NAME              TABLESPACE_NAME           PARTITION_NAME                SIZE_M
---------- ------------------------- ------------------------- ------------------------- ----------
SCOTT      TEST                      USERS                                                    .0625
HR         TEST                      TEST                                                     .0625

SQL> select OWNER,TABLE_NAME,TABLESPACE_NAME,STATUS,LAST_ANALYZED,PARTITIONED from dba_tables where table_name ='TEST';

OWNER      TABLE_NAME                TABLESPACE_NAME           STATUS   LAST_ANALYZED       PAR
---------- ------------------------- ------------------------- -------- ------------------- ---
SCOTT      TEST                      USERS                     VALID    2018-01-24 00:58:46 NO
HR         TEST                      TEST                      VALID    2018-01-24 00:58:46 NO

SQL> select OWNER,INDEX_NAME,TABLE_OWNER,TABLE_NAME,TABLESPACE_NAME,status from dba_indexes where table_name='TEST';

OWNER      INDEX_NAME                TABLE_OWNER     TABLE_NAME                TABLESPACE_NAME           STATUS
---------- ------------------------- --------------- ------------------------- ------------------------- --------
HR         PK_ID                     HR              TEST                      TEST                      VALID
SCOTT      IDX_NAME                  SCOTT           TEST                      USERS                     VALID
SCOTT      PK_ID                     SCOTT           TEST                      USERS                     VALID


導入實驗四:指定參數exclude=statistics

--hr用戶下刪除表test:

SQL> conn hr/hr;
Connected.
SQL> drop table test purge;

Table dropped.

--執行導入:
[oracle@wang ~]$ impdp \'\/ as sysdba\' dumpfile=test.dmp directory=dir LOGFILE=impdp.log remap_schema=scott:hr REMAP_TABLESPACE=USERS:test tables=scott.test exclude=statistics

Import: Release 11.2.0.4.0 - Production on Wed Jan 24 01:29:26 2018

Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.

Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
Master table "SYS"."SYS_IMPORT_TABLE_01" successfully loaded/unloaded
Starting "SYS"."SYS_IMPORT_TABLE_01":  "/******** AS SYSDBA" dumpfile=test.dmp directory=dir LOGFILE=impdp.log remap_schema=scott:hr REMAP_TABLESPACE=USERS:test tables=scott.test exclude=statistics
Processing object type TABLE_EXPORT/TABLE/TABLE
Processing object type TABLE_EXPORT/TABLE/TABLE_DATA
. . imported "HR"."TEST"                                 5.414 KB       2 rows
Processing object type TABLE_EXPORT/TABLE/INDEX/INDEX
Processing object type TABLE_EXPORT/TABLE/CONSTRAINT/CONSTRAINT
Job "SYS"."SYS_IMPORT_TABLE_01" successfully completed at Wed Jan 24 01:29:29 2018 elapsed 0 00:00:02

[oracle@wang ~]$

--驗證:
SQL> select OWNER, SEGMENT_NAME,TABLESPACE_NAME,PARTITION_NAME, BYTES / 1024 / 1024 size_m from dba_segments where segment_name='TEST';

OWNER      SEGMENT_NAME              TABLESPACE_NAME           PARTITION_NAME                SIZE_M
---------- ------------------------- ------------------------- ------------------------- ----------
SCOTT      TEST                      USERS                                                    .0625
HR         TEST                      TEST                                                     .0625

SQL> select OWNER,TABLE_NAME,TABLESPACE_NAME,STATUS,LAST_ANALYZED,PARTITIONED from dba_tables where table_name ='TEST';

OWNER      TABLE_NAME                TABLESPACE_NAME           STATUS   LAST_ANALYZED       PAR
---------- ------------------------- ------------------------- -------- ------------------- ---
SCOTT      TEST                      USERS                     VALID    2018-01-24 00:58:46 NO
HR         TEST                      TEST                      VALID                        NO

SQL> select OWNER,INDEX_NAME,TABLE_OWNER,TABLE_NAME,TABLESPACE_NAME,status from dba_indexes where table_name='TEST';

OWNER      INDEX_NAME                TABLE_OWNER     TABLE_NAME                TABLESPACE_NAME           STATUS
---------- ------------------------- --------------- ------------------------- ------------------------- --------
HR         PK_ID                     HR              TEST                      TEST                      VALID
HR         IDX_NAME                  HR              TEST                      TEST                      VALID
SCOTT      IDX_NAME                  SCOTT           TEST                      USERS                     VALID
SCOTT      PK_ID                     SCOTT           TEST                      USERS                     VALID



導入實驗五:指定參數exclude=constraint

--hr用戶下刪除表test:

SQL> conn hr/hr;
Connected.
SQL> drop table test purge;

Table dropped.

--執行導入:
[oracle@wang ~]$ impdp \'\/ as sysdba\' dumpfile=test.dmp directory=dir LOGFILE=impdp.log remap_schema=scott:hr REMAP_TABLESPACE=USERS:test tables=scott.test exclude=constraint

Import: Release 11.2.0.4.0 - Production on Wed Jan 24 01:32:12 2018

Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.

Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
Master table "SYS"."SYS_IMPORT_TABLE_01" successfully loaded/unloaded
Starting "SYS"."SYS_IMPORT_TABLE_01":  "/******** AS SYSDBA" dumpfile=test.dmp directory=dir LOGFILE=impdp.log remap_schema=scott:hr REMAP_TABLESPACE=USERS:test tables=scott.test exclude=constraint
Processing object type TABLE_EXPORT/TABLE/TABLE
Processing object type TABLE_EXPORT/TABLE/TABLE_DATA
. . imported "HR"."TEST"                                 5.414 KB       2 rows
Processing object type TABLE_EXPORT/TABLE/INDEX/INDEX
Processing object type TABLE_EXPORT/TABLE/INDEX/STATISTICS/INDEX_STATISTICS
Processing object type TABLE_EXPORT/TABLE/STATISTICS/TABLE_STATISTICS
Job "SYS"."SYS_IMPORT_TABLE_01" successfully completed at Wed Jan 24 01:32:15 2018 elapsed 0 00:00:02

[oracle@wang ~]$

--驗證:
SQL> select OWNER, SEGMENT_NAME,TABLESPACE_NAME,PARTITION_NAME, BYTES / 1024 / 1024 size_m from dba_segments where segment_name='TEST';

OWNER      SEGMENT_NAME              TABLESPACE_NAME           PARTITION_NAME                SIZE_M
---------- ------------------------- ------------------------- ------------------------- ----------
SCOTT      TEST                      USERS                                                    .0625
HR         TEST                      TEST                                   .0625

SQL>  select OWNER,TABLE_NAME,TABLESPACE_NAME,STATUS,LAST_ANALYZED,PARTITIONED from dba_tables where table_name ='TEST';

OWNER      TABLE_NAME                TABLESPACE_NAME           STATUS   LAST_ANALYZED       PAR
---------- ------------------------- ------------------------- -------- ------------------- ---
SCOTT      TEST                      USERS                     VALID    2018-01-24 00:58:46 NO
HR         TEST                      TEST                      VALID    2018-01-24 00:58:46 NO

SQL> select OWNER,INDEX_NAME,TABLE_OWNER,TABLE_NAME,TABLESPACE_NAME,status from dba_indexes where table_name='TEST';

OWNER      INDEX_NAME                TABLE_OWNER     TABLE_NAME                TABLESPACE_NAME           STATUS
---------- ------------------------- --------------- ------------------------- ------------------------- --------
HR         PK_ID                     HR              TEST                      TEST                      VALID
HR         IDX_NAME                  HR              TEST                      TEST                      VALID
SCOTT      IDX_NAME                  SCOTT           TEST                      USERS                     VALID
SCOTT      PK_ID                     SCOTT           TEST                      USERS                     VALID



總結:expdp/impdp完成后,索引,唯一約束,主鍵還可以生效,索引,約束,統計信息都可以導入,同時注意:expdp/impdp還可以使用并行參數parallel以加快速度!!!!!!!!





向AI問一下細節

免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。

AI

通城县| 双鸭山市| 吉水县| 泰和县| 达孜县| 孟连| 丹寨县| 阿坝| 株洲县| 仲巴县| 若尔盖县| 昆山市| 观塘区| 广东省| 彰化市| 泰顺县| 龙泉市| 武宁县| 大田县| 安远县| 利津县| 张家港市| 朔州市| 庐江县| 涟水县| 和田县| 伽师县| 新建县| 获嘉县| 金坛市| 阿城市| 正宁县| 东兰县| 新河县| 永昌县| 施甸县| 黑龙江省| 长顺县| 泌阳县| 安平县| 阳信县|