Chinaunix首页 | 论坛 | 博客
  • 博客访问: 175280
  • 博文数量: 27
  • 博客积分: 1649
  • 博客等级: 上尉
  • 技术积分: 274
  • 用 户 组: 普通用户
  • 注册时间: 2010-02-22 22:45
文章分类

全部博文(27)

文章存档

2013年(3)

2012年(5)

2011年(2)

2010年(17)

分类: DB2/Informix

2010-05-07 15:49:56

1、导出数据库中一个表的结构到文件test.sql
[informix@localhost ~]$ dbschema -d your_database_name -t your_table_name test.sql
your_database_name:数据库名(sysadmin)
your_table_name:表名(test)
 
[informix@localhost ~]$ dbschema -d sysadmin -t test test.sql
 
2、导出表中的数据
用dbaccess命令进入informix操作数据库操作界面,选择需要从中导出数据的库(sysadmin),输入下面sql 语句:
unload to 'test.dmp' select * from table;
 
3、执行test.sql脚本,在zengxing数据库创建表
[informix@localhost ~]$ dbaccess zengxing test.sql > import.log &
 
(重定向输出 > import.log,视乎没什么效果, & 后台执行)
 
4、导入表数据
用dbaccess命令进入informix操作数据库操作界面,选择需要往里导入数据的库(zengxing),输入下面sql 语句:
load from 'test.dmp' insert into test;
阅读(12323) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~