ORACLE 11G 利用泠备份恢复standby库

Posted gavanwanggw

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了ORACLE 11G 利用泠备份恢复standby库相关的知识,希望对你有一定的参考价值。

利用泠备份恢复standby数据库

 

1 開始在备库上进行泠备份

先查好控制文件、redo、undo文件、数据文件的路径

 

1.1 先关闭主库的归档日志传输

SQL> ALTER system SETlog_archive_dest_state_2 =‘DEFER‘;                                                                                                                                     

                                                                                                                                                                                              

System altered.

 

SQL> 

 

 

1.2 先关闭standby

SQL> shutdown immediate;                                                                                                                                                                      

Database closed.                                                                                                                                                                              

Database dismounted.                                                                                                                                                                          

ORACLE instance shut down.                                                                                                                                                                    

SQL>                                                                                                                                                                                          

SQL>    

 


<版权全部,文章同意转载,但必须以链接方式注明源地址,否则追究法律责任!> 
原博客地址:   http://blog.csdn.net/mchdba/article/details/46622839
原作者:黄杉 (mchdba)



1.3 開始进行泠备份

#建立一个泠备份文件夹

mkdir /data/oracle_cold/

開始泠备份控制文件

cp /data/oracle_cold/

cp /home/oradata/orcl/control01.ctlcontrol01.ctl

cp /oracle/app/oracle/flash_recovery_area/orcl/control02.ctlcontrol02.ctl

開始泠备份redo、undo文件

mkdir orcl_2

cp -r /home/oradata/orcl/*.log orcl_2

開始泠备份数据文件

cp -r /home/oradata/orcl/*.dbf orcl_2

 

 

 

2開始使用泠备份进行db恢复

2.1,停止掉standby

SQL> shutdown immediate;                                                                                                                                                                      

Database closed.                                                                                                                                                                              

Database dismounted.                                                                                                                                                                          

ORACLE instance shut down.                                                                                                                                                                    

SQL>                                                                                                                                                                                          

SQL>    

 

 

2.2。将泠备中的控制文件覆盖当前的控制文件

查看原来的控制文件文件夹

[[email protected] oracle_cold]$ morecontrolfile.log

SQL> SELECT name FROMv$controlfile;                                                                                                                                                          

 

NAME

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

/home/oradata/orcl/control01.ctl

/oracle/app/oracle/flash_recovery_area/orcl/control02.ctl

 

SQL> 

開始复制覆盖

[[email protected] oracle_cold]$ cpcontrol02.ctl /oracle/app/oracle/flash_recovery_area/orcl/control02.ctl

[[email protected] oracle_cold]$ cpcontrol01.ctl /home/oradata/orcl/control01.ctl

[[email protected] oracle_cold]$

 

2.3,将泠备中的redoundo文件覆盖到曾经的文件夹中

查看曾经的redo、undo文件路径

[[email protected] oracle_cold]$ morelogfile.log

SQL> select member from v$logfile;                                                                                                                                                            

 

MEMBER

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

/home/oradata/orcl/redo03.log

/home/oradata/orcl/redo02.log

/home/oradata/orcl/redo01.log

/home/oradata/orcl/redo_dg_01.log

/home/oradata/orcl/redo_dg_02.log

/home/oradata/orcl/redo_dg_03.log

 

6 rows selected.

 

SQL> 

 

開始覆盖redo、undo文件

[[email protected] oracle_cold]$ cp orcl_2/*.log/home/oradata/orcl/

[[email protected] oracle_cold]$

 

2.4,将泠备中的数据文件覆盖到曾经的文件夹中

查看曾经的数据文件文件夹

[[email protected] oracle_cold]$ moredatafile.log

SELECT name FROM v$datafile;

1       /home/oradata/orcl/system01.dbf

2       /home/oradata/orcl/sysaux01.dbf

3       /home/oradata/orcl/undotbs01.dbf

4       /home/oradata/orcl/users01.dbf

5       /home/oradata/orcl/orclk01.dbf

6       /home/oradata/orcl/plas01.dbf

7       /home/oradata/orcl/pl01.dbf

8       /home/oradata/orcl/help01.dbf

9       /home/oradata/orcl/adobelc01.dbf

10     /home/oradata/orcl/sms01.dbf

11     /home/oradata/orcl/plcrm01.dbf

 

[[email protected] oracle_cold]$

 

開始覆盖曾经的数据文件文件夹

[[email protected] oracle_cold]$ cp orcl_2/*.dbf/home/oradata/orcl/

[[email protected] oracle_cold]$

 

2.5 启动数据库

SQL> startup                                                                                                                                                                                  

ORACLE instance started.                                                                                                                                                                      

 

Total System Global Area 5344731136 bytes

Fixed Size              2213136 bytes

Variable Size              3355446000 bytes

Database Buffers    1946157056 bytes

Redo Buffers                40914944 bytes

Database mounted.                                                                                                                                                                              

Database opened.                                                                                                                                                                              

SQL>

 

 

2.6 去主库上开启归档日志传输

SQL> ALTER system SET log_archive_dest_state_2=‘enable‘;                                                                                                                                     

                                                                                                                                                                                              

System altered.

 

SQL> 

 

2.7 然后备库启动应用

select sequence#,applied fromv$archived_log order by sequence# asc;

 

SQL> alter database recovermanagedstandby database disconnect from session;                                                                                                                

                                                                                                                                                                                             

Database altered.

 

SQL>

SQL> select open_modefromv$database;                                                                                                                                                       

OPEN_MODE

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

READ ONLY WITH APPLY

 

SQL>

 








以上是关于ORACLE 11G 利用泠备份恢复standby库的主要内容,如果未能解决你的问题,请参考以下文章

Oracle11g新特性点评之RMAN

Oracle11g备份与恢复

Oracle 11g R2 ADG 监控

Oracle 11g DataGuard搭建 - 单节点到单节点

Oracle 11g R2 备份与恢复

Oracle 11g 使用RMAN备份数据库