如何查看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語句
新聞熱點
疑難解答