简体   繁体   English

将数据库导出为CSV是否保留其架构?

[英]Does exporting database as CSV retain its schema?

I want to migrate a database from Btrieve (PSQL) to Oracle. 我想将数据库从Btrieve(PSQL)迁移到Oracle。 For this i'll first convert my source db to CSV then i'll convert exported CSV to target db. 为此,我首先将源数据库转换为CSV,然后将导出的CSV转换为目标数据库。 I'm not sure but as far as i know, it is not possible to get schema retained while exporting a DB to CSV. 我不确定,但据我所知,将数据库导出到CSV时无法保留架构。

It retains its schema insofar as it can tell you the column names, and column order. 只要可以告诉您列名和列顺序,它就保留其架构。 And from values, you can derive the column type (for example lots of unquoted numbers suggest an int or decimal type). 并且可以从值中导出列类型(例如,许多未加引号的数字建议使用整数或十进制类型)。

But it doesn't maintain useful things like primary keys, foreign keys, constraints, defaults. 但是它不维护有用的东西,例如主键,外键,约束,默认值。

You can try getting and copying a table schema from the source db, then pasting and running it against to your new db and see if it works (with some minor tweaks). 您可以尝试从源数据库中获取并复制表架构,然后将其粘贴并运行到新数据库中,以查看其是否有效(进行一些细微调整)。 Or you could use a tool like liquibase which should be able to help here. 或者,您可以使用诸如liquibase之类的工具在这里应该可以提供帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM