如何查看Oracle數(shù)據(jù)表的建表語(yǔ)句?
2024-08-29 13:31:24
供稿:網(wǎng)友
如何查看oracle數(shù)據(jù)表的建表語(yǔ)句?
系統(tǒng)環(huán)境:
1、操作系統(tǒng):windows 2000 server,機(jī)器內(nèi)存128m
2、數(shù)據(jù)庫(kù): oracle 8i r2 (8.1.6) for nt 企業(yè)版
3、安裝路徑:c:/oracle
實(shí)現(xiàn)步驟:
1、用exp工具導(dǎo)出
2、導(dǎo)入時(shí)使用show=y選項(xiàng)、log選項(xiàng)
3、查看、編輯日志文件
具體實(shí)例:
1、調(diào)出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、打開(kāi)一個(gè)dos窗口、先執(zhí)行導(dǎo)出
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
已導(dǎo)出zhs16gbk字符集和zhs16gbk nchar 字符集
. 正在導(dǎo)出 pre-schema 過(guò)程對(duì)象和操作
. 正在導(dǎo)出用戶(hù)a的外部函數(shù)程序庫(kù)名稱(chēng)
. 正在導(dǎo)出用戶(hù)a的對(duì)象類(lèi)型定義
即將導(dǎo)出a的對(duì)象 ...
. 正在導(dǎo)出數(shù)據(jù)庫(kù)鏈接
. 正在導(dǎo)出序號(hào)
. 正在導(dǎo)出群集定義
. 即將導(dǎo)出a的表通過(guò)常規(guī)路徑 ...
. . 正在導(dǎo)出表 a 3 行被導(dǎo)出
. . 正在導(dǎo)出表 b 3 行被導(dǎo)出
. 正在導(dǎo)出同義詞
. 正在導(dǎo)出視圖
. 正在導(dǎo)出存儲(chǔ)的過(guò)程
. 正在導(dǎo)出運(yùn)算符
. 正在導(dǎo)出引用完整性約束條件
. 正在導(dǎo)出觸發(fā)器
. 正在導(dǎo)出索引類(lèi)型
. 正在導(dǎo)出位圖、功能性索引和可擴(kuò)展索引
. 正在導(dǎo)出后期表活動(dòng)
. 正在導(dǎo)出快照
. 正在導(dǎo)出快照日志
. 正在導(dǎo)出作業(yè)隊(duì)列
. 正在導(dǎo)出刷新組和子組
. 正在導(dǎo)出維
. 正在導(dǎo)出 post-schema 過(guò)程對(duì)象和操作
. 正在導(dǎo)出統(tǒng)計(jì)
在沒(méi)有警告的情況下成功終止導(dǎo)出。
e:/>
3、再執(zhí)行導(dǎo)入,使用show=y、log這兩個(gè)選項(xiàng)
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
經(jīng)由常規(guī)路徑導(dǎo)出由export:v08.01.06創(chuàng)建的文件
已經(jīng)完成zhs16gbk字符集和zhs16gbk nchar 字符集中的導(dǎo)入
. 正在將a的對(duì)象導(dǎo)入到 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""
. . 正在跳過(guò)表 "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""
. . 正在跳過(guò)表 "b"
成功終止導(dǎo)入,但出現(xiàn)警告。
e:/>
4、使用編輯器打開(kāi)logb.txt,里面可以看到ddl語(yǔ)句