设为首页 加入收藏

TOP

数据库复制表结构
2014-11-24 03:04:56 来源: 作者: 【 】 浏览:4
Tags:数据库 制表 结构
现在有一个 数据库,我想用他的表结构,找了好久,比较好用的方法就是下面两种:
1、

create table a as select * from b where 1=2 ;
2、


--导出
exp userid=用户名/密码file=文件名.dmp tables=(表名1,表名2.....) rows=n;
--导入
imp userid=用户名/密码file=文件名.dmp full=y;

---
C:\Documents and Settings\Administrator>exp userid=scott/tiger file=scott.dmp tables=(emp,dept) rows=n;

Export: Release 10.2.0.1.0 - Production on 星期三8月3 18:31:48 2011

Copyright (c) 1982, 2005, Oracle. All rights reserved.


连接到: Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
已导出ZHS16GBK 字符集和AL16UTF16 NCHAR 字符集
注: 将不导出表数据(行)

即将导出指定的表通过常规路径...
. . 正在导出表 EMP
. . 正在导出表 DEPT
成功终止导出, 没有出现警告。

C:\Documents and Settings\Administrator>imp userid=test/test file=scott.dmp full=y;

Import: Release 10.2.0.1.0 - Production on 星期三8月3 18:42:36 2011

Copyright (c) 1982, 2005, Oracle. All rights reserved.


连接到: Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options

经由常规路径由EXPORT:V10.02.01 创建的导出文件

警告: 这些对象由SCOTT 导出, 而不是当前用户

已经完成ZHS16GBK 字符集和AL16UTF16 NCHAR 字符集中的导入
. 正在将SCOTT 的对象导入到TEST
. 正在将SCOTT 的对象导入到TEST
即将启用约束条件...
成功终止导入, 没有出现警告。

摘自 简约而不简单
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
分享到: 
上一篇触发器学习笔记(:new,:old用法) 下一篇MongoDB学习笔记(入门)

评论

帐  号: 密码: (新用户注册)
验 证 码:
表  情:
内  容:

·哈希表 - 菜鸟教程 (2025-12-24 20:18:55)
·MySQL存储引擎InnoDB (2025-12-24 20:18:53)
·索引堆及其优化 - 菜 (2025-12-24 20:18:50)
·Shell 中各种括号的 (2025-12-24 19:50:39)
·Shell 变量 - 菜鸟教 (2025-12-24 19:50:37)