惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

酷 壳 – CoolShell
酷 壳 – CoolShell
H
Hacker News: Front Page
P
Palo Alto Networks Blog
T
ThreatConnect
Apple Machine Learning Research
Apple Machine Learning Research
博客园_首页
T
True Tiger Recordings
P
Privacy & Cybersecurity Law Blog
B
Blog
IT之家
IT之家
Last Week in AI
Last Week in AI
F
Full Disclosure
Hacker News: Ask HN
Hacker News: Ask HN
C
Comments on: Blog
Microsoft Azure Blog
Microsoft Azure Blog
C
Cybersecurity and Infrastructure Security Agency CISA
Microsoft Security Blog
Microsoft Security Blog
博客园 - 【当耐特】
N
News and Events Feed by Topic
NISL@THU
NISL@THU
腾讯CDC
雷峰网
雷峰网
Security Latest
Security Latest
李成银的技术随笔
M
Microsoft Research Blog - Microsoft Research
L
LangChain Blog
L
Lohrmann on Cybersecurity
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
C
Check Point Blog
Y
Y Combinator Blog
Recent Announcements
Recent Announcements
博客园 - Franky
N
News | PayPal Newsroom
V
V2EX
A
About on SuperTechFans
The Register - Security
The Register - Security
月光博客
月光博客
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
Google Online Security Blog
Google Online Security Blog
MyScale Blog
MyScale Blog
Cisco Talos Blog
Cisco Talos Blog
Vercel News
Vercel News
WordPress大学
WordPress大学
C
Cyber Attacks, Cyber Crime and Cyber Security
The Hacker News
The Hacker News
IntelliJ IDEA : IntelliJ IDEA – the Leading IDE for Professional Development in Java and Kotlin | The JetBrains Blog
IntelliJ IDEA : IntelliJ IDEA – the Leading IDE for Professional Development in Java and Kotlin | The JetBrains Blog
爱范儿
爱范儿
A
Arctic Wolf
L
LINUX DO - 最新话题
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More

博客园 - My Data Support

Oracle性能优化精品资料集锦---从事Oracle十余年DBA倾力奉献 - My Data Support ORACLE版本说明 - My Data Support ORACLE KILL回话 MOS文章分类整理 如何在 SQL Server 2005 实例之间传输登录和密码 动态修改MYSQL配置参数 只导出表结构的SQL语句 查询大字段对象脚本 BMC监控的一个坑 RAC环境下创建本地数据文件的解决方法 如何清理监听日志 - My Data Support RMAN基于时间点的恢复 - My Data Support RAC一个节点添加本地监听地址 ORACLE坏块检查 远程访问数据库查询数据量一大就Hang - My Data Support Why AIXTHREAD_SCOPE Should Be Set To 'S' On AIX 在一个RAC集群中最多支持多少节点 - My Data Support Database name和SID Oracle Semaphore Management in UNIX Administration - My Data Support
什么时候会刷新备库控制文件refresh the standby database control file?
My Data Supp · 2013-10-14 · via 博客园 - My Data Support

通过合理的设置,对于Primary的绝大数操作,都是可以传递到Physical Standby,datafile的操作是通过STANDBY_FILE_MANAGEMENT参数来控制的,但是即使STANDBY_FILE_MANAGEMENT设置为auto,对于rename操作,standby还是忽略的。

If you do not rename the corresponding datafile at the standby system, and then try to
refresh the standby database control file, the standby database will attempt to use the
renamed datafile, but it will not find it. Consequently, you will see error messages
similar to the following in the alert log:
ORA-00283: recovery session canceled due to errors
ORA-01157: cannot identify/lock datafile 4 - see DBWR trace file
ORA-01110: datafile 4: '/Disk1/oracle/oradata/payroll/tbs_x.dbf'

从中可以看出,如果没有刷新standby的控制文件,日志中也不会有错误信息,那么在什么情况下会刷新控制文件呢?

先来来看看控制文件记录了什么信息?

■ The database name and database unique identifier (DBID)
■ The time stamp of database creation
■ Information about data files, online redo log files, and archived redo log files
■ Tablespace information
■ RMAN backups

事实上standby一直在应用主库传过来的日志,归档信息也一直在更新,也就是说一直在更新控制文件,但是控制文件并没有因此

