mysql oracle 备份数据库备份_完整备份Oracle数据库
修改備份文件的有效時間(必須用spfile啟動數(shù)據(jù)庫)SQLgt; alter system set control_file_record_keep_time=30 scope=both;
修改備份文件的有效時間(必須用spfile啟動數(shù)據(jù)庫)
SQL> alter system set control_file_record_keep_time=30 scope=both;
System altered.
先啟動歸檔
SQL> startup mount
Oracle instance started.
Total System Global Area 314572800 bytes
Fixed Size 1219136 bytes
Variable Size 96470464 bytes
Database Buffers 209715200 bytes
Redo Buffers 7168000 bytes
Database mounted.
SQL> alter database archivelog;
Database altered.
[root@bw ~]# su - oracle
[oracle@bw ~]$ rman target /
Recovery Manager: Release 10.2.0.1.0 - Production on Sun Apr 24 10:14:45 2011
Copyright (c) 1982, 2005, Oracle. All rights reserved.
connected to target database: BW (DBID=3011863310)
RMAN> show all;
using target database control file instead of recovery catalog
RMAN configuration parameters are:
CONFIGURE RETENTION POLICY TO REDUNDANCY 1; # default
CONFIGURE BACKUP OPTIMIZATION OFF; # default
CONFIGURE DEFAULT DEVICE TYPE TO DISK; # default
CONFIGURE CONTROLFILE AUTOBACKUP OFF; # default
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '%F'; # default
CONFIGURE DEVICE TYPE DISK PARALLELISM 1 BACKUP TYPE TO BACKUPSET; # default
CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE MAXSETSIZE TO UNLIMITED; # default
CONFIGURE ENCRYPTION FOR DATABASE OFF; # default
CONFIGURE ENCRYPTION ALGORITHM 'AES128'; # default
CONFIGURE ARCHIVELOG DELETION POLICY TO NONE; # default
CONFIGURE SNAPSHOT CONTROLFILE NAME TO '/u01/app/oracle/product/10.2/db_1/dbs/snapcf_bw.f'; # default
RMAN> CONFIGURE CONTROLFILE AUTOBACKUP ON;
new RMAN configuration parameters:
CONFIGURE CONTROLFILE AUTOBACKUP ON;
new RMAN configuration parameters are successfully stored
[oracle@bw u01]$ rman target /
RMAN> run{
2> allocate channel d1 type disk;
3> allocate channel d2 type disk;
4>backup full database format '/u01/bak/bw20110430_%u.bak' tag=bwfull01;
5> release channel d1;
6> release channel d2;
7> }
回車
開始恢復數(shù)據(jù)庫文件
在/u01/oradata/bw下刪除dbf文件 (沒有刪除控制文件)
[oracle@bw bw]$ rm -rf *dbf
恢復
[oracle@bw u01]$ rman target /
RMAN> startup nomount;
RMAN> alter database mount;
RMAN> restore database;
RMAN> recover database;
Starting recover at 23-APR-11
using channel ORA_DISK_1
starting media recovery
media recovery complete, elapsed time: 00:00:01
Finished recover at 23-APR-11(表示還原成功)
如果控制文件和數(shù)據(jù)文件都刪除
[oracle@bw ~]$ cd /u01/oradata/bw/
[oracle@bw bw]$ ll
total 1005496
-rw-r----- 1 oracle oinstall 104865792 Apr 26 20:53 bw01.dbf
-rw-r----- 1 oracle oinstall 115351552 Apr 26 21:14 bwtbs01.dbf
-rw-r----- 1 oracle oinstall 17547264 Apr 26 21:14 control01.ctl(紅色部分都刪除)
-rw-r----- 1 oracle oinstall 17547264 Apr 26 21:14 control02.ctl
-rw-r----- 1 oracle oinstall 17547264 Apr 26 21:14 control03.ctl
-rw-r----- 1 oracle oinstall 20972032 Apr 26 21:14 redo1_1.dbf
-rw-r----- 1 oracle oinstall 20972032 Apr 26 20:36 redo2_1.dbf
-rw-r----- 1 oracle oinstall 20972032 Apr 26 20:48 redo3_1.dbf
-rw-r----- 1 oracle oinstall 314580992 Apr 26 21:14 sysaux01.dbf
-rw-r----- 1 oracle oinstall 314580992 Apr 26 21:14 system01.dbf
-rw-r----- 1 oracle oinstall 209723392 Apr 26 21:09 temp01.dbf
-rw-r----- 1 oracle oinstall 20972032 Apr 26 21:14 redo1_1.rdo
-rw-r----- 1 oracle oinstall 20972032 Apr 26 20:36 redo2_1.rdo
-rw-r----- 1 oracle oinstall 20972032 Apr 26 20:48 redo3_1.rdo
[oracle@bw ~]$rm –rf*dbf
[oracle@bw ~]$rm –rf*ctl
[oracle@bw ~]$ll
-rw-r----- 1 oracle oinstall 20972032 Apr 26 21:14 redo1_1.rdo
-rw-r----- 1 oracle oinstall 20972032 Apr 26 20:36 redo2_1.rdo
-rw-r----- 1 oracle oinstall 20972032 Apr 26 20:48 redo3_1.rdo
[oracle@bw ~]$rman target /
Recovery Manager: Release 10.2.0.1.0 - Production on Tue Apr 26 19:46:45 2011
Copyright (c) 1982, 2005, Oracle. All rights reserved.
connected to target database: bw (not mounted)
RMAN> startup nomount;
database is already started
[oracle@bw ~]$ cd $ORACLE_HOME/dbs
[oracle@bw dbs]$ ll
total 34452
-rw-r----- 1 oracle oinstall 17629184 Apr 26 19:37 c-3011863310-20110426-00
-rw-r--r-- 1 oracle oinstall 849 Apr 22 13:38 db.sql
-rw-rw---- 1 oracle oinstall 1544 Apr 22 13:37 hc_bw.dat
-rw-r--r-- 1 oracle oinstall 960 Apr 22 13:36 initbw.ora
-rw-r----- 1 oracle oinstall 12920 May 3 2001 initdw.ora
-rw-r----- 1 oracle oinstall 8385 Sep 11 1998 init.ora
-rw-rw---- 1 oracle oinstall 24 Apr 22 13:38 lkBW
-rw-r----- 1 oracle oinstall 1536 Apr 22 13:36 orapwbw
-rw-r----- 1 oracle oinstall 17547264 Apr 26 19:37 snapcf_bw.f
-rw-r----- 1 oracle oinstall 2560 Apr 26 19:28 spfilebw.ora
RMAN> set dbid=3011863310;
executing command: SET DBID
·
RMAN> restore controlfile from autobackup;
Starting restore at 26-APR-11
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=47 devtype=DISK
channel ORA_DISK_1: looking for autobackup on day: 20110426
channel ORA_DISK_1: autobackup found: c-3011863310-20110426-00
channel ORA_DISK_1: control file restore from autobackup complete
output filename=/u01/oradata/bw/control01.ctl
output filename=/u01/oradata/bw/control02.ctl
output filename=/u01/oradata/bw/control03.ctl
Finished restore at 26-APR-11
(控制文件恢復成功)
開始恢復數(shù)據(jù)文件
[oracle@bw u01]$ rman target /
RMAN> startup nomount;
RMAN> alter database mount;
RMAN> restore database;
RMAN> recover database;
Starting recover at 23-APR-11
using channel ORA_DISK_1
starting media recovery
media recovery complete, elapsed time: 00:00:01
Finished recover at 23-APR-11(表示還原成功)
[oracle@bw ~]$ sqlplus / as sysdba
SQL*Plus: Release 10.2.0.1.0 - Production on Tue Apr 26 20:12:42 2011
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Connected to an idle instance.
SQL> startup
ORACLE instance started.
Total System Global Area 314572800 bytes
Fixed Size 1219136 bytes
Variable Size 96470464 bytes
Database Buffers 209715200 bytes
Redo Buffers 7168000 bytes
Database mounted.
ORA-01589: must use RESETLOGS or NORESETLOGS option for database open
SQL> alter database open resetlogs;
Database altered.
SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup
ORACLE instance started.
Total System Global Area 314572800 bytes
Fixed Size 1219136 bytes
Variable Size 96470464 bytes
Database Buffers 209715200 bytes
Redo Buffers 7168000 bytes
Database mounted.
Database opened.
SQL>
,
本文原創(chuàng)發(fā)布php中文網(wǎng),轉(zhuǎn)載請注明出處,感謝您的尊重!
總結(jié)
以上是生活随笔為你收集整理的mysql oracle 备份数据库备份_完整备份Oracle数据库的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 广东人为什么能吃还瘦?
- 下一篇: 和佳股份有没有纳米机器人_新高赛复赛入围