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

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

0

积分

0

好友

5

主题
1#
发表于 2013-2-20 15:18:52 | 查看: 5172| 回复: 8
本帖最后由 yang738 于 2013-2-20 17:59 编辑

需求: 将一数据库的备份恢复到其它数据库服务器。

恢复过程:创建参数文件,启动实例到NOMOUNT,开始恢复控制文件。 这时发现备份里没包括控制文件的备份。


但发现备份文件里有控制文件的TRACE file 和 控制文件快照。

1:使用TRACE 文件中的脚本创建控制文件.
      错误:
     ORA-01503: CREATE CONTROLFILE failed
     ORA-01565: error in identifying file '/u02/oradata/DWH/system01.dbf'
     因为以上的文件不存在,本来是需要恢复的。

2:使用SNAPSHOT 来恢复
      cp snapshot to control01/2/3.ctl
      alter database mount;
      错误:
       ORA-00202: control file: '/u02/oradata/DWH/control01.ctl'
       ORA-27047: unable to read the header block of file
       Additional information: 2  
       Wed Feb 20 17:03:01 2013
       ORA-205 signalled during: alter database mount...
2.1   try to recover control file using rman from snapshot
         set dbid=2047844111
          restore controlfile from '/restore1/NEW_DWH_Dec_Full_Restore/DWH_snapcf.f';
       错误:
       RMAN-03002: failure of restore command at 02/20/2013 17:06:01
       RMAN-06172: no autobackup found or specified handle is not a valid copy or piece

3:现有的数据库服务器还在运行,但自从上次备份后,可能也增加一些数据文件。

4:TRACE FILE是通过以下语句生成的:
      ALTER DATABASE BACKUP CONTROLFILE TO TRACE AS
5: 控制文件快照是通过以下语句生成的:
      configure snapshot controlfile name to
6: rman 没有使用CATALOGUE DATABASE



请问,在这种情况下,还有其它方法可以尝试吗?

另外有没有方法验证控制文件快照文件是否损坏?

多谢关注。
     


补充:

我在现在运行的服务器上运行以下备份控制文件的命令:
SQL>  ALTER DATABASE BACKUP CONTROLFILE TO '/export/oracle/ctlbk';

Database altered.

然后,拷贝ctlbk 到另一台服务器上恢复:
RMAN> set dbid=2047844111

executing command: SET DBID

RMAN>  restore controlfile from '/export/oracle/ctlbk';

Starting restore at 20-FEB-13
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=430 devtype=DISK

RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of restore command at 02/20/2013 19:50:11
RMAN-06172: no autobackup found or specified handle is not a valid copy or piece

RMAN>
我还需要设置其它的吗?
2#
发表于 2013-2-20 15:30:13
再跑一次备份呗,用新的备份不就行了?

回复 只看该作者 道具 举报

3#
发表于 2013-2-20 15:31:26
wind 发表于 2013-2-20 15:30
再跑一次备份呗,用新的备份不就行了?

需要以前的数据。现在尝试用新的控制文件行不行。

回复 只看该作者 道具 举报

4#
发表于 2013-2-20 18:29:58
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options

SQL>
SQL> alter database backup controlfile to '/tmp/macleans_ctl';

Database altered.

SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL>
SQL> Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options


RMAN> restore controlfile from '/tmp/macleans_ctl';

Starting restore at 20-2月 -13
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=16 instance=PROD1 device type=DISK

channel ORA_DISK_1: copied control file copy
output file name=+DATADG/prod/controlfile/current.256.806578685
output file name=+SYSTEDG/prod/controlfile/current.256.806578687
Finished restore at 20-2月 -13




没有遇到你说的问题


试试不要 set dbid=2047844111

回复 只看该作者 道具 举报

5#
发表于 2013-2-20 18:50:38
Maclean Liu(刘相兵 发表于 2013-2-20 18:29
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the  ...

从网上找到一段代码:

SQL> DECLARE
  2   devtype varchar2(256);
  3   done boolean;
  4   BEGIN
  5   devtype:=sys.dbms_backup_restore.deviceAllocate(type=>'',ident=>'T1');
  6   sys.dbms_backup_restore.restoreSetDatafile;
  7   sys.dbms_backup_restore.restoreControlfileTo(cfname=>'/u02/oradata/DWH/control01a.ctl');
  8   sys.dbms_backup_restore.restoreBackupPiece(done=>done,handle=>'/opt/app/oracle/product/10.2.0/db_1/dbs/c-2047844111-20130212-00', params=>null);
  9   sys.dbms_backup_restore.deviceDeallocate;
10   END;
11  /
DECLARE
*
ERROR at line 1:
ORA-19624: operation failed, retry possible
ORA-19870: error reading backup piece
/opt/app/oracle/product/10.2.0/db_1/dbs/c-2047844111-20130212-00
ORA-19587: error occurred reading 0 bytes at block number 1
ORA-27091: unable to queue I/O
ORA-27067: size of I/O buffer is invalid
Additional information: 2
ORA-06512: at "SYS.X$DBMS_BACKUP_RESTORE", line 5149
ORA-06512: at line 8


SQL>

其中:c-2047844111-20130212-00 是以前备份的控制文件。
換成我刚备份的CTLBK 也是同样错误。

这段代码是我第一次看到。


回复 只看该作者 道具 举报

6#
发表于 2013-2-20 18:54:28
yang738 发表于 2013-2-20 18:50
从网上找到一段代码:

SQL> DECLARE

不设置DBID:
-bash-3.00$ rman target /

Recovery Manager: Release 10.2.0.1.0 - Production on Wed Feb 20 21:09:49 2013

Copyright (c) 1982, 2005, Oracle.  All rights reserved.

connected to target database: DWH (not mounted)

RMAN> restore controlfile from '/export/oracle/ctlbk';

Starting restore at 20-FEB-13
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=434 devtype=DISK

RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of restore command at 02/20/2013 21:09:58
RMAN-06172: no autobackup found or specified handle is not a valid copy or piece

RMAN>

难道是我的备份文件有错吗?我试过几个不同的备份文件,都报同样的错误。

回复 只看该作者 道具 举报

7#
发表于 2013-2-20 18:56:05

重新做一次backup controlfile , ftp /cp时注意下

回复 只看该作者 道具 举报

8#
发表于 2013-2-20 18:56:09

重新做一次backup controlfile , ftp /cp时注意下

回复 只看该作者 道具 举报

9#
发表于 2013-2-20 19:00:53
多谢指点,我再试一下。


顺便説一下:我在另外一台其它的数据库服务器上做备份,然后可以恢复:难道和目前所用的这台服务器有关系?
备份: ALTER DATABASE BACKUP CONTROLFILE TO '/export/oracle/ctl.bk';
恢复:
RMAN> restore controlfile from '/export/oracle/ctl.bk';

Starting restore at 20-FEB-13
using channel ORA_DISK_1

channel ORA_DISK_1: copied control file copy
output filename=/u02/oradata/DWH/control01.ctl
output filename=/u02/oradata/DWH/control02.ctl
output filename=/u03/oradata/DWH/control03.ctl
Finished restore at 20-FEB-13

RMAN>

回复 只看该作者 道具 举报

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

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

GMT+8, 2024-11-16 08:56 , Processed in 0.054420 second(s), 20 queries .

Powered by Discuz! X2.5

© 2001-2012 Comsenz Inc.

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