Oracle数据库有多种导出方式,以下是常用的几种方法:
exp username/password@database file=export_file.dmp log=export_log.log
常用参数:
- owner - 指定导出特定用户的对象
- tables - 指定导出的表
- full=y - 全库导出
- rows=y - 导出数据行(默认)
- compress=y - 压缩导出数据
expdp username/password@database dumpfile=export_file.dmp logfile=export_log.log
常用参数:
- schemas - 导出指定模式
- tables - 导出指定表
- full=y - 全库导出
- directory - 指定导出目录对象
- parallel - 并行导出提高速度
expdp username/password@database dumpfile=schema_only.dmp content=metadata_only
imp username/password@database file=export_file.dmp log=import_log.log
常用参数:
- fromuser - 指定导出文件中的源用户
- touser - 指定导入到哪个用户
- tables - 导入特定表
- ignore=y - 忽略创建错误
impdp username/password@database dumpfile=export_file.dmp logfile=import_log.log
常用参数:
- remap_schema - 重映射模式(用户)
- remap_tablespace - 重映射表空间
- table_exists_action - 表存在时的操作(append/replace/truncate/skip)
- transform - 转换对象特性
impdp username/password@database dumpfile=export_file.dmp sqlfile=ddl.sql content=metadata_only
expdp system/password@orcl schemas=scott directory=DATA_PUMP_DIR dumpfile=scott.dmp logfile=expdp_scott.log
impdp system/password@orcl directory=DATA_PUMP_DIR dumpfile=scott.dmp remap_schema=scott:newuser logfile=impdp_newuser.log
以上是Oracle数据库导入导出的基本操作,具体使用时请根据实际环境调整参数。