仅从 Oracle exp 转储导入序列
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/16141923/
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
Import only sequences from an Oracle exp dump
提问by esoni
Is there a way to import all sequences of a schema from a dump of a schema (generated with exp full=y
)? I don't want to import procedures or tables, but only all the sequences.
有没有办法从模式的转储(用 生成exp full=y
)导入模式的所有序列?我不想导入过程或表,而只想导入所有序列。
I want to use the imp
command.
我想使用imp
命令。
回答by ik_zelf
exp has it's limitations. expdp is the better option if you want to use an exp/imp like solutiuon.
exp 有它的局限性。如果您想使用像解决方案这样的 exp/imp,expdp 是更好的选择。
If the goal is to just copy the sequences, why not use dbms_metadata to get the ddl:
如果目标只是复制序列,为什么不使用 dbms_metadata 来获取 ddl:
SELECT DBMS_METADATA.GET_DDL('SEQUENCE', u.sequence_name, decode(u.sequence_owner,'SYS','',sequence_owner)) ddl
FROM all_sequences u where sequence_owner = 'SOE' order by sequence_owner, sequence_name;
回答by David Aldridge
If you use the original Import utility, you can use four different modes: Table Mode, User Mode, Full Database Mode, and Tablespace Mode.
如果您使用原始的导入实用程序,您可以使用四种不同的模式:表模式、用户模式、完整数据库模式和表空间模式。
Each of them will import different types of object, but they are not as controllable as the new Data Pump Import, and you cannot choose exactly which types to import.
它们中的每一个都会导入不同类型的对象,但它们不像新的数据泵导入那样可控,您无法准确选择要导入的类型。
See the documentation here.
请参阅此处的文档。
Sequences are imported in User and Full Database modes, but that also imports many other object types, including procedural objects (procedures, functions and packages).
序列以用户和完整数据库模式导入,但也会导入许多其他对象类型,包括过程对象(过程、函数和包)。
I think you will have to open the dmp file with a text editior and copy-paste the Create Sequence statements to a new .sql file. You may be able to use Perl, Ruby, or a shell script to make that easier, but you cannot do it with imp only.
我认为您必须使用文本编辑器打开 dmp 文件并将 Create Sequence 语句复制粘贴到新的 .sql 文件中。您可以使用 Perl、Ruby 或 shell 脚本来简化此操作,但不能仅使用 imp 来完成。