利用泠备份恢复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>
原博客地址:
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,将泠备中的控制文件覆盖当前的控制文件
查看原来的控制文件目录
[oracle@localhost 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>
开始复制覆盖
[oracle@localhost oracle_cold]$ cpcontrol02.ctl /oracle/app/oracle/flash_recovery_area/orcl/control02.ctl
[oracle@localhost oracle_cold]$ cpcontrol01.ctl /home/oradata/orcl/control01.ctl
[oracle@localhost oracle_cold]$
2.3,将泠备中的redo、undo文件覆盖到以前的目录中
查看以前的redo、undo文件路径
[oracle@localhost 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文件
[oracle@localhost oracle_cold]$ cp orcl_2/*.log/home/oradata/orcl/
[oracle@localhost oracle_cold]$
2.4,将泠备中的数据文件覆盖到以前的目录中
查看以前的数据文件目录
[oracle@localhost 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
[oracle@localhost oracle_cold]$
开始覆盖以前的数据文件目录
[oracle@localhost oracle_cold]$ cp orcl_2/*.dbf/home/oradata/orcl/
[oracle@localhost 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>