legato7.2 + AIX + ORACLE数据库全库异地恢复案例

教程发布:风哥 教程分类:ITPUX技术网 更新日期:2022-02-12 浏览学习:41

关键字:
legato + ORACLE数据库RMAN恢复
作者:
ioriakyo
一、描述:
使用legato7.2进行ORACLE数据库RMAN恢复。
二、环境配置:
备份服务器端:legato7.2 + WINDOWS 2000 SERVER
原服务器端:legato7.2 + AIX + ORACLE 9.2.0.8
目标服务器端:legato7.2 + AIX + ORACLE 9.2.0.8
[@more@]三、处理过程:
1、目标服务器端:
安装AIX系统和ORACLE数据库。

2、目标服务器端:
安装LEGATO客户端:
legato客户端安装:
1)、解压nw722_jumbo_aix.tar(tar -xvf nw722_jumbo_aix.tar)
如果是nw722_jumbo_aix.tar.gz(gunzip nw722_jumbo_aix.tar.gz)
2)、安装LGTOnw.clnt.rte
legato数据库在线备份模块安装:
1)、解压nmo42_aix5L_64.tar(tar -xvf nmo42_aix5L_64.tar)
如果是nmo42_aix5L_64.tar.gz(gunzip nmo42_aix5L_64.tar.gz)
2)、安装LGTOnmo.rte

3、目标服务器端:
建立数据库软连接,并测试:
ln -s /usr/lib/libnwora.a $ORACLE_HOME/lib/libobk.a
(目录:$ORACLE_HOME/lib/)
启动legato客户端,测试连接:
/etc/rc.nsr start(起LEGATO服务)
su - oracle
./sbttest libobk.a(测试ORACLE连接库是否生效)

4、目标服务器端:
目标服务器上的HOSTS表要添加原服务器端的IP和主机名的对应列表:
**.**.**.** backupserver
**.**.**.** localnode

5、备份服务器端:
在C:WINDOWSsystem32driversetc目录下修改HOSTS文件,添加目标服务器的对应IP地址和主机名:
**.**.**.** localnode1

6、备份服务器端:
配置备份服务器LEGATO软件,建立CLIENT:
选择Manger Client -> Create Client:
在General页面输入以下信息:
Name:localnode1(根据HOSTS文件中填写主机名实际情况选择)

6、备份服务器端:
查找原服务器端的DBID信息:
sqlplus ***backup/***backup
SQL>select * from db;
DB_KEY DB_ID HIGH_CONF_RECID LAST_KCCDIVTS HIGH_IC_RECID
------ ----- --------------- ------------- --------------------
1 39992 245356 1

7、目标服务器端:
恢复SPFILE文件:
使用DBCA建立一个新实例,并启动到nomount状态。
恢复SPFILE文件:
rman
set DBID=39992;
connect target / ;
connect catalog mailto:***backup/***backup@rman]***backup/***backup@rman;
run{
allocate channel t1 type 'sbt_tape'
parms 'ENV=(NSR_DATA_VOLUME_POOL=***Clone,NSR_SERVER=backupserver,NSR_CLIENT=localnode)';
restore spfile to '/oracle/app/oradata/***/spfile.ora';
release channel t1;
}

8、目标服务器端:
生成PFILE文件:
create pfile='/oracle/app/oradata/***/pfile.ora' from spfile='/oracle/app/oradata/***/spfile.ora';
根据需求修改pfile.ora文件;
生成新的SPFILE文件:
startup nomount pfile='/oracle/app/oradata/***/pfile.ora';
create spfile from pfile='/oracle/app/oradata/***/pfile.ora';

9、目标服务器端:
恢复控制文件(在NOMOUNT状态下)
rman
set DBID=39992(原库的DBID);
connect target backup/backup;(或者connect target /)
connect catalog mailto:***backup/***backup@rman]***backup/***backup@rman;
run{
allocate channel t1 type 'sbt_tape'
parms 'ENV=(NSR_DATA_VOLUME_POOL=***Clone,NSR_SERVER=backupserver,NSR_CLIENT=localnode)';
restore controlfile to '/oracle/app/oradata/***/control01.ctl' from TAG='TAG20080723T214634'(TAG可以通过list backup of controlfile在原库查询);
release channel t1;
}
拷贝生成3个控制文件:control01.ctl、control02.ctl、control03.ctl
重新建立密码文件:orapwd file='/oracle/app/9.2.0/dbs/orapw' password=*** entries=5

