Chinaunix首页 | 论坛 | 博客
  • 博客访问: 104547473
  • 博文数量: 19283
  • 博客积分: 9968
  • 博客等级: 上将
  • 技术积分: 196062
  • 用 户 组: 普通用户
  • 注册时间: 2007-02-07 14:28
文章分类

全部博文(19283)

文章存档

2011年(1)

2009年(125)

2008年(19094)

2007年(63)

分类: Oracle

2008-05-28 08:06:00

 来源:赛迪网    作者:Bennett

idle> startup mount pfile='/home/oracle/opt/admin/standby/pfile/init_standby.ora';

7、RESTORE STANDBY数据库:

由于控制文件里面记录的备份信息还是在WINDOWS上主库的备份信息,我们需要使用RMAN的catalog命令来使RMAN认出在STANDBY端从WINDOWS主库COPY过来的备份集:

RMAN> catalog start with '/home/oracle/opt/oradata/standby';

using target database control file instead of recovery catalog

searching for all files that match the pattern /home/oracle/opt/oradata/standby

List of Files Unknown to the Database

=====================================

File Name: /home/oracle/opt/oradata/standby/db_05j3dk6n_1_1.bak

File Name: /home/oracle/opt/oradata/standby/db_04j3dk0q_1_1.bak

Do you really want to catalog the above files (enter YES or NO)? yes

cataloging files...

cataloging done

List of Cataloged Files

=======================

File Name: /home/oracle/opt/oradata/standby/db_05j3dk6n_1_1.bak

File Name: /home/oracle/opt/oradata/standby/db_04j3dk0q_1_1.bak

RMAN> crosscheck backup;

RMAN> delete expired backup;

等到RMAN能够正切认出STANDBY端的备份集后,我们就可以对数据库进行RESTORE了:

RMAN> list backup;

List of Backup Sets

BS Key Type LV Size Device Type Elapsed Time Completion Time

------- ---- -- ---------- ----------- ------------ ---------------

3 Full 1.75G DISK 00:03:03 12-DEC-07

BP Key: 6 Status: AVAILABLE Compressed: NO Tag: TAG20071212T104026

Piece Name: /home/oracle/opt/oradata/standby/db_04j3dk0q_1_1.bak

RMAN> restore database;

Starting restore at 12-DEC-07

using channel ORA_DISK_1

channel ORA_DISK_1: starting datafile backup set restore

channel ORA_DISK_1: specifying datafile(s) to restore from backup set

channel ORA_DISK_1: restoring datafile 00001 to /home/oracle/opt/oradata/standby/SYSTEM01.DBF

channel ORA_DISK_1: restoring datafile 00002 to /home/oracle/opt/oradata/standby/SYSAUX01.DBF

channel ORA_DISK_1: restoring datafile 00003 to /home/oracle/opt/oradata/standby/UNDOTBS01.DBF

channel ORA_DISK_1: restoring datafile 00004 to /home/oracle/opt/oradata/standby/USERS01.DBF

channel ORA_DISK_1: restoring datafile 00005 to /home/oracle/opt/oradata/standby/EXAMPLE01.DBF

channel ORA_DISK_1: reading from backup piece /home/oracle/opt/oradata/standby/db_04j3dk0q_1_1.bak

channel ORA_DISK_1: piece handle=/home/oracle/opt/oradata/standby/db_04j3dk0q_1_1.bak tag=TAG20071212T104026

channel ORA_DISK_1: restored backup piece 1

channel ORA_DISK_1: restore complete, elapsed time: 00:01:05

Finished restore at 12-DEC-07

8、在主库和备用库端分别更改tnsnames配置,添加主库和备用库的TNS连接字,并确保在主库和STANDBY都能够连接上对方:

primary =

(DESCRIPTION =

(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.200.168)(PORT = 1521))

(CONNECT_DATA =

(SERVER = DEDICATED)

(SERVICE_NAME = orcl)

)

)

standby =

(DESCRIPTION =

(ADDRESS = (PROTOCOL = TCP)(HOST =192.168.200.169)(PORT = 1522))

(CONNECT_DATA =

(SERVER = DEDICATED)

(SERVICE_NAME = standby)

)

)

9、添加STANDBY LOGFILE,启动STANDBY至恢复管理模式:

idle> alter database add standby logfile '/home/oracle/opt/oradata/standby/redo04.log' size 50M;

idle> alter database add standby logfile '/home/oracle/opt/oradata/standby/redo05.log' size 50M;

idle> alter database add standby logfile '/home/oracle/opt/oradata/standby/redo06.log' size 50M;

idle> recover managed standby database disconnect from session;

Media recovery complete.

阅读(904) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~