1. 首页
  2. IT资讯

RAC 数据库恢复到单实例下并且基于时间点恢复

RAC 下基于时间点的恢复
1、源库进行备份 我这里进行了2次备份
2、拷贝2次的备份集到目标机器上,在目标机器上建立好SPFILE.
3、使用recover controlfile from 进行控制文件恢复,这个没什么好说的确定好控制文件所在备份集进行恢复就可以了。
4、重新命名进行恢复

run {
set newname for datafile ‘+DATA/rac/datafile/system.270.790795355’ to ‘/home/oradba/db/rac/system.dbf’;
set newname for datafile ‘+DATA/rac/datafile/sysaux.271.790795355’ to ‘/home/oradba/db/rac/sysaux.dbf’;
set newname for datafile ‘+DATA/rac/datafile/undotbs1.272.790795355’ to ‘/home/oradba/db/rac/undotbs1.dbf’;
set newname for datafile ‘+DATA/rac/datafile/users.273.790795355’ to ‘/home/oradba/db/rac/users.dbf’;
set newname for datafile ‘+DATA/rac/datafile/undotbs2.278.790795443’ to ‘/home/oradba/db/rac/undotbs2.dbf’;
restore database from tag=’TAG20120921T224531′;
}
完成后可以用report schema看一下
5、重命令控制文件中记录的文件包括数据文件和日志文件
alter database rename file ‘+DATA/rac/datafile/system.270.790795355’ to ‘/home/oradba/db/rac/system.dbf’;
alter database rename file ‘+DATA/rac/datafile/sysaux.271.790795355’ to ‘/home/oradba/db/rac/sysaux.dbf’;
alter database rename file ‘+DATA/rac/datafile/undotbs1.272.790795355’ to ‘/home/oradba/db/rac/undotbs1.dbf’;
alter database rename file ‘+DATA/rac/datafile/users.273.790795355’ to ‘/home/oradba/db/rac/users.dbf’;
alter database rename file ‘+DATA/rac/datafile/undotbs2.278.790795443’ to ‘/home/oradba/db/rac/undotbs2.dbf’;
alter database rename file ‘+DATA/rac/datafile/logfile1.dbf’ to ‘/home/oradba/db/rac/logfile1.dbf’;
………..
6、确定时间点
run {
set until time “to_date(‘2012-09-22 18:59:40′,’yyyy-mm-dd hh24:mi:ss’)”;
recover database;
}
7、alter database open resetlogs;
8、重建临时表空间

SQL> create temporary tablespace temp1 tempfile ‘/home/oradba/db/rac/temp1.dbf’ size 100m autoextend on;

Tablespace created.

SQL> alter database default temporary tablespace temp1;

Database altered.

SQL> drop tablespace temp;

Tablespace dropped.
9、删除无用的日志组
   THREAD# STATUS ENABLED      GROUPS INSTANCE
———- —— ——– ———- ——————————————
         1 OPEN   PUBLIC            2 rac
         2 CLOSED PUBLIC            2 rac2

SQL> alter database disable thread 2;

Database altered.

QL> select * from v$log;
truncating (as requested) before column FIRST_CHANGE#

    GROUP#    THREAD#  SEQUENCE#      BYTES    MEMBERS ARC STATUS           FIRS
———- ———- ———- ———- ———- — —————- —-
         1          1          3   52428800          1 YES INACTIVE         22-S
         2          1          4   52428800          1 NO  CURRENT          22-S
         3          2          1   52428800          1 YES INACTIVE         22-S
         4          2          2   52428800          1 NO  INACTIVE         22-S

SQL> alter database drop logfile group 3;

Database altered.

SQL> lter database drop logfile group 4;
SP2-0734: unknown command beginning “lter datab…” – rest of line ignored.
SQL> alter database drop logfile group 4;
alter database drop logfile group 4
*
ERROR at line 1:
ORA-00350: log 4 of instance rac2 (thread 2) needs to be archived
ORA-00312: online log 4 thread 2: ‘/home/oradba/db/rac/redo4.log’

SQL> alter database clear unarchived logfile group 4;

Database altered.

SQL>
SQL> alter database drop logfile group 4;

Database altered.
10、删除不用的UNDO tablespace

SQL> show parameter undo

NAME                                 TYPE        VALUE
———————————— ———– ——————————
undo_management                      string      AUTO
undo_retention                       integer     900
undo_tablespace                      string      UNDOTBS1

SQL> drop tablespace undotbs2 including contents and datafiles;

Tablespace dropped.

 

至此完成。

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/7728585/viewspace-744792/,如需转载,请注明出处,否则将追究法律责任。

主题测试文章,只做测试使用。发布者:深沉的少年,转转请注明出处:http://www.cxybcw.com/183284.html

联系我们

13687733322

在线咨询:点击这里给我发消息

邮件:1877088071@qq.com

工作时间:周一至周五,9:30-18:30,节假日休息

QR code