觉察数据字典中的数据文件位置和自己的不一样。也就是说归档信息的改变不会导致refresh the standby database control file,下面做个实验看看数据文件的变化会不会导致refresh the standby database control file

1、更改主库google表空间的数据文件名称

SQL> select name from v$tablespace;

NAME
------------------------------
SYSTEM
UNDOTBS1
SYSAUX
USERS
TEMP
GOOGLE

6 rows selected.

SQL> select name from v$datafile;

NAME
--------------------------------------------------------------------------------
/u01/oracle/product/10.2.0/oradata/orcl/system01.dbf
/u01/oracle/product/10.2.0/oradata/orcl/undotbs01.dbf
/u01/oracle/product/10.2.0/oradata/orcl/sysaux01.dbf
/u01/oracle/product/10.2.0/oradata/orcl/users01.dbf
/u01/oracle/product/10.2.0/oradata/orcl/google.dbf

SQL> alter tablespace google offline normal;

SQL> ! mv /u01/oracle/product/10.2.0/oradata/orcl/google.dbf /u01/oracle/product/10.2.0/oradata/orcl/google1.dbf

SQL> alter database rename file '/u01/oracle/product/10.2.0/oradata/orcl/google.dbf' to '/u01/oracle/product/10.2.0/oradata/orcl/google1.dbf';


SQL> alter tablespace GOOGLE online;

SQL> alter system archive log current;

此时查看备库日志正常,无异常信息。

2、为主库google表空间在添加个数据文件,同样standby也会为google表空间添加数据文件。

SQL> alter tablespace google add datafile '/u01/oracle/product/10.2.0/oradata/orcl/google2.dbf' size 10m;

Tablespace altered.

SQL> alter system archive log current;

此时查看备库仍然没有异常信息。

SQL> select name from v$datafile;

NAME
--------------------------------------------------------------------------------
/u01/oracle/product/10.2.0/oradata/iptv/system01.dbf
/u01/oracle/product/10.2.0/oradata/iptv/undotbs01.dbf
/u01/oracle/product/10.2.0/oradata/iptv/sysaux01.dbf
/u01/oracle/product/10.2.0/oradata/iptv/users01.dbf
/u01/oracle/product/10.2.0/oradata/iptv/google.dbf
/u01/oracle/product/10.2.0/oradata/iptv/google2.dbf
--从备用库上可以看出控制文件中的信息还没有和数据字典中的信息同步。

什么时候才会刷新控制文件呢?这时我们再主库为google表空间添加个google.dbf文件看会出现什么情况?

---主库添加数据文件
SQL>alter tablespace google add datafile '/u01/oracle/product/10.2.0/oradata/orcl/google.dbf' size 10m;
SQL> alter system archive log current;

这时备用库终于出现异常

File #7 added to control file as 'UNNAMED00007' because it was
created under name already used in this database. Creation name:
'/u01/oracle/product/10.2.0/oradata/orcl/google.dbf'
Errors with log /u01/arch/1_61_724530650.dbf
MRP0: Background Media Recovery terminated with error 1537

说明添加同名的datafile会导致standby的控制文件refresh,但除此之外还有什么情况会导致standby的控制文件refresh呢?

出现此问题的处理相对简单,步骤如下:

1、备库修改standby_file_management参数
SQL> alter system set standby_file_management='manual';   
2、OS层面移动google.dbf为google1.dbf
[oracle@dg002 iptv]$ mv google.dbf  google1.dbf
3、修改DB层面修改google.dbf为google1.dbf
SQL> alter database rename file '/u01/oracle/product/10.2.0/oradata/iptv/google.dbf' to '/u01/oracle/product/10.2.0/oradata/iptv/google1.dbf';
4、DB层面修改修改UNNAMED00007为google.dbf
SQL>  alter database create datafile  '/u01/oracle/product/10.2.0/db_1/dbs/UNNAMED00007' as '/u01/oracle/product/10.2.0/oradata/iptv/google.dbf';
5、备库修改standby_file_management参数
SQL> alter system set standby_file_management='auto'; 
6、开启日志应用
SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE  DISCONNECT FROM SESSION;

不明白的是仅仅修改下控制文件,添加数据文件、删除数据文件都可以,为什么rename datafile不可以呢,对oracle来说有什么难度吗?