10、目标服务器端:
还原数据文件(在MOUNT状态下)
rman
set DBID=39992(原库的DBID);
connect target backup/backup;(或者connect target /)
connect catalog mailto:***backup/***backup@rman]***backup/***backup@rman;
run{
allocate channel t1 type 'sbt_tape'
parms 'ENV=(NSR_DATA_VOLUME_POOL=***Clone,NSR_SERVER=backupserver,NSR_CLIENT=localnode)';
set newname for datafile '/ora9i/app/oracle/oradata/***/system01.dbf' to '/oracle/app/oradata/***/system01.dbf';
set newname for datafile '/ora9i/app/oracle/oradata/***/undotbs01.dbf' to '/oracle/app/oradata/***/undotbs01.dbf';
set newname for datafile '/ora9i/app/oracle/oradata/***/indx01.dbf' to '/oracle/app/oradata/***/indx01.dbf';
set newname for datafile '/ora9i/app/oracle/oradata/***/tools01.dbf' to '/oracle/app/oradata/***/tools01.dbf';
......
set newname for datafile '/ora9i/app/oracle/oradata/***/xdb01.dbf' to '/oracle/app/oradata/***/xdb01.dbf';
restore database from TAG='TAG20080723T214634';
switch datafile all;
release channel t1;
}

11、目标服务器端:
还原归档日志文件(在MOUNT状态下)
rman
set DBID=39992(原库的DBID);
connect target backup/backup;(或者connect target /)
connect catalog mailto:***backup/***backup@rman]***backup/***backup@rman;
run{
allocate channel t1 type 'sbt_tape'
parms 'ENV=(NSR_DATA_VOLUME_POOL=***Clone,NSR_SERVER=backupserver,NSR_CLIENT=localnode)';
set archivelog destination to '/oracle/app/oradata/arch';
restore archivelog from logseq 1430 until logseq 1480;(根据实际情况选择需要恢复的归档日志文件)
#scn 9377262089559 until scn 9377270444909;
#from logseq 1460 until 1465;
# until 1422;
release channel t1;
}

12、目标服务器端:
重命名REDO文件:
alter database rename file '/ora9i/app/oracle/oradata/***/REDO01.LOG' to '/oracle/app/oradata/***/REDO01.LOG';
alter database rename file '/ora9i/app/oracle/oradata/***/REDO02.LOG' to '/oracle/app/oradata/***/REDO02.LOG';
alter database rename file '/ora9i/app/oracle/oradata/***/REDO03.LOG' to '/oracle/app/oradata/***/REDO03.LOG';

13、目标服务器端:
恢复数据库:
sqlplus "/as sysdba"
recover database using backup controlfile;
指定日志: {=suggested | filename | AUTO | CANCEL}
auto
尝试打开数据库:
alter database open resetlogs;
alter database open resetlogs
*
ERROR 位于第 1 行:
ORA-01113: 文件 1 需要介质恢复
ORA-01110: 数据文件 1: '/oracle/app/oradata/***/SYSTEM01.DBF'

14、目标服务器端:
重建控制文件:
alter database backup controlfile to trace;
在user_dump_dest目录中找到trace文件,并用于重建控制文件:
STARTUP NOMOUNT
CREATE CONTROLFILE REUSE DATABASE "***" RESETLOGS ARCHIVELOG
-- SET STANDBY TO MAXIMIZE PERFORMANCE
MAXLOGFILES 50
MAXLOGMEMBERS 5
MAXDATAFILES 100
MAXINSTANCES 1
MAXLOGHISTORY 226
LOGFILE
GROUP 1 '/oracle/app/oradata/***/REDO01.LOG' SIZE 100M,
......
-- STANDBY LOGFILE
DATAFILE
'/oracle/app/oradata/***/tools01.dbf',
...
'/oracle/app/oradata/***/system01.dbf'
CHARACTER SET ZHS16GBK
;

15、目标服务器端:
恢复打开数据库:
alter database open resetlogs;

16、目标服务器端:
根据实际情况重建临时表空间:
CREATE TEMPORARY TABLESPACE ***_TEMP TEMPFILE '/oracle/app/oradata/***/***_TEMP01.dbf' size 4096M;

本文标签:
网站声明:本文由风哥整理发布,转载请保留此段声明,本站所有内容将不对其使用后果做任何承诺,请读者谨慎使用!
【上一篇】
【下一篇】