實(shí)驗(yàn)十一-Oracle數(shù)據(jù)庫(kù)備份與恢復(fù).docx_第1頁(yè)
實(shí)驗(yàn)十一-Oracle數(shù)據(jù)庫(kù)備份與恢復(fù).docx_第2頁(yè)
實(shí)驗(yàn)十一-Oracle數(shù)據(jù)庫(kù)備份與恢復(fù).docx_第3頁(yè)
實(shí)驗(yàn)十一-Oracle數(shù)據(jù)庫(kù)備份與恢復(fù).docx_第4頁(yè)
實(shí)驗(yàn)十一-Oracle數(shù)據(jù)庫(kù)備份與恢復(fù).docx_第5頁(yè)
免費(fèi)預(yù)覽已結(jié)束,剩余2頁(yè)可下載查看

下載本文檔

版權(quán)說(shuō)明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)

文檔簡(jiǎn)介

實(shí)驗(yàn)十一 Oracle數(shù)據(jù)庫(kù)備份與恢復(fù)【實(shí)驗(yàn)?zāi)康呐c要求】n1.常見數(shù)據(jù)備份與恢復(fù)的方法n2.學(xué)會(huì)Oracle備份方案的制定【實(shí)驗(yàn)內(nèi)容與步驟】1.Oracle物理備份與恢復(fù)準(zhǔn)備工作:(1) 查看數(shù)據(jù)庫(kù)是否運(yùn)行于歸檔模式下:請(qǐng)給出查詢的結(jié)果:(2)關(guān)閉數(shù)據(jù)庫(kù),做一個(gè)完全的冷備份。提示:a.使用shutdown命令關(guān)閉數(shù)據(jù)庫(kù); b.復(fù)制數(shù)據(jù)文件、日志文件和控制文件到安全地方(3)把數(shù)據(jù)庫(kù)改為歸檔模式設(shè)置成自動(dòng)歸檔SQLaltersystemsetlog_archive_start=truescope=spfile;注意:本實(shí)驗(yàn)中的很多命令路徑參數(shù)需根據(jù)自己的實(shí)現(xiàn)環(huán)境做出修改!實(shí)驗(yàn)11-1數(shù)據(jù)庫(kù)系統(tǒng)數(shù)據(jù)文件和回退段遭破壞的情況下的恢復(fù)。此時(shí)數(shù)據(jù)庫(kù)的狀態(tài)是關(guān)閉的。(1) 先啟動(dòng)數(shù)據(jù)庫(kù),創(chuàng)建新用戶scott,并用scott用戶建立test表,并插入兩條數(shù)據(jù)。創(chuàng)建表空間的四個(gè)步驟:/*分為四步 */*第1步:創(chuàng)建臨時(shí)表空間 */create temporary tablespace user_temp tempfile D: user_temp.dbf size 50m autoextend on next 50m maxsize 20480m extent management local; /*第2步:創(chuàng)建數(shù)據(jù)表空間 */create tablespace user_data logging datafile D: user_data.dbf size 50m autoextend on next 50m maxsize 20480m extent management local; /*第3步:創(chuàng)建用戶并指定表空間 */create user scott identified by tiger default tablespace user_data temporary tablespace user_temp; /*第4步:給用戶授予權(quán)限 */grant connect,resource,dba to scott;SQLcreatetabletest(idint,namevarchar2(10);表已創(chuàng)建。SQLinsertinto testvalues(1001,zhangfei);已創(chuàng)建1行。SQLinsertinto testvalues(1002,guanyu);已創(chuàng)建1行。SQLcommit;提交完成。(2)模擬數(shù)據(jù)庫(kù)遭意外被迫關(guān)閉,并且系統(tǒng)數(shù)據(jù)文件丟失。SQLshutdownabort (3)啟動(dòng)服務(wù),啟動(dòng)數(shù)據(jù)庫(kù)a.啟動(dòng)服務(wù)b.啟動(dòng)數(shù)據(jù)庫(kù),肯定出錯(cuò)SQLstartup請(qǐng)給執(zhí)行結(jié)果:(4)把備份的SYSTEM01.dbf和UNDOTBS01.DBF文件復(fù)制回去a.執(zhí)行以下命令然后就可以打開數(shù)據(jù)庫(kù),查看scott用戶的test表。SQLalterdatabaseopen;SQLselect*fromscott.test;請(qǐng)給執(zhí)行結(jié)果:實(shí)驗(yàn)11-2數(shù)據(jù)庫(kù)是打開的,這時(shí)損壞的文件是用戶的數(shù)據(jù)文件而不是system和undo文件。 (1)用scott用戶在users表空間建立test1表SQL create table scott.test1(id int) 2 tablespace users; 表已創(chuàng)建。 (2) 插入兩條數(shù)據(jù)SQL insert into scott.test1 values(1); 已創(chuàng)建 1 行。SQL insert into scott.test1 values(2); 已創(chuàng)建 1 行。SQL commit; 提交完成。 (3)當(dāng)前日志歸檔SQL alter system archive log current; 系統(tǒng)已更改。(4)現(xiàn)在破壞users表空間,使其離線,然后移除users01.dbf到一個(gè)指定文件夾(備份) SQL alter tablespace users offline; 表空間已更改。移除users01.dbf到一個(gè)指定文件夾(備份)執(zhí)行:SQL alter tablespace users online;請(qǐng)給執(zhí)行結(jié)果:此時(shí)出現(xiàn)錯(cuò)誤,users表空間不能在線了。這時(shí)把備份的users01.DBF還原回去。然后,執(zhí)行:SQLrecovertablespaceusers; SQL recover tablespace users;(5)完成介質(zhì)恢復(fù)。SQL alter tablespace users online; 表空間已更改。SQL select * from scott.test1;請(qǐng)給執(zhí)行結(jié)果:實(shí)驗(yàn)11-3:數(shù)據(jù)文件沒有備份(不能使system和undo文件)的恢復(fù)。(1)創(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,name varchar2(10) tablespace testspace; SQL commit;SQL alter system switch logfile;SQL insert into scott.test3 values(1003,songjian); SQL commit;SQL alter tablespace testspace offline; SQL select * from scott.test3;請(qǐng)給執(zhí)行結(jié)果:(2)由于沒有備份數(shù)據(jù)文件,需重新創(chuàng)建一個(gè)SQL alter database create datafileC:oracleproduct10.1.0db_1TestDBtestspace.dbf; SQL recover tablespace testspace;(3) 完成恢復(fù)SQL alter tablespace testspace online; 表空間已更改。SQL select * from scott.test3;請(qǐng)給執(zhí)行結(jié)果:【實(shí)驗(yàn)練習(xí)題】本練習(xí)將對(duì)數(shù)據(jù)庫(kù)進(jìn)行物理備份,并執(zhí)行基于更改的不完全恢復(fù),以恢復(fù)被用戶誤刪除的數(shù)據(jù)。按以下步驟完成實(shí)驗(yàn)過(guò)程,并給出實(shí)驗(yàn)結(jié)果: 1) 以SYSDBA身份連接數(shù)據(jù)庫(kù)。2) 確

溫馨提示

  • 1. 本站所有資源如無(wú)特殊說(shuō)明,都需要本地電腦安裝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ì)自己和他人造成任何形式的傷害或損失。

評(píng)論

0/150

提交評(píng)論