windows 如何从 Oracle 11g XE 导出“数据库”并将其导入 Oracle 10.2?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/17918445/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-09 10:45:32  来源:igfitidea点击:

How do I export a 'database' from Oracle 11g XE and import it to Oracle 10.2?

windowsoracle11goracle10g

提问by zack_falcon

Up to this point, I've never done anything serious with an Oracle database. I know that they are different than what I've handled, like MS SQL.

到目前为止,我从未对 Oracle 数据库做过任何认真的事情。我知道它们与我处理过的不同,例如 MS SQL。

So, coming from an MS SQL perspective, I can backup a database, copy over the .bak file to another server, restore it, creating a complete copy of the database.

因此,从 MS SQL 的角度来看,我可以备份数据库,将 .bak 文件复制到另一台服务器,还原它,创建数据库的完整副本。

I'm not sure how to do the same for Oracle, much less different versions. I've seen it done mostly with command lines, so I tried this:

我不确定如何为 Oracle 做同样的事情,更不用说不同的版本了。我看到它主要是用命令行完成的,所以我试过这个:

$exp owner/owner schemas=tkcsdb directory=dumpdir dumpfile=dBaseName logfile=dBaseLog

And then the SQL Plus returns:

然后 SQL Plus 返回:

Unknown Parameter Name 'Schemas'. Failed to process parameters. Export terminated unsuccessfully.

未知参数名称“架构”。无法处理参数。导出未成功终止。

I've since replaced the 'schemas' with 'schema' (same error), and I wanted to try using 'tables', though I'm not sure how that would turn out. I'm not even 100% if 'tkcsdb' is the name of the databaseI'm looking for - I've been unable to list all the databasesI have.

我已经用“模式”替换了“模式”(相同的错误),我想尝试使用“表格”,尽管我不确定结果如何。如果 'tkcsdb' 是我要查找的数据库的名称,我什至不是 100% - 我一直无法列出我拥有的所有数据库

What I want to do (which I've done with MS SQL, MySQL, and even IBM DB2 of all things) is looking to be quite difficult to replicate in Oracle.

我想做的事情(我已经用 MS SQL、MySQL 甚至 IBM DB2 完成了所有事情)看起来很难在 Oracle 中复制。

As with the title, how do I export a 'database' from Oracle 11g XE and import it to Oracle 10.2?

与标题一样,如何从 Oracle 11g XE 导出“数据库”并将其导入 Oracle 10.2?

I'm using Windows 7, the target machine is a Linux Fedora of some sort.

我使用的是 Windows 7,目标机器是某种 Linux Fedora。

回答by Frank Schmitt

EXP and IMP are ancient - do not use them unless you absolutely have to. They cannot handle some of the features of newer Oracle versions.

EXP 和 IMP 是古老的 - 除非绝对必须,否则不要使用它们。它们无法处理较新的 Oracle 版本的某些功能。

The tools of choice are EXPDP and IMPDP (short for EXP datapump and IMP datapump).

选择的工具是 EXPDP 和 IMPDP(EXP 数据泵和 IMP 数据泵的缩写)。

Unfortunately, using them is a little more complicated, because you can run them only on the database server (contrary to old-style EXP/IMP, which you could run from any client computer).

不幸的是,使用它们有点复杂,因为您只能在数据库服务器上运行它们(与旧式 EXP/IMP 不同,旧式 EXP/IMP 可以从任何客户端计算机上运行)。

So, to get your schema from the 11g source DB to the 10g target DB, you'll have to:

因此,要将架构从 11g 源数据库获取到 10g 目标数据库,您必须:

  • open a terminal session on the 11g DB server
  • run expdp with version set to 10 (so you can import it on the 10g server)
  • copy the dump file fom the 11g server to the datapump directory of the 10g server (look for a directory called "dpump")
  • open a terminal session on the 10g DB server
  • run impdp with your dump file
  • 在 11g DB 服务器上打开一个终端会话
  • 在版本设置为 10 的情况下运行 expdp(以便您可以在 10g 服务器上导入它)
  • 将转储文件从 11g 服务器复制到 10g 服务器的 datapump 目录(查找名为“dpump”的目录)
  • 在 10g DB 服务器上打开一个终端会话
  • 使用转储文件运行 impdp

Example:

例子:

expdp scott/tiger@db11g version=10.2 schemas=SCOTT dumpfile=SCOTT.dmp logfile=expdpSCOTT.log

impdp scott/tiger@db10g schemas=SCOTT dumpfile=SCOTT.dmp logfile=impdpSCOTT.log