模拟主库创建数据文件,dg备库空间不足时问题处理
本篇文档测试目的:
模拟实际环境中,主库对表空间添加数据文件,备库空间不足,最终导致MRP进程自动断开,处理方式。
1.问题环境模拟
1)正常情况下的dg
主库创建数据文件,备库接受日志,自动创建表空间及数据文件。
RFS[49]: Selected log 4 for thread 1 sequence 115 dbid 699220720 branch 994543603
Fri Feb 22 23:20:36 2019
Media Recovery Log /u01/app/oracle/oradata/arch/1_112_994543603.arc
Recovery created file /u01/app/oracle/oradata/adg1/test001.dbf
Successfully added datafile 10 to media recovery
Datafile #10: '/u01/app/oracle/oradata/adg1/test001.dbf'
Media Recovery Log /u01/app/oracle/oradata/arch/1_113_994543603.arc
Media Recovery Log /u01/app/oracle/oradata/arch/1_114_994543603.arc
Media Recovery Waiting for thread 1 sequence 115 (in transit)
Fri Feb 22 23:20:52 2019
RFS[49]: Selected log 5 for thread 1 sequence 116 dbid 699220720 branch 994543603
Fri Feb 22 23:20:52 2019
Archived Log entry 51 added for thread 1 sequence 115 ID 0x29aceaf0 dest 1:
Fri Feb 22 23:20:52 2019
Media Recovery Log /u01/app/oracle/oradata/arch/1_115_994543603.arc
Media Recovery Waiting for thread 1 sequence 116 (in transit) 2)异常情况 备库文件系统
[oracle@11gtest arch]$ df -h
文件系统 容量 已用 可用 已用% 挂载点
/dev/mapper/VolGroup00-Lvroot
34G 22G 11G 69% / 空间剩余11G
主库创建测试表空间,数据文件大小12G(测试环境ssd)
SQL> create tablespace test_tbs datafile '/home/oracle/test_tbs01.dbf' size 12g;
Tablespace created.
Elapsed: 00:01:50.86
SQL> alter system switch logfile
;
备库Alert日志
Fri Feb 22 23:28:52 2019
RFS[49]: Selected log 4 for thread 1 sequence 117 dbid 699220720 branch 994543603
Fri Feb 22 23:28:52 2019
Archived Log entry 52 added for thread 1 sequence 116 ID 0x29aceaf0 dest 1:
Fri Feb 22 23:28:52 2019
Media Recovery Log /u01/app/oracle/oradata/arch/1_116_994543603.arc
-------------------------对于DG备库而言,最开始是接受日志,MRP进程应用日志,随后空间确实不足后,停止创建数据文件
SQL>
select process,client_process,sequence#,status,BLOCK#,BLOCKS from v$managed_standby
PROCESS CLIENT_P SEQUENCE# STATUS BLOCK# BLOCKS
--------- -------- ---------- ------------ ---------- ----------
MRP0 N/A 116 APPLYING_LOG 3314 4568
[root@11gtest etc]# df -h
文件系统 容量 已用 可用 已用% 挂载点
/dev/mapper/VolGroup00-Lvroot
34G 33G 7.2M 100% /
[root@11gtest etc]# df -h 从11g可用空间,将为0,最后又还原为可用空间11g,都是自动进行。
文件系统 容量 已用 可用 已用% 挂载点
/dev/mapper/VolGroup00-Lvroot
34G 22G 11G 69% /
---Alert报错
Fri Feb 22 23:28:52 2019
RFS[49]: Selected log 4 for thread 1 sequence 117 dbid 699220720 branch 994543603
Fri Feb 22 23:28:52 2019
Archived Log entry 52 added for thread 1 sequence 116 ID 0x29aceaf0 dest 1:
Fri Feb 22 23:28:52 2019
Media Recovery Log /u01/app/oracle/oradata/arch/1_116_994543603.arc
Fri Feb 22 23:29:51 2019
Errors in file /u01/app/oracle/diag/rdbms/adg1/adg1/trace/adg1_pr00_7496.trc:
ORA-19502: write error on file "/u01/app/oracle/oradata/adg1/test_tbs01.dbf", block number 1337472 (block size=8192)
ORA-27072: File I/O error
Additional information: 4
Additional information: 1337472
Additional information: 577536
File #11 added to control file as 'UNNAMED00011'.
Originally created as:
'/home/oracle/test_tbs01.dbf'
Recovery was unable to create the file as:
'/u01/app/oracle/oradata/adg1/test_tbs01.dbf'
Errors with log /u01/app/oracle/oradata/arch/1_116_994543603.arc
MRP0: Background Media Recovery terminated with error 1274
Errors in file /u01/app/oracle/diag/rdbms/adg1/adg1/trace/adg1_pr00_7496.trc:
ORA-01274: cannot add datafile '/home/oracle/test_tbs01.dbf' - fFri Feb 22 23:29:54 2019
MRP0: Background Media Recovery process shutdown (adg1)
MRP进程自动shutdown:
尝试启动Mrp进程
recover managed standby database disconnect from session;
Fri Feb 22 23:32:52 2019
ALTER DATABASE RECOVER managed standby database disconnect from session
Attempt to start background Managed Standby Recovery process (adg1)
Fri Feb 22 23:32:52 2019
MRP0 started with pid=20, OS id=8449
MRP0: Background Managed Standby Recovery process started (adg1)
started logmerger process
Fri Feb 22 23:32:57 2019
Managed Standby Recovery not using Real Time Apply
Fri Feb 22 23:32:57 2019
Errors in file /u01/app/oracle/diag/rdbms/adg1/adg1/trace/adg1_dbw0_7052.trc:
ORA-01186: file 11 failed verification tests
ORA-01157: cannot identify/lock data file 11 - see DBWR trace file
ORA-01111: name for data file 11 is unknown - rename to correct file
ORA-01110: data file 11: '/u01/app/oracle/product/11.2.0/dbhome_1/dbs/UNNAMED00011'
File 11 not verified due to error ORA-01157
MRP0: Background Media Recovery terminated with error 1111
Errors in file /u01/app/oracle/diag/rdbms/adg1/adg1/trace/adg1_pr00_8453.trc:
ORA-01111: name for data file 11 is unknown - rename to correct file
ORA-01110: data file 11: '/u01/app/oracle/product/11.2.0/dbhome_1/dbs/UNNAMED00011'
ORA-01157: cannot identify/lock data file 11 - see DBWR trace file
ORA-01111: name for data file 11 is unknown - rename to correct file
ORA-01110: data file 11: '/u01/app/oracle/product/11.2.0/dbhome_1/dbs/UNNAMED00011'
Completed: ALTER DATABASE RECOVER managed standby database disconnect from session
Recovery Slave PR00 previously exited with exception 1111
MRP0: Background Media Recovery process shutdown (adg1)
2.问题处理
问题处理方法论,1.立即对空间扩容;
2.找到存在空间空间的路径(磁盘组)先存放一阵子;
3.nfs等文件系统临时挂载存放 本次模拟,使用第二种,找到存在的空闲空间
[root@11gtest software]# rm p13390677_112040_Linux-x86-64_*
rm:是否删除 一般文件 “p13390677_112040_Linux-x86-64_1of7.zip”? y
rm:是否删除 一般文件 “p13390677_112040_Linux-x86-64_2of7.zip”? y
[root@11gtest software]# df -h
文件系统 容量 已用 可用 已用% 挂载点
/dev/mapper/VolGroup00-Lvroot
34G 20G 13G % /
SQL> select file#,name,status,bytes/1024/1024/1024 g from v$datafile;
FILE# NAME STATUS G
---------- ----------------------------------------------------------------- ------- ----------
1 /u01/app/oracle/oradata/adg1/system01.dbf SYSTEM 2.02148438
2 /u01/app/oracle/oradata/adg1/sysaux01.dbf ONLINE .60546875
3 /u01/app/oracle/oradata/adg1/undotbs01.dbf ONLINE .25390625
4 /u01/app/oracle/oradata/adg1/users01.dbf ONLINE .337646484
5 /u01/app/oracle/oradata/adg1/test01.dbf ONLINE .004150391
6 /u01/app/oracle/oradata/adg1/user02.dbf ONLINE .009765625
7 /u01/app/oracle/oradata/adg1/ogg.dbf ONLINE .009765625
8 /u01/app/oracle/oradata/adg1/test1.dbf ONLINE .059570313
9 /u01/app/oracle/oradata/adg1/test2.dbf ONLINE .010742188
10 /u01/app/oracle/oradata/adg1/test001.dbf ONLINE .000976563
11 /u01/app/oracle/product/11.2.0/dbhome_1/dbs/UNNAMED00011 RECOVER 0
11 rows selected.
新的数据文件在dba_data_files都不存在。
SQL> select file_name,file_id,tablespace_name,bytes/1024/1024/1024 g,status from dba_data_files;
FILE_NAME FILE_ID TABLESPACE_NAME G STATUS
--------------------------------------------- ---------- ------------------------------ ---------- ---------
/u01/app/oracle/oradata/adg1/users01.dbf 4 USERS .337646484 AVAILABLE
/u01/app/oracle/oradata/adg1/undotbs01.dbf 3 UNDOTBS1 .25390625 AVAILABLE
/u01/app/oracle/oradata/adg1/sysaux01.dbf 2 SYSAUX .60546875 AVAILABLE
/u01/app/oracle/oradata/adg1/system01.dbf 1 SYSTEM 2.02148438 AVAILABLE
/u01/app/oracle/oradata/adg1/test01.dbf 5 AUDITING .004150391 AVAILABLE
/u01/app/oracle/oradata/adg1/user02.dbf 6 USERS .009765625 AVAILABLE
/u01/app/oracle/oradata/adg1/ogg.dbf 7 OGG .009765625 AVAILABLE
/u01/app/oracle/oradata/adg1/test1.dbf 8 IMAGE_APP_TBS .059570313 AVAILABLE
/u01/app/oracle/oradata/adg1/test2.dbf 9 IMAGE_APP_IDX_TBS .010742188 AVAILABLE
/u01/app/oracle/oradata/adg1/test001.dbf 10 TEST001 .000976563 AVAILABLE
10 rows selected.
SQL> alter database create datafile '/u01/app/oracle/product/11.2.0/dbhome_1/dbs/UNNAMED00011' as '/home/oracle/test_temp00028';
alter database create datafile '/u01/app/oracle/product/11.2.0/dbhome_1/dbs/UNNAMED00011' as '/home/oracle/test_temp00028'
*
ERROR at line 1:
ORA-01275: Operation CREATE DATAFILE is not allowed if standby file management is automatic.
SQL> alter system set standby_file_management=MANUAL;
SQL> alter database create datafile '/u01/app/oracle/product/11.2.0/dbhome_1/dbs/UNNAMED00011' as '/home/oracle/test_temp00028';
Database altered.
Fri Feb 22 23:50:35 2019
ALTER SYSTEM SET standby_file_management='MANUAL' SCOPE=BOTH;
Fri Feb 22 23:50:46 2019
alter database create datafile '/u01/app/oracle/product/11.2.0/dbhome_1/dbs/UNNAMED00011' as '/home/oracle/test_temp00028'
Fri Feb 22 23:51:23 2019
Completed: alter database create datafile '/u01/app/oracle/product/11.2.0/dbhome_1/dbs/UNNAMED00011' as '/home/oracle/test_temp00028'
备库开启MRP进程
SQL> recover managed standby database disconnect from session;
3.后续处理
移动文件后,原有空间足够需要转移,DG数据文件迁移
正确流程操作:
数据库启动到Mount阶段
rman进行backup as copy方式拷贝数据文件
swich 修改控制文件数据文件目录
open数据库
开启Mrp进程,恢复dg应用
rman删除copy备份信息
SQL> startup force mount;
RMAN> backup as copy datafile 11 format '/u01/app/oracle/oradata/adg1/test_tbs01.dbf';
RMAN> switch datafile 11 to copy;
SQL> alter database open;
recover managed standby database disconnect from session;
RMAN> list copy of database; RMAN> delete copy of datafile 11;
***************************************
SQL> startup force mount; RMAN> backup as copy datafile 11 format '/u01/app/oracle/oradata/adg1/test_tbs01.dbf'; Starting backup at 22-FEB-19
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=20 device type=DISK
channel ORA_DISK_1: starting datafile copy
input datafile file number=00010 name=/u01/app/oracle/oradata/adg1/test001.dbf
output file name=/u01/app/oracle/oradata/adg1/test_tbs01.dbf tag=TAG20190222T235621 RECID=11 STAMP=1000943781
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:01
Finished backup at 22-FEB-19 RMAN-00571: ===========================================================
RMAN-03009: failure of backup command on ORA_DISK_1 channel at 02/23/2019 00:08:45
ORA-19502: write error on file "/u01/app/oracle/oradata/adg1/test_tbs01.dbf", block number 81536 (block size=8192)
ORA-27072: File I/O error
Additional information: 4
Additional information: 81536
Additional information: 53248
ORA-19502: write error on file "/u01/app/oracle/oradata/adg1/test_tbs01.dbf", block number 81536 (block size=8192) 空间不足,由于是测试环境,因此对datafile 11进行resize回收空间, SQL> select file_id,bytes/1024/1024/1024 from dba_data_files where file_id=11; FILE_ID BYTES/1024/1024/1024
---------- --------------------
11 12 Elapsed: 00:00:00.00
SQL> alter database datafile 11 resize 5g; Database altered. Elapsed: 00:00:01.40
SQL> select file_id,bytes/1024/1024/1024 from dba_data_files where file_id=11; FILE_ID BYTES/1024/1024/1024
---------- --------------------
11 5 SQL> alter system switch logfile ; 关库,dg环境启动到Mount状态 SQL> recover managed standby database disconnect from session;
Media recovery complete.
SQL> select file_id,bytes/1024/1024/1024 from dba_data_files where file_id=11; FILE_ID BYTES/1024/1024/1024
---------- --------------------
11 5 继续RMAN RMAN> backup as copy datafile 11 format '/u01/app/oracle/oradata/adg1/test_tbs01.dbf'; Starting backup at 23-FEB-19
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=20 device type=DISK
channel ORA_DISK_1: starting datafile copy
input datafile file number=00011 name=/home/oracle/test_temp00028
output file name=/u01/app/oracle/oradata/adg1/test_tbs01.dbf tag=TAG20190223T001911 RECID=12 STAMP=1000945177
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:35
Finished backup at 23-FEB-19 RMAN> switch datafile 11 to copy; RMAN-06572: database is open and datafile 11 is not offline
switch datafile 修改数据文件目录操作,需要数据文件offline,数据库需要启动到mount阶段。 RMAN> switch datafile 11 to copy; using target database control file instead of recovery catalog
datafile 11 switched to datafile copy "/u01/app/oracle/oradata/adg1/test_tbs01.dbf" RMAN> list copy of database; RMAN> delete copy of datafile 11; SQL> alter database open; Database altered. SQL> r
1* select file_id,file_name,tablespace_name,bytes/1024/1024/1024 from dba_data_files FILE_ID FILE_NAME TABLESPACE_NAME BYTES/1024/1024/1024
------- ------------------------------------------------------- ------------------------------ --------------------
4 /u01/app/oracle/oradata/adg1/users01.dbf USERS .337646484
3 /u01/app/oracle/oradata/adg1/undotbs01.dbf UNDOTBS1 .25390625
2 /u01/app/oracle/oradata/adg1/sysaux01.dbf SYSAUX .60546875
1 /u01/app/oracle/oradata/adg1/system01.dbf SYSTEM 2.02148438
5 /u01/app/oracle/oradata/adg1/test01.dbf AUDITING .004150391
6 /u01/app/oracle/oradata/adg1/user02.dbf USERS .009765625
7 /u01/app/oracle/oradata/adg1/ogg.dbf OGG .009765625
8 /u01/app/oracle/oradata/adg1/test1.dbf IMAGE_APP_TBS .059570313
9 /u01/app/oracle/oradata/adg1/test2.dbf IMAGE_APP_IDX_TBS .010742188
10 /u01/app/oracle/oradata/adg1/test001.dbf TEST001
11 /u01/app/oracle/oradata/adg1/test_tbs01.dbf TEST_TBS 5 11 rows selected. alter tablespace TEST_TBS rename datafile '/home/oracle/test_temp00028' to '/u01/app/oracle/oradata/adg1/test001.dbf'
*
ERROR at line 1:
ORA-16000: database open for read-only access SQL> alter database create datafile '/home/oracle/test_temp00028' as '/u01/app/oracle/oradata/adg1/test001.dbf';
alter database create datafile '/home/oracle/test_temp00028' as '/u01/app/oracle/oradata/adg1/test001.dbf'
*
ERROR at line 1:
ORA-01524: cannot create data file as
'/u01/app/oracle/oradata/adg1/test001.dbf' - file already part of database
模拟主库创建数据文件,dg备库空间不足时问题处理的更多相关文章
- 使用DUPLICATE 方式创建ORACLE 11G DG备库环境
我的最佳实践 ① 手动创建好初始化参数文件: *.audit_file_dest='E:\APP\XJXU\ADMIN\ORASTAND\ADUMP'*.control_files='E:\APP\X ...
- DG备库无法接受主库归档日志之密码文件
DG备库无法接受主库归档日志之密码文件 实验目的:还原某个客户案例,客户审计需要,对主库sys用户进行锁定,一小时后对sys用户进行解锁后,发现备库无法接受主库的归档日志 本篇文章,测试sys用户与D ...
- Oracle-DG最大保护模式下,dg备库出现问题对主库有什么影响?
一.需求 疑问?Oracle最大保护模式下,dg备库出现问题,影响主库吗? 我们都知道Oracle最大保护模式的意思是oracle不允许数据丢失,1条记录都不行! 那么备库有问题? oracle主库还 ...
- DG备库,实时应用如何判断,MR进程,及MRP应用归档,三种情况的查询及验证
本篇文档学习,DG备库,实时应用如何判断,MR进程,及MRP应用归档,三种情况的查询及验证 1.取消MRP进程 备库查询进程状态select process,client_process,sequen ...
- 使用using current logfile实现DG备库实时更新
DG1是主库,DG2是备库:运行在最大可用模式. 实验一:未使用using current logfile参数时,备库在最大可用模式下,不能实时同步备库的更新 -此时需要等待主库进行归档---侧面证明 ...
- oracle 碎片管理和数据文件resize释放表空间和磁盘空间(以及sys.wri$_optstat_histgrm_history过大处理)
随着互联网的快速发展,各行各业的数据量也是与日俱增,而数据库的数据量也是直线增长,但是,如果表DML太多,则可能会在高水位线以下出现太多空白. 因此,只能将数据文件缩小到高水位线,因为高水位线以下有一 ...
- oracle dg 备库不同步主库数据
今天遇到一个数据库同步问题,主库被关闭,重启主库后,备库不能正常同步主库数据.只有当手动切换归档日志的时候,备库才能和主库一致. 这个问题的解决方法: 重启备库,重新应用归档日志. 操作步骤如下: / ...
- DG备库磁盘空间满导致无法创建归档
上周五去某客户那里做数据库巡检.是window 2008系统上10g的一套NC系统的库,已经配置了DG,可是巡检时发现数据库报错: Tue Nov 11 10:13:57 2014 LNS: Stan ...
- DG备库缺失归档文件GAP日志
问题现象: XXXsdgebus-dg GAP手工注册归档 #出现GAP idle>select * from v$archive_gap; THREAD# LOW_SEQUENCE# HIGH ...
随机推荐
- python爬虫---requests库的用法
requests是python实现的简单易用的HTTP库,使用起来比urllib简洁很多 因为是第三方库,所以使用前需要cmd安装 pip install requests 安装完成后import一下 ...
- [luogu P3382] 三分法
[luogu P3382] 三分法 题目描述 如题,给出一个N次函数,保证在范围[l,r]内存在一点x,使得[l,x]上单调增,[x,r]上单调减.试求出x的值. 输入输出格式 输入格式: 第一行一次 ...
- python 解析与生成xml
xml.etree.ElementTree模块为xml文件的提取和建立提供了简单有效的API.下文中使用ET来代表xml.etree.ElementTree模块. XML是一种内在的分层的数据形式,展 ...
- SQL SERVER版本补丁体系及升级
首先了解几个定义: RTM : 表示 Release to Manufacturing ,这是产品的原始发布版本,当从光盘或 MSDN 下载的默认版本.不过现在下载 SQL Server 版本时,也有 ...
- JSON 对象 与 字符串 互转
$sui = [ 'xixixi' => 'suisuisui', 'hahaha' => 'longlonglong', ]; $data = json_encode($sui); pr ...
- localStorage 设置本地缓存
var timestamp = parseInt(Date.parse(new Date()));var btn = document.getElementById("close" ...
- 巧用call,appl有 根据对象某一属性求最大值
查找对象数组中某属性的最大最小值的快捷方法 例如要查找array数组中对象的value属性的最大值 var array=[ { "index_id": 119, "are ...
- Java版本知识
1zip是压缩包,而MSI文件是Windows Installer的数据包,它实际上是一个数据库,包含安装一种产品所需要的信息和在很多安装情形下安装(和卸载)程序所需的指令和数据,只要系统中包含win ...
- LTP(LinuxTest Project)测试工具
LTP(LinuxTest Project)是SGI.IBM.OSDL和Bull合作的项目,目的是为开源社区提供一个测试套件,用来验证Linux系统可靠性.健壮性和稳定性.LTP测试套件是测试Linu ...
- java 数据溢出和编译错误的差别
int a=100000000000;编译错误,超出int范围 int a=2100000000; int b=a*12020200;数据溢出,a并未溢出,但b在通过a计算后的数据溢出 long e= ...