[20180202]备库数据文件offline.txt

简介: [20180202]备库数据文件offline.txt --//今天测试,不小心导致日志无法应用.我想把主库文件拷贝过去,做了备库数据文件offline. --//恢复遇到问题,做一个记录.

[20180202]备库数据文件offline.txt

--//今天测试,不小心导致日志无法应用.我想把主库文件拷贝过去,做了备库数据文件offline.
--//恢复遇到问题,做一个记录.

1.环境:
SYS@book> @ &r/ver1
PORT_STRING                    VERSION        BANNER
------------------------------ -------------- --------------------------------------------------------------------------------
x86_64/Linux 2.4.xx            11.2.0.4.0     Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production

2.测试:
--//备库:
SYS@bookdg> alter database datafile 6 offline;
alter database datafile 6 offline
*
ERROR at line 1:
ORA-01156: recovery or flashback in progress may need access to files

---//日志应用时无法offline.

SYS@bookdg> alter database recover managed standby database cancel ;
Database altered.

SYS@bookdg> alter database datafile 6 offline;
alter database datafile 6 offline
*
ERROR at line 1:
ORA-01668: standby database requires DROP option for offline of data file

SYS@bookdg> alter database datafile 6 offline drop ;
Database altered.

--//噩梦开始.....

SYS@bookdg> alter database datafile 6 online ;
alter database datafile 6 online
*
ERROR at line 1:
ORA-01113: file 6 needs media recovery
ORA-01110: data file 6: '/mnt/ramdisk/book/tea01.dbf'

SYS@bookdg> recover automatic standby datafile 6;
ORA-19966: ALTER DATABASE RECOVER STANDBY DATAFILE has been deprecated

--//命令已经废除..

--//启动到mount状态.

RMAN> recover datafile 4 ;

Starting recover at 2018-02-02 11:07:03
using channel ORA_DISK_1
using channel ORA_DISK_2
using channel ORA_DISK_3

RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of recover command at 02/02/2018 11:07:03
RMAN-06067: RECOVER DATABASE required with a backup or created control file

SYS@bookdg> recover databfile 4 using backup controlfile until cancel;
ORA-00905: missing keyword


SYS@bookdg> recover database using backup controlfile until cancel;
ORA-00283: recovery session canceled due to errors
ORA-01666: control file is for a standby database

--//不行..

3.必须建立新的standby控制文件:


SYS@book> alter database create standby controlfile as '/tmp/aa.ctl4';
Database altered.

$ scp /tmp/aa.ctl4 oracle@192.168.100.40:/mnt/ramdisk/book/control01.ctl
$ scp /tmp/aa.ctl4 oracle@192.168.100.40:/mnt/ramdisk/book/control02.ctl


SYS@bookdg> startup
ORACLE instance started.
Total System Global Area  634732544 bytes
Fixed Size                  2255792 bytes
Variable Size             197133392 bytes
Database Buffers          427819008 bytes
Redo Buffers                7524352 bytes
Database mounted.
Database opened.

SYS@bookdg> alter database recover managed standby database using current logfile disconnect ;
Database altered.

SYS@bookdg> @ &r/dg/dg
PROCESS       PID STATUS       CLIENT_P GROUP# THREAD#  SEQUENCE#     BLOCK#     BLOCKS DELAY_MINS
--------- ------- ------------ -------- ------ ------- ---------- ---------- ---------- ----------
ARCH        15430 CONNECTED    ARCH     N/A          0          0          0          0          0
ARCH        15432 CONNECTED    ARCH     N/A          0          0          0          0          0
ARCH        15434 CONNECTED    ARCH     N/A          0          0          0          0          0
RFS         15443 IDLE         ARCH     N/A          0          0          0          0          0
RFS         15447 IDLE         UNKNOWN  N/A          0          0          0          0          0
RFS         15445 IDLE         UNKNOWN  N/A          0          0          0          0          0
RFS         15449 IDLE         LGWR     2            1        903         19          1          0
ARCH        15436 CLOSING      ARCH     6            1        902          1        393          0
MRP0        15453 APPLYING_LOG N/A      N/A          1        903         19     102400          0
9 rows selected.

