曙海教育集團論壇開發語言培訓專區Oracle數據庫 → Oracle備份恢復之利用dbms_backup_restore恢復數據庫


  共有8650人關注過本帖樹形打印

主題:Oracle備份恢復之利用dbms_backup_restore恢復數據庫

美女呀,離線,留言給我吧!
wangxinxin
  1樓 個性首頁 | 博客 | 信息 | 搜索 | 郵箱 | 主頁 | UC


加好友 發短信
等級:青蜂俠 帖子:1393 積分:14038 威望:0 精華:0 注冊:2010-11-12 11:08:23
Oracle備份恢復之利用dbms_backup_restore恢復數據庫  發帖心情 Post By:2010-12-11 11:08:29

引用
RMAN> run {
2> allocate channel ch00 device type disk;
3> backup database include current controlfile format '/backup/full%t' tag='FULLDB';
4> sql 'alter system archive log current';
5> backup archivelog all format '/backup/arch%t' tag='ARCHIVELOG';
6> release channel ch00;
7> }

allocated channel: ch00
channel ch00: sid=17 devtype=DISK

Starting backup at 20-JAN-10
channel ch00: starting full datafile backupset
channel ch00: specifying datafile(s) in backupset
including current controlfile in backupset
input datafile fno=00001 name=/app/oracle/oradata/ora9i/system01.dbf
input datafile fno=00002 name=/app/oracle/oradata/ora9i/undotbs01.dbf
input datafile fno=00005 name=/app/oracle/oradata/ora9i/example01.dbf
input datafile fno=00011 name=/app/oracle/oradata/ora9i/STREAM01.dbf
input datafile fno=00010 name=/app/oracle/oradata/ora9i/xdb01.dbf
input datafile fno=00006 name=/app/oracle/oradata/ora9i/indx01.dbf
input datafile fno=00009 name=/app/oracle/oradata/ora9i/users01.dbf
input datafile fno=00003 name=/app/oracle/oradata/ora9i/cwmlite01.dbf
input datafile fno=00004 name=/app/oracle/oradata/ora9i/drsys01.dbf
input datafile fno=00007 name=/app/oracle/oradata/ora9i/odm01.dbf
input datafile fno=00008 name=/app/oracle/oradata/ora9i/tools01.dbf
channel ch00: starting piece 1 at 20-JAN-10
channel ch00: finished piece 1 at 20-JAN-10
piece handle=/backup/full708756233 comment=NONE
channel ch00: backup set complete, elapsed time: 00:02:26
Finished backup at 20-JAN-10

Starting Control File and SPFILE Autobackup at 20-JAN-10
piece handle=/app/oracle/product/9.0.2/dbs/c-2494723682-20100120-00 comment=NONE
Finished Control File and SPFILE Autobackup at 20-JAN-10

sql statement: alter system archive log current

Starting backup at 20-JAN-10
current log archived
channel ch00: starting archive log backupset
channel ch00: specifying archive log(s) in backup set
input archive log thread=1 sequence=1 recid=254 stamp=708756150
input archive log thread=1 sequence=2 recid=255 stamp=708756383
input archive log thread=1 sequence=3 recid=256 stamp=708756383
channel ch00: starting piece 1 at 20-JAN-10
channel ch00: finished piece 1 at 20-JAN-10
piece handle=/backup/arch708756383 comment=NONE
channel ch00: backup set complete, elapsed time: 00:00:02
Finished backup at 20-JAN-10

Starting Control File and SPFILE Autobackup at 20-JAN-10
piece handle=/app/oracle/product/9.0.2/dbs/c-2494723682-20100120-01 comment=NONE
Finished Control File and SPFILE Autobackup at 20-JAN-10

released channel: ch00

假設現在數據庫異常宕機
引用
SQL> shutdown abort
ORACLE instance shut down

啟動數據庫至nomount狀態
引用
SQL> startup nomount
ORACLE instance started.

Total System Global Area 1125193868 bytes
Fixed Size                   452748 bytes
Variable Size             335544320 bytes
Database Buffers          788529152 bytes
Redo Buffers                 667648 bytes

1、利用dbms_backup_restore恢復控制文件
引用

SQL> DECLARE
  2  devtype varchar2(256);
  3  done boolean;
  4  BEGIN
  5  devtype := dbms_backup_restore.DeviceAllocate(type => '',ident => 'testctl');
  6  dbms_backup_restore.RestoresetdataFile;
  7  dbms_backup_restore.RestoreControlFileto('/app/oracle/oradata/ora9i/control01.ctl');
  8  dbms_backup_restore.RestoreBackupPiece('/backup/full708756233',done => done);
  9  dbms_backup_restore.RestoresetdataFile;
