日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

oracle expdp数据到txt,[20130727]ORACLE 12C使用expdp导出view数据.txt

發布時間:2024/9/19 编程问答 26 豆豆
生活随笔 收集整理的這篇文章主要介紹了 oracle expdp数据到txt,[20130727]ORACLE 12C使用expdp导出view数据.txt 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

[20130727]ORACLE 12C使用expdp導出view數據.txt

12C新特性里面可以定義試圖,然后通過view當作表一樣導出數據,然后導入數據庫,自己做一個測試:

1.建立測試環境:

SQL> @verBANNER--------------------------------------------------------------------------------Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 - 64bit Production

SQL> create view v_emp_dept as select emp.*,dept.dname from dept,emp where dept.deptno=emp.deptno;

--system用戶執行

CREATE OR REPLACE DIRECTORY tmp_expdp AS 'D:\tmp\expdp\';

SQL> GRANT READ, WRITE ON DIRECTORY tmp_expdp TO scott;

Grant succeeded.

SQL> grant? EXP_FULL_DATABASE to scott;

Grant succeeded.

SQL> grant? IMP_FULL_DATABASE to scott;

Grant succeeded.

2.expdp導出視圖信息以及數據:

d:\tmp>expdp scott/tiger@test01p views_as_tables=v_emp_dept directory=tmp_expdp dumpfile=emp_dept.dmp

Export: Release 12.1.0.1.0 - Production on Sun Jul 28 21:50:26 2013

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

Connected to: Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 - 64bit Production

With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options

Starting "SCOTT"."SYS_EXPORT_TABLE_01":? scott/********@test01p views_as_tables=v_emp_dept directory=tmp_expdp dumpfile=emp_dept.dmp */

Estimate in progress using BLOCKS method...

Processing object type TABLE_EXPORT/VIEWS_AS_TABLES/TABLE_DATA

Total estimation using BLOCKS method: 16 KB

Processing object type TABLE_EXPORT/VIEWS_AS_TABLES/TABLE

. . exported "SCOTT"."V_EMP_DEPT"??????????????????????? 9.296 KB????? 14 rows

Master table "SCOTT"."SYS_EXPORT_TABLE_01" successfully loaded/unloaded

******************************************************************************

Dump file set for SCOTT.SYS_EXPORT_TABLE_01 is:

D:\TMP\EXPDP\EMP_DEPT.DMP

Job "SCOTT"."SYS_EXPORT_TABLE_01" successfully completed at Sun Jul 28 21:50:41 2013 elapsed 0 00:00:13

3.impdp導入:

d:\tmp>impdp scott/tiger@test01p? directory=tmp_expdp dumpfile=emp_dept.dmp

Import: Release 12.1.0.1.0 - Production on Sun Jul 28 21:54:57 2013

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

Connected to: Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 - 64bit Production

With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options

Master table "SCOTT"."SYS_IMPORT_FULL_01" successfully loaded/unloaded

Starting "SCOTT"."SYS_IMPORT_FULL_01":? scott/********@test01p directory=tmp_expdp dumpfile=emp_dept.dmp */

Processing object type TABLE_EXPORT/VIEWS_AS_TABLES/TABLE

ORA-39325: TABLE_EXISTS_ACTION cannot be applied to "SCOTT"."V_EMP_DEPT".

Processing object type TABLE_EXPORT/VIEWS_AS_TABLES/TABLE_DATA

Job "SCOTT"."SYS_IMPORT_FULL_01" completed with 1 error(s) at Sun Jul 28 21:55:07 2013 elapsed 0 00:00:07

--視圖存在,無法導入,改名視圖,或者使用remap_table參數。選擇修改視圖看看。

SQL> rename V_EMP_DEPT to V_EMP_DEPT1;

Table renamed.

d:\tmp>impdp scott/tiger@test01p? directory=tmp_expdp dumpfile=emp_dept.dmp

Import: Release 12.1.0.1.0 - Production on Sun Jul 28 22:00:19 2013

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

Connected to: Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 - 64bit Production

With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options

Master table "SCOTT"."SYS_IMPORT_FULL_01" successfully loaded/unloaded

Starting "SCOTT"."SYS_IMPORT_FULL_01":? scott/********@test01p directory=tmp_expdp dumpfile=emp_dept.dmp */

Processing object type TABLE_EXPORT/VIEWS_AS_TABLES/TABLE

Processing object type TABLE_EXPORT/VIEWS_AS_TABLES/TABLE_DATA

. . imported "SCOTT"."V_EMP_DEPT"??????????????????????? 9.296 KB????? 14 rows

Job "SCOTT"."SYS_IMPORT_FULL_01" successfully completed at Sun Jul 28 22:00:24 2013 elapsed 0 00:00:03

SQL> column object_name format a20SQL> select object_id,data_object_id,object_name,object_type? from? dba_objects where wner=user and object_name in ('V_EMP_DEPT','V_EMP_DEPT1');OBJECT_ID DATA_OBJECT_ID OBJECT_NAME????????? OBJECT_TYPE---------- -------------- -------------------- -----------------------92488??????????????? V_EMP_DEPT1????????? VIEW92776????????? 92776 V_EMP_DEPT?????????? TABLE

--可以發現導入后,建立了新表v_emp_dept.

來自 “ ITPUB博客 ” ,鏈接:http://blog.itpub.net/267265/viewspace-767376/,如需轉載,請注明出處,否則將追究法律責任。

總結

以上是生活随笔為你收集整理的oracle expdp数据到txt,[20130727]ORACLE 12C使用expdp导出view数据.txt的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。