--//实际上操作前看看出错提示就知道了:
$ oerr ora 01668
01668, 00000, "standby database requires DROP option for offline of data file"
// *Cause:  Attempting to take a datafile offline in a standby database without
//          specifying the DROP option. Files that are offline in a standby
//          database are not recovered, and are likely to be unusable if
//          the standby is activated. Note that specifying DROP does not
//          prevent bringing the file online later.
// *Action: Specify the DROP option or leave the file online.

目录
相关文章
|
Oracle 关系型数据库 数据库管理
[20161101]rman备份与数据文件变化7.txt
[20161101]rman备份与数据文件变化7.txt --//想象一下,如果备份文件时间很长,而这个时候数据文件大小发生了变化,oracle的备份如何解决这个问题呢? --//去年已经测试了建立备份集的情况,一直想做一次image copy的测试,一直脱,主要原因自己不想做这个测试.
1181 0
|
Oracle 关系型数据库 OLAP
[20171123]rman备份与数据文件变化6.txt
[20171123]rman备份与数据文件变化6.txt --//想象一下,如果备份文件时间很长,而这个时候数据文件大小发生了变化,oracle的备份如何解决这个问题呢? --//去年已经测试了建立备份集的情况,一直想做一次image copy的测试,一直脱,主要原因自己不想做这个测试.
785 0
|
Oracle 关系型数据库 Linux
[20170803]如何查看dg的redo应用率.txt
[20170803]如何查看dg的redo应用率.txt --//昨天别人问的问题,实际上如果安装配置DGMGRL,在11.2.0.4下变得很简单.直接执行: 1.环境: SYS@xxxxdg2> @ &r/ver1 PORT_STRING       ...
828 0
|
Oracle 关系型数据库 数据库管理
[20161102]rman备份与数据文件变化5.txt
[20161102]rman备份与数据文件变化5.txt --想象一下,如果备份文件时间很长,而这个时候数据文件大小发生了变化,oracle的备份如何解决这个问题呢? --前面我已经做了增大数据文件,参考链接:http://blog.itpub.net/267265/viewspace-2127386/ --这次测试减少数据文件大小看看。
719 0
|
Oracle 关系型数据库 数据库
[20161101]rman备份与数据文件变化4.txt
[20161101]rman备份与数据文件变化4.txt --想象一下,如果备份文件时间很长,而这个时候数据文件大小发生了变化,oracle的备份如何解决这个问题呢? --前面我已经做了增大数据文件,参考链接:http://blog.itpub.net/267265/viewspace-2127386/ --这次测试减少数据文件大小看看。
951 0
|
Oracle 关系型数据库 数据库管理
[20161031]rman备份与数据文件变化3.txt
[20161031]rman备份与数据文件变化3.txt --想象一下,如果备份文件时间很长,而这个时候数据文件大小发生了变化,oracle的备份如何解决这个问题呢? --前面我已经做了增大数据文件,参考链接:http://blog.itpub.net/267265/viewspace-2127386/ --这次测试减少数据文件大小看看。
748 0
|
Oracle 关系型数据库 数据库管理
[20161031]rman备份与数据文件变化2.txt
[20161031]rman备份与数据文件变化2.txt --想象一下,如果备份文件时间很长,而这个时候数据文件大小发生了变化,oracle的备份如何解决这个问题呢? 1.
920 0
|
数据库
[20161019]数据文件offline后恢复到那个scn
[20161019]数据文件offline后恢复到那个scn号.txt --前一天别人问的问题,如果数据文件offline时,online要恢复,一般恢复到scn是多少,是offline时的scn吗? --总不见得如果长时间offline,要应用许多归档日志吧,通过测试说明问题: 1.
818 0
|
Oracle 关系型数据库 数据库
[20161012]数据文件offline马上执行recover
[20161012]数据文件offline马上执行recover.txt --前几天看的1篇文章,提到数据文件offline,应该养成随手执行recover习惯.保证下一次online时,不需要恢复。
823 0