![實(shí)驗(yàn)14Oracle數(shù)據(jù)庫(kù)備份與恢復(fù)_第1頁(yè)](http://file2.renrendoc.com/fileroot_temp3/2021-6/13/58d0a61c-e2a2-4c98-850a-779952d44791/58d0a61c-e2a2-4c98-850a-779952d447911.gif)
![實(shí)驗(yàn)14Oracle數(shù)據(jù)庫(kù)備份與恢復(fù)_第2頁(yè)](http://file2.renrendoc.com/fileroot_temp3/2021-6/13/58d0a61c-e2a2-4c98-850a-779952d44791/58d0a61c-e2a2-4c98-850a-779952d447912.gif)
![實(shí)驗(yàn)14Oracle數(shù)據(jù)庫(kù)備份與恢復(fù)_第3頁(yè)](http://file2.renrendoc.com/fileroot_temp3/2021-6/13/58d0a61c-e2a2-4c98-850a-779952d44791/58d0a61c-e2a2-4c98-850a-779952d447913.gif)
![實(shí)驗(yàn)14Oracle數(shù)據(jù)庫(kù)備份與恢復(fù)_第4頁(yè)](http://file2.renrendoc.com/fileroot_temp3/2021-6/13/58d0a61c-e2a2-4c98-850a-779952d44791/58d0a61c-e2a2-4c98-850a-779952d447914.gif)
![實(shí)驗(yàn)14Oracle數(shù)據(jù)庫(kù)備份與恢復(fù)_第5頁(yè)](http://file2.renrendoc.com/fileroot_temp3/2021-6/13/58d0a61c-e2a2-4c98-850a-779952d44791/58d0a61c-e2a2-4c98-850a-779952d447915.gif)
版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡(jiǎn)介
1、實(shí)驗(yàn)14 Oracle數(shù)據(jù)庫(kù)備份與恢復(fù)姓名:計(jì)算機(jī)科學(xué)與技術(shù)學(xué)號(hào)專業(yè):班級(jí)同組人:無(wú)實(shí)驗(yàn)日期【實(shí)驗(yàn)?zāi)康呐c要求】常見數(shù)據(jù)備份與恢復(fù)的方法學(xué)會(huì)Oracle備份方案的制定【實(shí)驗(yàn)內(nèi)容與步驟】14.1. Oracle 物理備份與恢復(fù).0 .準(zhǔn)備工作:(1) 查看數(shù)據(jù)庫(kù)是否運(yùn)行于歸檔模式下:ISQL select name,created,log mode 2 From;請(qǐng)給出查詢的結(jié)果:5QL select name (created j-log mode-2 fron u$database;NAMECREATEDLDGMDOETESTDB仆-9 月NOARCHIHELOG(2) 干凈的關(guān)閉數(shù)據(jù)庫(kù),做一
2、個(gè)完全的冷備份。提示:a.使用showdown 命令;b.復(fù)制數(shù)據(jù)文件、日志文件和控制文件到安全地 方SQL? shutdoun;己盪卸載數(shù)粥庫(kù)。0KACLE制程豈經(jīng)關(guān)閉(3) 把數(shù)據(jù)庫(kù)改為歸檔模式SQL startup mountSQL alter database archivelog;SQL alter database ope n;設(shè)置成自動(dòng)歸檔SQL alter system set log_archive_start = true scope=spfile;SQL st叩 nountORACLE例程己經(jīng)啟動(dòng).Total System Globa I Area 171966-464b
3、jtesFixpd Si2e7879B8tiytVariable Size1457505Q8bytDatabase Buffers251fi5fi24bteRedo Buffers2621 bjts數(shù)據(jù)庫(kù)裝戟完畢。SQL alter database archielog;數(shù)據(jù)庫(kù)己更改。S()L alter database open ;數(shù)據(jù)庫(kù)己更改SQL alteset logscopespfile;!系統(tǒng)己更改。注意:本實(shí)驗(yàn)中的很多命令路徑參數(shù)需根據(jù)自己的實(shí)現(xiàn)環(huán)境作出修改1 .實(shí)驗(yàn)1:數(shù)據(jù)庫(kù)系統(tǒng)數(shù)據(jù)文件和回退段遭破壞的情況下的恢復(fù)。此時(shí)數(shù)據(jù)庫(kù)的狀態(tài)是關(guān)閉的。先啟動(dòng)數(shù)據(jù)庫(kù),用scott用戶建立
4、test表,并插入兩條數(shù)據(jù)。SQL create table scott.test (id int);表已創(chuàng)建。SQL insert into scott.test values(1);已創(chuàng)建1行。SQL insert into scott.test values(2);已創(chuàng)建1行。SQL commit;提交完成。(2) 模擬數(shù)據(jù)庫(kù)遭意外被迫關(guān)閉,并且系統(tǒng)數(shù)據(jù)文件丟失。SQL shutdow n abortSQL shutdown abort;ORA-01031: insufficient privileges把oracle服務(wù)停掉,移除SYSTEM01.dbf和UNDOTBS01.DBF 文
5、件(即將這兩個(gè)文件移到其他文件夾下)。nil電DK醉1瑋曹沙、血、L.4iu-iiihl iWA3 irn m力電;IT UiIk啊 rr-?j-Jr為. ElEjm曲.耐re b 和砂ra .- r -pHiclwrxui XlarS5;* 目飾一a-a.啟動(dòng)服務(wù)務(wù)馳皿m血 督曲|皿L迪in X日出i)Uj 務(wù)Stir ek hvn si nz站 i: cm st 有肝 J 3fflri?j 3q$:f I Trmit 龜ei韋阿旳dl如9 吋用Dfi 骸 Ltacl ij i b&ft hl r IE1U 務(wù)tt kJ業(yè)Jl;.Lijnd卻比工 程 Urad startup請(qǐng)給執(zhí)行結(jié)果:S
6、QL? startup;0RA-M113;通信通道的文件結(jié)束(4) 把備份的 SYSTEMOl.dbf 和UNDOTBS01.DBF文件復(fù)制回去a.執(zhí)行以下命令|sQL recovAr:請(qǐng)給執(zhí)行結(jié)果:S(L re-eowerSP2-A640;未連接 完成介質(zhì)恢復(fù)。然后就可以打開數(shù)據(jù)庫(kù),查看scott用戶的test表。SQL alter database ope n;SQL select * from scott.test;請(qǐng)給執(zhí)行結(jié)果:SQL alteropen;數(shù)據(jù)庫(kù)己更改*SQL select * Ffo竹 scott各t;1ID122 .實(shí)驗(yàn)2:數(shù)據(jù)庫(kù)是打開的,這時(shí)損壞的文件是用戶的數(shù)據(jù)
7、文件而不是system和undo文件。用scott用戶在users表空間建立 testl 表SQL create table scott.test1(id int)2 tablespace users;表已創(chuàng)建。(2) 插入兩條數(shù)據(jù)SQL in sert into scott.test1 values(1);已創(chuàng)建1行。SQL in sert into scott.test1 values (2);已創(chuàng)建1行。SQL commit;提交完成。(3) 當(dāng)前日志歸檔SQL alter system archive log curre nt;系統(tǒng)已更改。(4) 現(xiàn)在破壞users表空間,使其離線,然
8、后移除usersOl.dbf到一個(gè)指定文件夾(備份)SQL alter tablespace users offline;表空間已更改。執(zhí)行: SQL alter tablespace users on li ne;請(qǐng)給執(zhí)行結(jié)果:SQL alter tablespace users online: jlter tJblespace use* online第1行出現(xiàn)趙煲:RA-01157:無(wú)?去標(biāo)鎖定數(shù)據(jù)文件h -謹(jǐn)麻闔DBWR跟蹤文件ORA-0111D:數(shù)據(jù)文件 U: 1C:DRACLEVPRODUCT-10.1.0DB_1TESIDBUSER$tf.DBFa此時(shí)出現(xiàn)錯(cuò)誤,users表空間不能
9、在線了。這時(shí)把備份的 usersO1.DBF還原回去。然后,執(zhí)行:SQL recover tablespace users;S(JL recower* tablespace users;ORft0O2?3:恢復(fù)會(huì)i舌因錯(cuò)誤而取消ORft-00264: 不賈求恢復(fù)(5) 完成介質(zhì)恢復(fù)。SQL alter tablespace users on li ne;表空間已更改。SQL select * from scott.testl;請(qǐng)給執(zhí)行結(jié)果:SQL alter tablespacaonline;衰空間己更改S(JL select Fron scott-test!;ID23.實(shí)驗(yàn)3 :數(shù)據(jù)文件沒有
10、備份(不能使system和undo文件)的恢復(fù)。創(chuàng)建表空間testspace在SQL Plus中依次執(zhí)行以下語(yǔ)句,給出最后的執(zhí)行結(jié)果:SQL create tablespace testspace datafileC:oracleproduct10.1.0db_1TestDBtestspace.dbf size 10m;SQL create table scott.test3(id int)tablespace testspace;SQL commit;SQL alter system switch logfile;SQL in sert into scott.test3 values(1);
11、SQL commit;SQL alter tablespace testspace offline;SQL select * from scott.test3;請(qǐng)給執(zhí)行結(jié)果:SQL select * Fro scott.test3;select * fron scott_test3 需Jo號(hào)鱉最護(hù)取文件ORA-0111 fl:數(shù)據(jù)文件 6: * C:ORACLEPR0DUCTX10-1-0D0_1TESTDBXTESTSPACE-DBF (2) 由于沒有備份數(shù)據(jù)文件,需重新創(chuàng)建一個(gè)SQL alter database create datafileC:oracleproduct10.1.0db
12、_1TestDBtestspace.dbf;SQL recover tablespace testspace;(3) 完成恢復(fù)SQL alter tablespace testspace on li ne;表空間已更改。SQL select * from scott.test3;請(qǐng)給執(zhí)行結(jié)果:S(L alter database create datafile2C:oracleproduct10-1.0db_1TstDBtpstspate_dbF;數(shù)據(jù)庫(kù)己更改。SQL rcouer tablespace testspace;完成介質(zhì)恢復(fù)。S(L altr tablespace testspac
13、? onlinp;表空間己更改。S(L select * from scott.test3;ID142 邏輯備份:導(dǎo)入導(dǎo)出實(shí)驗(yàn)實(shí)驗(yàn)4 :模式的導(dǎo)入導(dǎo)出案例:將scott/tiger 用戶對(duì)應(yīng)的模式導(dǎo)出,通過導(dǎo)出文件將其導(dǎo)入到 Test用戶(為個(gè)空用戶)對(duì)應(yīng)的模式中,包括該模式中的所有對(duì)象的定義和數(shù)據(jù)。1 .準(zhǔn)備工作(1) 三次創(chuàng)建用戶:Create user testIdentified by test;(2) 授權(quán):grant dba to test;注:這兒做了簡(jiǎn)化處理,實(shí)際工作中,盡量不要授DBA權(quán)限給一般用戶2 .數(shù)據(jù)的導(dǎo)出與導(dǎo)入(1)數(shù)據(jù)準(zhǔn)備以 scott 身份登錄:conn sco
14、tt/tiger創(chuàng)建測(cè)試用表:create table jobs(n amevarchar2(20).jobvarchar2(40).salesnu mber);加入數(shù)據(jù):in sert into jobs values(IT_Test,software test in g,3000);提交:commit;S(|L create tble jobsf2 name urchar2(2B),9 job4nunber);*己創(chuàng)匙SQL insert into jobs ualues(41T_Test4,software testing,39B0;已創(chuàng)建1行SQL comnil:;匾交完成q創(chuàng)建測(cè)試用
15、表scott_testcreate table scott_test(n ame varchar2(10),agenu mber);加入數(shù)據(jù):in sert into scott_test values(ma nager,40);()L create table 5cott_tpst(2 name uarcharStlG),3 age number);表己刨建*S()LS()L insert into scott_test ualups( manager J 0):已創(chuàng)建1行。|(2)以管理員身份登錄:conn as sysdba;alter system en able restricted
16、 sessi on;歸名二r n尸令tp on用口 入入接 LyL:scottrestrictedsession:系統(tǒng)己更改。(3) 導(dǎo)出數(shù)據(jù)庫(kù):在DOS提示符下執(zhí)行:exp system/ testdb full=y file=test.dmp執(zhí)行時(shí),會(huì)要求輸入system的口令,請(qǐng)根據(jù)實(shí)際情況輸入。(4) 恢復(fù)數(shù)據(jù)庫(kù)運(yùn)行狀態(tài)conn as sysdba;alter system disable restricted sessi on;(5) 進(jìn)行數(shù)據(jù)庫(kù)的導(dǎo)入:以下是一示例:imp system/ testdb fromuser=scott touser=test tables=(scott_test,jobs) file=test.dmp ignore=y;i sHocujTients and Sc ttinsraXToinimp system/tes tdlh f FDinuserb=SGOitt touser=test tahle -imp system/testdb fronuser=scatt t
溫馨提示
- 1. 本站所有資源如無(wú)特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁(yè)內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫(kù)網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。
最新文檔
- GB/T 45181-2024車聯(lián)網(wǎng)網(wǎng)絡(luò)安全異常行為檢測(cè)機(jī)制
- 2025年度二零二五年度豪華別墅租賃定金及維護(hù)協(xié)議
- 二零二五年度理發(fā)店轉(zhuǎn)讓合同-附帶店鋪裝修及經(jīng)營(yíng)策略指導(dǎo)
- 二零二五年度砂石料運(yùn)輸安全培訓(xùn)及應(yīng)急預(yù)案協(xié)議
- 基于大數(shù)據(jù)的小學(xué)數(shù)學(xué)教育分析
- 提升安保措施保障智慧旅游出行安全
- 專業(yè)育嬰師服務(wù)合同
- XX省重點(diǎn)水電工程擴(kuò)建項(xiàng)目合同2025
- 個(gè)人股權(quán)轉(zhuǎn)讓合同書
- 產(chǎn)品售后保養(yǎng)服務(wù)合同樣本
- 高中學(xué)校開學(xué)典禮方案
- 2024年度中國(guó)郵政集團(tuán)公司縣分公司工作總結(jié)
- DL∕T 1844-2018 濕式靜電除塵器用導(dǎo)電玻璃鋼陽(yáng)極檢驗(yàn)規(guī)范
- JTG D62-2004 公路鋼筋混凝土及預(yù)應(yīng)力混凝土橋涵設(shè)計(jì)規(guī)范
- 醫(yī)?;鸨O(jiān)管培訓(xùn)課件
- 產(chǎn)程中的人文關(guān)懷護(hù)理
- 開工第一課安全教育記錄表
- 2024年黑龍江農(nóng)業(yè)職業(yè)技術(shù)學(xué)院高職單招(英語(yǔ)/數(shù)學(xué)/語(yǔ)文)筆試歷年參考題庫(kù)含答案解析
- 基于數(shù)據(jù)驅(qū)動(dòng)的鋰離子電池剩余使用壽命預(yù)測(cè)方法研究
- 《內(nèi)臟疾病康復(fù)》課件
- 串通招投標(biāo)法律問題研究
評(píng)論
0/150
提交評(píng)論