生成数据库& Oracle pl-sql 上的表架构 (ddl)

发布于 2024-08-09 21:02:43 字数 217 浏览 3 评论 0原文

任何人都有一个 PL-SQL 语句,我可以用它来生成数据库和数据库。 Oracle 10g 上特定数据库的表架构?我需要 .sql 文件中的架构,并且如果可能的话与 ANSI-92/99 sql 实现兼容,这样我就可以直接在 sql server 2005 上使用生成的 .sql。

已经听说过 exp/imp,但似乎生成了转储文件,什么我只需要 .sql 文件上的简单 ddl 。

谢谢

Anyone have a PL-SQL statement that i can use to generate database & tables schema for specific database on Oracle 10g? I need the schema in .sql file and if possible compatible with ANSI-92/99 sql implementation, so i can use the generated .sql directly on sql server 2005.

Already heard about exp/imp, but it seems generated dump file, what i need just a simple ddl on .sql file.

Thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

等风来 2024-08-16 21:02:44

您可以尝试:

select dbms_metadata.get_ddl('TABLE',table_name,owner)
from dba_tables where owner='schema name';

它返回长整型,因此您可能想使用长缓冲区。

有关 dbms_metadata 的更多信息: http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14258/d_metada.htm

You could try:

select dbms_metadata.get_ddl('TABLE',table_name,owner)
from dba_tables where owner='schema name';

It returns longs, so you may want to play with the long buffer.

More about dbms_metadata here: http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14258/d_metada.htm

大姐,你呐 2024-08-16 21:02:44

如果您只需要转储模式,这个免费软件包可以很好地完成工作。我们在日常生产中使用它。

http://sourceforge.net/projects/cx-oracletools

如果需要从 Oracle 转换对于 SQL Server,这个软件可能会做得更好。我们使用它在 Oracle、MySql 和 Postgreqsql 之间进行转换。

http://www.spectralcore.com/fullconvert

If you just need to dump your schema, this free package does a very nice job. We use it in daily production.

http://sourceforge.net/projects/cx-oracletools

If you need to convert from Oracle to SQL Server, this software might do a better job. We've used it to convert between Oracle, MySql, and Postgreqsql.

http://www.spectralcore.com/fullconvert

長街聽風 2024-08-16 21:02:44

我写了 oraddlscript ,它调用 dbms_metadata.get_ddl (Pop 的答案)用户拥有的每个数据库对象并将 DDL 写入文件。

更新:已回复评论

I wrote oraddlscript which calls dbms_metadata.get_ddl (Pop's answer) for each database object owned by a user and writes the DDL to a file.

Update: Answered comment

爱的故事 2024-08-16 21:02:44

您好,我建议使用 Oracle SQL Developer Data Modeler由于它来自Oracle,因此可以直接从数据字典中读取DDL信息。它创建一个 ERD,然后您可以为 SQL Server 2000/2005、某些版本的 DB2 和 Oracle 9i/10g/11g 生成 DDL。

Greetings, I'd recomend using Oracle SQL Developer Data Modeler since it's from Oracle, it can read the DDL information directly from the Data Dictionary. It creates an ERD and then you can produce DDL for SQL Server 2000/2005, some versions of DB2 and Oracle 9i/10g/11g.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文