Oracle数据库数据恢复、性能优化

找回密码
注册
搜索
热搜: 活动 交友 discuz
发新帖

0

积分

1

好友

9

主题
1#
发表于 2014-8-25 20:58:01 | 查看: 3395| 回复: 4
操作系统是红帽6.1
Red Hat Enterprise Linux Server release 6.1 (Santiago)

数据库是12.1.0.1.0


最开始做了一个全备份
RMAN> backup database format '/u02/bak/rman_%U.bak';

Starting backup at 25-AUG-14
using channel ORA_DISK_1
using channel ORA_DISK_2
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00001 name=/u01/dbfile/o12c/system01.dbf
input datafile file number=00004 name=/u01/dbfile/o12c/users01.dbf
input datafile file number=00014 name=/u01/dbfile/o12c/p3_tbsp01.dbf
input datafile file number=00005 name=/u02/dbfile/o12c/tools01.dbf
input datafile file number=00006 name=/u01/dbfile/o12c/reg_data01.dbf
input datafile file number=00007 name=/u01/dbfile/o12c/reg_index01.dbf
input datafile file number=00003 name=/u01/dbfile/o12c/undotbs01.dbf
channel ORA_DISK_1: starting piece 1 at 25-AUG-14
channel ORA_DISK_2: starting full datafile backup set
channel ORA_DISK_2: specifying datafile(s) in backup set
input datafile file number=00002 name=/u01/dbfile/o12c/sysaux01.dbf
input datafile file number=00012 name=/u01/dbfile/o12c/p1_tbsp01.dbf
input datafile file number=00008 name=/u01/dbfile/o12c/inv_mgmt_data01.dbf
input datafile file number=00009 name=/u01/dbfile/o12c/tools_comp01.dbf
input datafile file number=00010 name=/u01/dbfile/o12c/hr_data01.dbf
input datafile file number=00011 name=/u01/dbfile/o12c/hr_index01.dbf
input datafile file number=00013 name=/u01/dbfile/o12c/p2_tbsp01.dbf
channel ORA_DISK_2: starting piece 1 at 25-AUG-14
channel ORA_DISK_2: finished piece 1 at 25-AUG-14
piece handle=/u02/bak/rman_06pgrllu_1_1.bak tag=TAG20140825T170917 comment=NONE
channel ORA_DISK_2: backup set complete, elapsed time: 00:00:25
channel ORA_DISK_2: starting full datafile backup set
channel ORA_DISK_2: specifying datafile(s) in backup set
including current control file in backup set
channel ORA_DISK_2: starting piece 1 at 25-AUG-14
channel ORA_DISK_1: finished piece 1 at 25-AUG-14
piece handle=/u02/bak/rman_05pgrllu_1_1.bak tag=TAG20140825T170917 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:42
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
including current SPFILE in backup set
channel ORA_DISK_1: starting piece 1 at 25-AUG-14
channel ORA_DISK_2: finished piece 1 at 25-AUG-14
piece handle=/u02/bak/rman_07pgrlmn_1_1.bak tag=TAG20140825T170917 comment=NONE
channel ORA_DISK_2: backup set complete, elapsed time: 00:00:01
channel ORA_DISK_1: finished piece 1 at 25-AUG-14
piece handle=/u02/bak/rman_08pgrln9_1_1.bak tag=TAG20140825T170917 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 25-AUG-14

RMAN>


2#
发表于 2014-8-25 20:58:27
RMAN> list backup;


List of Backup Sets
===================


BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
5       Full    246.30M    DISK        00:00:15     25-AUG-14      
        BP Key: 5   Status: AVAILABLE  Compressed: NO  Tag: TAG20140825T170917
        Piece Name: /u02/bak/rman_06pgrllu_1_1.bak
  List of Datafiles in backup set 5
  File LV Type Ckp SCN    Ckp Time  Name
  ---- -- ---- ---------- --------- ----
  2       Full 1210879    25-AUG-14 /u01/dbfile/o12c/sysaux01.dbf
  8       Full 780907     12-AUG-14 /u01/dbfile/o12c/inv_mgmt_data01.dbf
  9       Full 1210879    25-AUG-14 /u01/dbfile/o12c/tools_comp01.dbf
  10      Full 1210879    25-AUG-14 /u01/dbfile/o12c/hr_data01.dbf
  11      Full 1210879    25-AUG-14 /u01/dbfile/o12c/hr_index01.dbf
  12      Full 1210879    25-AUG-14 /u01/dbfile/o12c/p1_tbsp01.dbf
  13      Full 1210879    25-AUG-14 /u01/dbfile/o12c/p2_tbsp01.dbf

BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
6       Full    359.63M    DISK        00:00:40     25-AUG-14      
        BP Key: 6   Status: AVAILABLE  Compressed: NO  Tag: TAG20140825T170917
        Piece Name: /u02/bak/rman_05pgrllu_1_1.bak
  List of Datafiles in backup set 6
  File LV Type Ckp SCN    Ckp Time  Name
  ---- -- ---- ---------- --------- ----
  1       Full 1210878    25-AUG-14 /u01/dbfile/o12c/system01.dbf
  3       Full 1210878    25-AUG-14 /u01/dbfile/o12c/undotbs01.dbf
  4       Full 1210878    25-AUG-14 /u01/dbfile/o12c/users01.dbf
  5       Full 1210878    25-AUG-14 /u02/dbfile/o12c/tools01.dbf
  6       Full 1210878    25-AUG-14 /u01/dbfile/o12c/reg_data01.dbf
  7       Full 1210878    25-AUG-14 /u01/dbfile/o12c/reg_index01.dbf
  14      Full 1210878    25-AUG-14 /u01/dbfile/o12c/p3_tbsp01.dbf

BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
7       Full    17.89M     DISK        00:00:18     25-AUG-14      
        BP Key: 7   Status: AVAILABLE  Compressed: NO  Tag: TAG20140825T170917
        Piece Name: /u02/bak/rman_07pgrlmn_1_1.bak
  Control File Included: Ckp SCN: 1210890      Ckp time: 25-AUG-14

BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
8       Full    80.00K     DISK        00:00:00     25-AUG-14      
        BP Key: 8   Status: AVAILABLE  Compressed: NO  Tag: TAG20140825T170917
        Piece Name: /u02/bak/rman_08pgrln9_1_1.bak
  SPFILE Included: Modification time: 25-AUG-14
  SPFILE db_unique_name: O12C

这些是显示的备份信息

回复 只看该作者 道具 举报

3#
发表于 2014-8-25 21:00:30
然后我把/u01/dbfile/o12c目录里的所有文件都删除了,
shutdown abort,准备做数据库恢复

[oracle@db ~]$ rman target /


Recovery Manager: Release 12.1.0.1.0 - Production on Mon Aug 25 20:50:42 2014

Copyright (c) 1982, 2013, Oracle and/or its affiliates.  All rights reserved.

connected to target database (not started)

RMAN>
RMAN> startup nomount

Oracle instance started

Total System Global Area    1068937216 bytes

Fixed Size                     2296576 bytes
Variable Size                440403200 bytes
Database Buffers             620756992 bytes
Redo Buffers                   5480448 bytes

RMAN> restore controlfile from '/u02/bak/rman_07pgrlmn_1_1.bak';

Starting restore at 2014-08-25 20:51:42
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=20 device type=DISK

channel ORA_DISK_1: restoring control file
channel ORA_DISK_1: restore complete, elapsed time: 00:00:07
output file name=/u01/dbfile/o12c/control01.ctl
output file name=/u02/dbfile/o12c/control02.ctl
output file name=/u02/dbfile/o12c/control99.ctl

但是当恢复了控制文件以后,发现备份集5以后的信息都缺失了,无法restore database了

RMAN> list backup;

using target database control file instead of recovery catalog

List of Backup Sets
===================


BS Key  Type LV Size       Device Type Elapsed Time Completion Time   
------- ---- -- ---------- ----------- ------------ -------------------
5       Full    246.30M    DISK        00:00:15     2014-08-25 17:09:33
        BP Key: 5   Status: AVAILABLE  Compressed: NO  Tag: TAG20140825T170917
        Piece Name: /u02/bak/rman_06pgrllu_1_1.bak
  List of Datafiles in backup set 5
  File LV Type Ckp SCN    Ckp Time            Name
  ---- -- ---- ---------- ------------------- ----
  2       Full 1210879    2014-08-25 17:09:18 /u01/dbfile/o12c/sysaux01.dbf
  8       Full 780907     2014-08-12 15:07:23 /u01/dbfile/o12c/inv_mgmt_data01.dbf
  9       Full 1210879    2014-08-25 17:09:18 /u01/dbfile/o12c/tools_comp01.dbf
  10      Full 1210879    2014-08-25 17:09:18 /u01/dbfile/o12c/hr_data01.dbf
  11      Full 1210879    2014-08-25 17:09:18 /u01/dbfile/o12c/hr_index01.dbf
  12      Full 1210879    2014-08-25 17:09:18 /u01/dbfile/o12c/p1_tbsp01.dbf
  13      Full 1210879    2014-08-25 17:09:18 /u01/dbfile/o12c/p2_tbsp01.dbf

RMAN> restore database;

Starting restore at 2014-08-25 20:54:33
Starting implicit crosscheck backup at 2014-08-25 20:54:33
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=20 device type=DISK
allocated channel: ORA_DISK_2
channel ORA_DISK_2: SID=21 device type=DISK
Crosschecked 1 objects
Finished implicit crosscheck backup at 2014-08-25 20:54:34

Starting implicit crosscheck copy at 2014-08-25 20:54:34
using channel ORA_DISK_1
using channel ORA_DISK_2
Crosschecked 2 objects
Finished implicit crosscheck copy at 2014-08-25 20:54:35

searching for all files in the recovery area
cataloging files...
cataloging done

List of Cataloged Files
=======================
File Name: /u02/fra/O12C/backupset/2014_08_25/o1_mf_nnsnf_TAG20140825T182007_9zp3gqpq_.bkp

using channel ORA_DISK_1
using channel ORA_DISK_2

creating datafile file number=1 name=/u01/dbfile/o12c/system01.dbf
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of restore command at 08/25/2014 20:54:36
ORA-01180: can not create datafile 1
ORA-01110: data file 1: '/u01/dbfile/o12c/system01.dbf'


回复 只看该作者 道具 举报

4#
发表于 2014-8-25 22:04:41
restore controlfile from '/u02/bak/rman_07pgrlmn_1_1.bak';

为什么要手动指定 这个文件? 而不是按照标准流程?

回复 只看该作者 道具 举报

5#
发表于 2014-8-26 11:12:51
是用自动备份的控制文件
alter database nomount;
restore controlfile from autobackup;
alter database mount;
这样的命令么?这个在最初的configure里面并没有配置控制文件的自动备份,所以报错了。

回复 只看该作者 道具 举报

您需要登录后才可以回帖 登录 | 注册

QQ|手机版|Archiver|Oracle数据库数据恢复、性能优化

GMT+8, 2024-5-17 16:56 , Processed in 0.047679 second(s), 20 queries .

Powered by Discuz! X2.5

© 2001-2012 Comsenz Inc.

回顶部
TEL/電話+86 13764045638
Email service@parnassusdata.com
QQ 47079569