隨著數(shù)據(jù)庫(kù)版本的升級(jí)及業(yè)務(wù)測(cè)試的增加,數(shù)據(jù)庫(kù)或者數(shù)據(jù)遷移也成了數(shù)據(jù)庫(kù)管理者們經(jīng)常的工作之一。那么對(duì)于要求嚴(yán)格的數(shù)據(jù),針對(duì)
一、概述
隨著數(shù)據(jù)庫(kù)版本的升級(jí)及業(yè)務(wù)測(cè)試的增加,數(shù)據(jù)庫(kù)或者數(shù)據(jù)遷移也成了數(shù)據(jù)庫(kù)管理者們經(jīng)常的工作之一。那么對(duì)于要求嚴(yán)格的數(shù)據(jù),針對(duì)大數(shù)據(jù)表,在你導(dǎo)出時(shí)如果有人做了操作,這個(gè)操作是否也會(huì)被導(dǎo)出呢?由于個(gè)人能力有限,想要深究邏輯備份的話,估計(jì)還需要一些時(shí)日,暫時(shí)只做了一個(gè)小實(shí)驗(yàn)測(cè)試,如大家有其他方法、更全面說(shuō)明,歡迎拍磚。
二、操作過(guò)程
以下實(shí)驗(yàn)操作流程為每執(zhí)行一次邏輯導(dǎo)出時(shí)都執(zhí)行一次DML操作。操作語(yǔ)句如下(數(shù)據(jù)庫(kù)版本10.2.0.5):
用戶為firsoul,操作的表有age、big_table、test,下圖為各表的初始數(shù)據(jù)
SQL> show user
USER is "FIRSOUL"
SQL> select * from tab;
SQL> select table_name,NUM_ROWS from user_tables;
TABLE_NAME NUM_ROWS
------------------------------ ----------
EMP 14
DEPT 4
TEST 1
AGE 1
BIG_TABLE 3000000
第一次操作:
exp firsoul/firsoul tables=BIG_TABLE CONSISTENT=Y file=exp_table.dmp log=exp_table.log
insert into age values(22,'mingli');
delete from big_table where id=7;
insert into test values(2,'shandong');
commit;
第二次操作:
exp firsoul/firsoul file=exp_user.dmp log=exp_user.log consistent=y grants=y
insert into age values(24,'mengmeng');
delete from big_table where id=14;
insert into test values(3,'china');
commit;
第三次操作:
exp firsoul/firsoul tables=BIG_TABLE file=exp_table2.dmp log=exp_table2.log
insert into age values(24,'xiaochi');
delete from big_table where id=21;
insert into test values(4,'dezhou');
commit;
第四次操作:
exp firsoul/firsoul file=exp_user2.dmp log=exp_user2.log grants=y
insert into age values(25,'fengyin');
delete from big_table where id=28;
insert into test values(5,'jinan');
commit;
第五次操作:
expdp firsoul/firsoul directory=dir_dmp dumpfile=expdp_table.dmp tables=BIG_TABLE logfile=expdp_table.log
insert into age values(30,'shubin');
delete from big_table where id=35;
insert into test values(6,'shizhong');
commit;
第六次操作:
expdp firsoul/firsoul directory=dir_dmp dumpfile=expdp_user.dmp SCHEMAS=firsoul logfile=expdp_user.log
insert into age values(32,'liupan');
delete from big_table where id=42;
insert into test values(7,'tianqiao');
commit;
得出結(jié)果如下所示(“-”為少幾行,“+”為多幾行):
執(zhí)行DML次數(shù)
age
big_table
test
備注
1
0
導(dǎo)出表(CONSISTENT=y)
2
+2
-2
+2
導(dǎo)出用戶(CONSISTENT=y)
3
-2
導(dǎo)出表(CONSISTENT=n)
4
+3
-3
+4
導(dǎo)出用戶(CONSISTENT=n)
5
-5
expdp 導(dǎo)出表
6
+6
-6
+6
expdp 導(dǎo)出用戶
通過(guò)以上數(shù)據(jù),我們可以看出
1、exp導(dǎo)出,參數(shù)CONSISTENT=y,單獨(dú)導(dǎo)出表big_table,數(shù)據(jù)無(wú)變化,導(dǎo)出用戶時(shí),數(shù)據(jù)有變化。
2、exp導(dǎo)出,參數(shù)CONSISTENT=n,單獨(dú)導(dǎo)出表big_table,數(shù)據(jù)無(wú)變化,導(dǎo)出用戶數(shù)據(jù)時(shí),表age、big_table沒(méi)變化,表test多一行,exp導(dǎo)出按照表的首字母排序,在導(dǎo)出時(shí),,我們執(zhí)行DML語(yǔ)句(第四次操作)時(shí),age已導(dǎo)出,big_table正在導(dǎo)出,而test還為等待導(dǎo)出。由此看出,exp導(dǎo)出,當(dāng)表在執(zhí)行導(dǎo)出時(shí)再做DML操作對(duì)導(dǎo)出數(shù)據(jù)無(wú)影響。
3、expdp導(dǎo)出時(shí),數(shù)據(jù)都有變化。expdp導(dǎo)出的表是按照數(shù)據(jù)從大到小排序
三、總結(jié)
這個(gè)測(cè)試其實(shí)很無(wú)聊的,而且還有點(diǎn)繞,總結(jié)呢,就一點(diǎn),exp任務(wù)開(kāi)始,當(dāng)該表已執(zhí)行邏輯導(dǎo)出操作(執(zhí)行中或已導(dǎo)出完成),做的任何DML操作對(duì)導(dǎo)出數(shù)據(jù)無(wú)影響;當(dāng)導(dǎo)出任務(wù)還未涉及到該表時(shí),所做DML操作影響該表導(dǎo)出數(shù)據(jù)。一句話,DML操作時(shí)間(先后)影響導(dǎo)出表數(shù)據(jù)。說(shuō)來(lái),還是對(duì)于數(shù)據(jù)庫(kù)原理不太明白,希望可以認(rèn)真看看吧,希望。以上只是個(gè)人昏昏欲睡狀態(tài)下所得出結(jié)論,歡迎大家積極拍磚。水平有限,不足之處還望見(jiàn)諒。
Oracle EXP導(dǎo)出報(bào)錯(cuò)EXP-00091分析解決
探索Oracle之 EXP/IMP過(guò)程中的字符集問(wèn)題
Oracle EXP imp備份、恢復(fù)表空間數(shù)據(jù)步驟
Oracle 創(chuàng)建自動(dòng)執(zhí)行的EXP任務(wù)
Oracle 11g 導(dǎo)出表報(bào)EXP-00011:table不存在
EXP/imp導(dǎo)出導(dǎo)入數(shù)據(jù)時(shí)報(bào)錯(cuò)ORA-12154 無(wú)法解析指定的連接標(biāo)識(shí)符
本文永久更新鏈接地址:
聲明:本網(wǎng)頁(yè)內(nèi)容旨在傳播知識(shí),若有侵權(quán)等問(wèn)題請(qǐng)及時(shí)與本網(wǎng)聯(lián)系,我們將在第一時(shí)間刪除處理。TEL:177 7030 7066 E-MAIL:11247931@qq.com