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

推荐订阅源

H
Hackread – Cybersecurity News, Data Breaches, AI and More
C
Check Point Blog
Hacker News: Ask HN
Hacker News: Ask HN
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
WordPress大学
WordPress大学
P
Proofpoint News Feed
V
Visual Studio Blog
C
Cyber Attacks, Cyber Crime and Cyber Security
N
Netflix TechBlog - Medium
C
CXSECURITY Database RSS Feed - CXSecurity.com
博客园 - 聂微东
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
博客园 - 叶小钗
Cisco Talos Blog
Cisco Talos Blog
S
Schneier on Security
T
Threat Research - Cisco Blogs
腾讯CDC
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
The Hacker News
The Hacker News
Google DeepMind News
Google DeepMind News
Microsoft Security Blog
Microsoft Security Blog
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
GbyAI
GbyAI
N
News | PayPal Newsroom
L
LINUX DO - 最新话题
酷 壳 – CoolShell
酷 壳 – CoolShell
P
Palo Alto Networks Blog
T
Tenable Blog
S
Secure Thoughts
T
Threatpost
V2EX - 技术
V2EX - 技术
大猫的无限游戏
大猫的无限游戏
Martin Fowler
Martin Fowler
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
Vercel News
Vercel News
罗磊的独立博客
P
Privacy & Cybersecurity Law Blog
Engineering at Meta
Engineering at Meta
小众软件
小众软件
Google DeepMind News
Google DeepMind News
N
News and Events Feed by Topic
Y
Y Combinator Blog
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
C
Cybersecurity and Infrastructure Security Agency CISA
P
Proofpoint News Feed
L
Lohrmann on Cybersecurity
P
Privacy International News Feed
H
Heimdal Security Blog
量子位
B
Blog

博客园 - My Data Support

用户中心 - 博客园 ORACLE版本说明 ORACLE KILL回话 MOS文章分类整理 如何在 SQL Server 2005 实例之间传输登录和密码 动态修改MYSQL配置参数 只导出表结构的SQL语句 查询大字段对象脚本 BMC监控的一个坑 RAC环境下创建本地数据文件的解决方法 如何清理监听日志 RMAN基于时间点的恢复 RAC一个节点添加本地监听地址 ORACLE坏块检查 远程访问数据库查询数据量一大就Hang Why AIXTHREAD_SCOPE Should Be Set To 'S' On AIX 在一个RAC集群中最多支持多少节点 Database name和SID Oracle Semaphore Management in UNIX Administration
什么时候会刷新备库控制文件refresh the standby database control file?
My Data Support · 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来说有什么难度吗?