10  dbms_backup_restore.RestoreControlFileto('/app/oracle/oradata/ora9i/control02.ctl');
11  dbms_backup_restore.RestoreBackupPiece('/backup/full708756233',done => done);
12  dbms_backup_restore.RestoresetdataFile;
13  dbms_backup_restore.RestoreControlFileto('/app/oracle/oradata/ora9i/control03.ctl');
14  dbms_backup_restore.RestoreBackupPiece('/backup/full708756233',done => done);
15  dbms_backup_restore.DeviceDeallocate;
16  END;
17  /

PL/SQL procedure successfully completed.

當然也已可用rman進行控制文件恢復
引用
RMAN> restore controlfile from '/app/oracle/product/9.0.2/dbs/c-2494723682-20100120-00';

Starting restore at 20-JAN-10

using channel ORA_DISK_1
channel ORA_DISK_1: restoring controlfile
channel ORA_DISK_1: restore complete
replicating controlfile
input filename=/app/oracle/oradata/ora9i/control01.ctl
output filename=/app/oracle/oradata/ora9i/control02.ctl
output filename=/app/oracle/oradata/ora9i/control03.ctl
Finished restore at 20-JAN-10


2、利用dbms_backup_restore恢復數據文件
引用
SQL> DECLARE
  2  devtype varchar2(256);
  3  done boolean;
  4  BEGIN
  5  devtype := dbms_backup_restore.DeviceAllocate (type => '',ident => 'testdatafile');
  6  dbms_backup_restore.RestoreSetDatafile;
  7  dbms_backup_restore.RestoreDatafileTo(dfnumber => 1,toname => '/app/oracle/oradata/ora9i/system01.dbf');
  8  dbms_backup_restore.RestoreDatafileTo(dfnumber => 2,toname => '/app/oracle/oradata/ora9i/undotbs01.dbf');
  9  dbms_backup_restore.RestoreBackupPiece(done => done,handle => '/backup/full708756233', params => null);
10  dbms_backup_restore.DeviceDeallocate;
11  END;
12  /



PL/SQL procedure successfully completed.

3、利用dbms_backup_restore恢復歸檔日志
引用
SQL> DECLARE
  2  devtype varchar2(256);
  3  done boolean;
  4  BEGIN
  5  devtype := dbms_backup_restore.DeviceAllocate (type => '',ident => 'testarchlog');
  6  dbms_backup_restore.RestoreSetArchivedLog(destination=>'/app/oracle/product/9.0.2/dbs/arch');
  7  dbms_backup_restore.RestoreArchivedLog(thread=>1,sequence=>1);
  8  dbms_backup_restore.RestoreArchivedLog(thread=>1,sequence=>2);
  9  dbms_backup_restore.RestoreArchivedLog(thread=>1,sequence=>3);
10  dbms_backup_restore.RestoreBackupPiece(done => done,handle => '/backup/arch708756383', params => null);
11  dbms_backup_restore.DeviceDeallocate;
12  END;
13  /

PL/SQL procedure successfully completed.


支持(0中立(0反對(0單帖管理 | 引用 | 回復 回到頂部

返回版面帖子列表

Oracle備份恢復之利用dbms_backup_restore恢復數據庫








簽名
主站蜘蛛池模板: 日韩欧美亚洲国产精品字幕久久久| 最近免费中文在线视频| 老少交欧美另类| 日韩精品在线视频观看| 国产成人精品视频网站| 亚洲av无码精品国产成人| 48沈阳熟女高潮嗷嗷叫| 18女人腿打开无遮挡软| 欧美成人免费观看的| 国产精品成人久久久久久久| 亚洲成人在线电影| 2021国产麻豆剧传媒官网| 欧美成人免费全部观看在线看 | 亚洲三级小视频| 亚洲精品第一国产综合野| 模特冰漪丰硕之美1| 国产成人无码区免费内射一片色欲| 久旷成熟的岳的| 越南大胆女人体337p欣赏| 拍拍拍无挡视频免费观看1000 | 啊轻点灬大ji巴太粗太长了h| 丰满少妇人妻久久久久久| 美女被羞羞在线观看漫画| 尤物视频在线播放| 亲密爱人之无限诱惑| 97色偷偷色噜噜狠狠爱网站97| 欧美特黄视频在线观看| 国产男女猛烈无遮挡免费视频 | 精品无码一区二区三区在线| 尤物yw午夜国产精品视频| 人人妻人人做人人爽| 777亚洲精品乱码久久久久久| 樱花草在线社区www| 国产剧情av麻豆香蕉精品| 中文字幕在线视频精品| 男女肉粗暴进来120秒动态图| 国内精自视频品线六区免费| 亚洲午夜无码久久久久| 韩国美女vip福利一区| 性猛交╳xxx乱大交| 亚洲熟妇少妇任你躁在线观看无码 |