快照Standby
2016-03-10 12:52
363 查看
1.物理备库转换成快照备库:
1.1查看备库当前状态,处于只读、实时恢复模式:
SQL> SELECT database_role, switchover_status, open_mode, protection_mode, protection_level FROM v$database; DATABASE_ROLE SWITCHOVER_STATUS OPEN_MODE PROTECTION_MODE PROTECTION_LEVEL---------------- -------------------- -------------------- -------------------- --------------------PHYSICAL STANDBY NOT ALLOWED READ ONLY WITH APPLY MAXIMUM AVAILABILITY MAXIMUM AVAILABILITY1.2取消日志应用:
SQL> alter database recover managed standby database cancel;SQL> SELECT database_role, switchover_status, open_mode, protection_mode, protection_level FROM v$database; DATABASE_ROLE SWITCHOVER_STATUS OPEN_MODE PROTECTION_MODE PROTECTION_LEVEL---------------- -------------------- -------------------- -------------------- --------------------PHYSICAL STANDBY NOT ALLOWED READ ONLY MAXIMUM AVAILABILITY MAXIMUM AVAILABILITY1.3执行转换:
SQL> alter database convert to snapshot standby;SQL> SELECT database_role, switchover_status, open_mode, protection_mode, protection_level FROM v$database;DATABASE_ROLE SWITCHOVER_STATUS OPEN_MODE PROTECTION_MODE PROTECTION_LEVEL---------------- -------------------- -------------------- -------------------- --------------------SNAPSHOT STANDBY NOT ALLOWED MOUNTED MAXIMUM AVAILABILITY UNPROTECTED
SQL> SELECT database_role, switchover_status, open_mode, protection_mode, protection_level FROM v$database;
DATABASE_ROLE SWITCHOVER_STATUS OPEN_MODE PROTECTION_MODE PROTECTION_LEVEL
---------------- -------------------- -------------------- -------------------- --------------------
PHYSICAL STANDBY RECOVERY NEEDED READ ONLY MAXIMUM AVAILABILITY MAXIMUM AVAILABILITY
SQL> alter database recover managed standby database using current logfile disconnect from session;
1.4打开数据库:
SQL> alter database open;SQL> SELECT database_role, open_mode FROM v$database;DATABASE_ROLE OPEN_MODE---------------- --------------------SNAPSHOT STANDBY READ WRITE
2.验证快照standby:
SQL> create tablespace snapshotbs datafile'/u01/app/oradata/testdb/snapshotbs01.dbf' size 10M;SQL> column name format a50;SQL> SELECT name FROM v$datafile; NAME--------------------------------------------------/u01/app/oradata/testdb/system01.dbf/u01/app/oradata/testdb/sysaux01.dbf/u01/app/oradata/testdb/undotbs01.dbf/u01/app/oradata/testdb/users01.dbf/u01/app/oradata/testdb/example01.dbf/u01/app/oradata/testdb/snapshotbs01.dbf SQL> create table snapshotable( id int, namevarchar2(30)) tablespace snapshotbs;
SQL> SELECT table_name, tablespace_name FROM user_tables WHERE table_name='SNAPSHOTABLE';
TABLE_NAME TABLESPACE_NAME
------------------------------ ------------------------------
SNAPSHOTABLE SNAPSHOTBS
SQL> insert into snapshotable values( 1, 'Test Snapshot Standby');
SQL> commit;
SQL> SELECT * FROM snapshotable;
ID NAME
---------- --------------------------------------------------
1 Test Snapshot Standby
SQL> alter system switch logfile;
3.切换还原成物理备库
3.1关闭数据库:
SQL> SELECT database_role, open_mode FROM v$database; DATABASE_ROLE OPEN_MODE---------------- --------------------SNAPSHOT STANDBY READ WRITE SQL> alter database convert to physical standby;alter database convert to physical standby*ERROR at line 1:ORA-01126: database must be mounted in this instance and notopen in any instance SQL> shutdown immediate;3.2启动到mount状态:
SQL> startup mount;3.3进行切换
SQL> alter database convert to physical standby;SQL> alter database open;alter database open*ERROR at line 1:ORA-01507: database not mounted3.4重启数据库,并置于open状态:
SQL> shutdown abort;SQL> startup;3.5应用日志
SQL> SELECT database_role, open_mode FROM v$database; DATABASE_ROLE OPEN_MODE---------------- --------------------PHYSICAL STANDBY READ ONLY SQL> SELECT database_role, switchover_status, open_mode,protection_mode, protection_level FROM v$database; DATABASE_ROLE SWITCHOVER_STATUS OPEN_MODE PROTECTION_MODE PROTECTION_LEVEL---------------- -------------------- -------------------- -------------------- --------------------PHYSICAL STANDBY RECOVERY NEEDED READ ONLY MAXIMUM AVAILABILITY MAXIMUM AVAILABILITY SQL> alter database recover managed standby database using current logfile disconnect from session;SQL> SELECT database_role, open_mode FROM v$database; DATABASE_ROLE OPEN_MODE---------------- --------------------PHYSICAL STANDBY READ ONLY WITH APPLY SQL> SQL> SELECT name FROM v$datafile; NAME--------------------------------------------------/u01/app/oradata/testdb/system01.dbf/u01/app/oradata/testdb/sysaux01.dbf/u01/app/oradata/testdb/undotbs01.dbf/u01/app/oradata/testdb/users01.dbf/u01/app/oradata/testdb/example01.dbf SQL> SELECT * FROM snapshotable;SELECT * FROM snapshotable *ERROR at line 1:ORA-00942: table or view does not exist本文出自 “~Never” 博客,请务必保留此出处http://ospub.blog.51cto.com/6238506/1749524
相关文章推荐
- 释疑:抽象的父类无参构造函数运行范例
- 8 配置
- 理解WSGI
- vs工具箱控件灰色
- 自己动手丰衣足食之三级联动
- 7 ContentNegotiatingViewResolver
- New Android Application 的介绍
- swift:iOS模拟器键盘设置(弹出,中文键盘,隐藏)
- @RequestBody
- MapReduce工作机制图
- 如何在Eclipse配置Tomcat服务器
- java 自定义注解解析 模拟Hibernate 的ORM
- 关于影响NodeManager执行MR任务constainer数量的设置问题
- 成都Uber优步司机奖励政策(3月10日)
- 用GDB调试多进程程序
- 深入理解计算机系统之链接(一)
- MIT自然语言处理第二讲:单词计数(第一、二部分)
- poj2240Arbitrage_spfa & bellman-Ford
- meta——viewport
- 6 上传文件