如何查看Oracle数据表的建表语句?
2024-08-29 13:31:24
供稿:网友
如何查看oracle数据表的建表语句?
系统环境:
1、操作系统:windows 2000 server,机器内存128m
2、数据库: oracle 8i r2 (8.1.6) for nt 企业版
3、安装路径:c:/oracle
实现步骤:
1、用exp工具导出
2、导入时使用show=y选项、log选项
3、查看、编辑日志文件
具体实例:
1、调出sql*plus
conn system/manager
grant connect,resource to a identified by a;
grant connect,resource to b identified by b;
conn a/a
create table a(a number);
insert into a values(1);
insert into a values(2);
insert into a values(3);
create table b(a number,b varchar2(10));
insert into b values(1,'1111');
insert into b values(2,'2222');
insert into b values(3,'3333');
commit;
2、打开一个dos窗口、先执行导出
e:/>exp a/a file=a.dmp log=loga.txt
export: release 8.1.6.0.0 - production on 星期五 12月 1 22:24:16 2000
(c) copyright 1999 oracle corporation. all rights reserved.
连接到: oracle8i enterprise edition release 8.1.6.0.0 - production
with the partitioning option
jserver release 8.1.6.0.0 - production
已导出zhs16gbk字符集和zhs16gbk nchar 字符集
. 正在导出 pre-schema 过程对象和操作
. 正在导出用户a的外部函数程序库名称
. 正在导出用户a的对象类型定义
即将导出a的对象 ...
. 正在导出数据库链接
. 正在导出序号
. 正在导出群集定义
. 即将导出a的表通过常规路径 ...
. . 正在导出表 a 3 行被导出
. . 正在导出表 b 3 行被导出
. 正在导出同义词
. 正在导出视图
. 正在导出存储的过程
. 正在导出运算符
. 正在导出引用完整性约束条件
. 正在导出触发器
. 正在导出索引类型
. 正在导出位图、功能性索引和可扩展索引
. 正在导出后期表活动
. 正在导出快照
. 正在导出快照日志
. 正在导出作业队列
. 正在导出刷新组和子组
. 正在导出维
. 正在导出 post-schema 过程对象和操作
. 正在导出统计
在没有警告的情况下成功终止导出。
e:/>
3、再执行导入,使用show=y、log这两个选项
e:/>imp a/a file=a.dmp show=y log=logb.txt
import: release 8.1.6.0.0 - production on 星期五 12月 1 22:29:49 2000
(c) copyright 1999 oracle corporation. all rights reserved.
连接到: oracle8i enterprise edition release 8.1.6.0.0 - production
with the partitioning option
jserver release 8.1.6.0.0 - production
经由常规路径导出由export:v08.01.06创建的文件
已经完成zhs16gbk字符集和zhs16gbk nchar 字符集中的导入
. 正在将a的对象导入到 a
"create table "a" ("a" number) pctfree 10 pctused 40 initrans 1 maxtrans 25"
"5 logging storage(initial 131072 next 65536 minextents 1 maxextents 2147483"
"645 pctincrease 50 freelists 1 freelist groups 1 buffer_pool default) table"
"space "system""
. . 正在跳过表 "a"
"create table "b" ("a" number, "b" varchar2(10)) pctfree 10 pctused 40 init"
"rans 1 maxtrans 255 logging storage(initial 131072 next 65536 minextents 1 "
"maxextents 2147483645 pctincrease 50 freelists 1 freelist groups 1 buffer_p"
"ool default) tablespace "system""
. . 正在跳过表 "b"
成功终止导入,但出现警告。
e:/>
4、使用编辑器打开logb.txt,里面可以看到ddl语句