主库:
1. 查看switchover 状态
SQL> SELECT SWITCHOVER_STATUS FROM V$DATABASE;
to standby
附: A:switchover_status出现session active/not allowed
当出现session active的时候表示还有活动的session,则运行
Alter database commit to switchover to physical standby with session shutdown;
当出现not allowed时,在官方文档说转换会不成功,但是我测试的时候成功了,如果大家在测试不成功的时候再和我说,让我看看在什么情况下会不成功。
B.ora- 01153: an incompatible media recovery is active
运行下面代码
Alter database recover managed standby database finish;
或者Alter database recover managed standby database finish force;
Alter database recover managed standby database disconnect from session;
2 切换成备库
SQL>Alter database commit to switchover to physical standby with session shutdown;
SQL> ALTER DATABASE COMMIT TO SWITCHOVER TO PHYSICAL STANDBY;
Database altered.
3 启动到mount和应用日志状态
SQL> SHUTDOWN IMMEDIATE
SQL> startup nomount;
SQL> alter database mount standby database;
SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE DISCONNECT FROM SESSION;
4. 查看数据库模式
SQL>select dest_name,status,database_mode,recovery_mode,protection_mode from v$archive_dest_status;
SQL>select status,database_mode from v$archive_dest_status;
备库:
1.查看switchover状态
SQL> SELECT SWITCHOVER_STATUS FROM V$DATABASE;
TO PRIMARY
附:若不是用此语句切换:ALTER DATABASE COMMIT TO SWITCHOVER TO PRIMARY with session shutdown
2. 切换成主库
SQL> ALTER DATABASE COMMIT TO SWITCHOVER TO PRIMARY;
Database altered.
SQL> shutdown immediate;
SQL> startup;
SQL> alter system switch logfile;
3. 查看数据库模式
SQL>select dest_name,status,database_mode,recovery_mode,protection_mode from v$archive_dest_status;
SQL>select status,database_mode from v$archive_dest_status;
注意地方:
如果做了switchover,主库参数设置成以下方式,会触发ora-16009错误
Alert system set log_archive_dest_2=’service=primary
DB_UNIQUE_NAME=orcl’ scope=spfile;
然后再alert_orcl.log 日志中会出现以下错误内容
Thu Nov 27 10:19:12 2008
Redo Shipping Client Connect
-- Connected User is Valid
RFS[2]: Assigned to RFS process 1292
RFS[2]: Database mount ID mismatch [0x4781d95f:0x47823be1]
RFS[2]: Client instance is standby database i
RFS[2]: Not using real app
Thu Nov 27 10:19Errors in file
d:\oracle\product\10.2.0\admin\orcl\udump\orc
ORA-16009: 远程归档日
从metalink上查到:
* fact: Oracle Server - Enterprise Edition 9
* symptom: Errors appears in alert.log on primary database
* symptom: RFS: client instance is standby database instead
* symptom: RFS: Not using real application clusters
* symptom: Errors appear in alert.log on standby database
* symptom:
database
standby database
primary database
* symptom: Standby redo log files are defined on the standby database
* cause: The standby redo log files are synchronously filled with redo
from the primary database. When a logswitch occur on the primary database,
those files are archived on the standby database before being applyed on
it. The archiving process on the standby database should only archive to
the local disks on tprimarfix:
Disable the remote archiving on the standby databasExample: alter system set log_archive_dest_2 = ''
是因为没有把standby 上的log_archive_dest_2 清空导致的。
另外也有可
bug 4676659
Standby may not be recognised (ORA-16009)
When the log transport is LGWR ASYNC and logical standby has
LOG_ARCHIVE_DEST setting VALID_FOR=(ONLINE_LOGFILE, PRIMARY_ROLE)
ORA-16009 is reportedregular interWorkaround:
There is no workaround to prevent ORA-16009 from appearing in alert logs.