我需要从oracle sql developer中的特定用户导出所有表。
例如:
连接:所有用户(远程) 用户/方案:user1 表格:table1 表2 餐桌
我需要从user1导出所有表和关系,生成一个.sql或.ddl文件。
在此之后,我将文件导入本地数据库中。
连接:本地 用户/模式:user1(从文件导入) 表格:(导出文件中的所有表格)
我该怎么做?
我尝试使用数据库副本,但是我的远程连接未授予从外部用户获取数据的特权,并且由于我不是远程数据库管理员,所以无法授予特权。
有什么主意吗? 非常感谢。
答案 0 :(得分:2)
我更喜欢老式导出/导入方法。为什么?由于这些实用程序是为此类事物而设计的,因此可以移动事物。
对于这个简单的示例,我连接到11gR2的远程数据库(ORCL)。在导出不包含任何特殊内容的Scott模式时,我使用的是原始 EXP实用程序,而不是Data Pump。它更简单,可以在本地创建DMP文件。
c:\Temp>exp scott/tiger@orcl file=scott_remote.dmp
Export: Release 11.2.0.2.0 - Production on ╚et Pro 27 21:01:50 2018
Copyright (c) 1982, 2009, 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, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Tes
Export done in EE8MSWIN1250 character set and AL16UTF16 NCHAR character set
. exporting pre-schema procedural objects and actions
. exporting foreign function library names for user SCOTT
. exporting PUBLIC type synonyms
. exporting private type synonyms
. exporting object type definitions for user SCOTT
About to export SCOTT's objects ...
. exporting database links
. exporting sequence numbers
. exporting cluster definitions
. about to export SCOTT's tables via Conventional Path ...
. . exporting table BONUS 0 rows exported
. . exporting table DEPT 4 rows exported
. . exporting table EMP 14 rows exported
. . exporting table EMPLOYEES 1 rows exported
. . exporting table SALGRADE 5 rows exported
. . exporting table TEST 1 rows exported
. exporting synonyms
. exporting views
. exporting stored procedures
. exporting operators
. exporting referential integrity constraints
. exporting triggers
. exporting indextypes
. exporting bitmap, functional and extensible indexes
. exporting posttables actions
. exporting materialized views
. exporting snapshot logs
. exporting job queues
. exporting refresh groups and children
. exporting dimensions
. exporting post-schema procedural objects and actions
. exporting statistics
Export terminated successfully without warnings.
c:\Temp>
目标数据库在我的笔记本电脑上为11gXE。 IMP实用程序用于导入数据。我将使用SYSTEM XE用户导入不同的架构(MIKE)-注意FROMUSER
和TOUSER
参数。
c:\Temp>imp system/pwd@xe file=scott_remote.dmp fromuser=scott touser=mike
Import: Release 11.2.0.2.0 - Production on ╚et Pro 27 21:14:58 2018
Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
Connected to: Oracle Database 11g Express Edition Release 11.2.0.2.0 - 64bit Production
Export file created by EXPORT:V11.02.00 via conventional path
Warning: the objects were exported by SCOTT, not by you
import done in EE8MSWIN1250 character set and AL16UTF16 NCHAR character set
import server uses AL32UTF8 character set (possible charset conversion)
. importing SCOTT's objects into MIKE
. . importing table "BONUS" 0 rows imported
. . importing table "DEPT" 4 rows imported
. . importing table "EMP" 14 rows imported
. . importing table "EMPLOYEES" 1 rows imported
. . importing table "SALGRADE" 5 rows imported
. . importing table "TEST" 1 rows imported
About to enable constraints...
Import terminated successfully without warnings.
c:\Temp>
一块蛋糕,不需要任何时间。试试吧。