[20180423]表空间闪回与snapshot standby
[20180423]flashback tablespace与snapshot standby.txt
--//缺省建立表空间是打开flashback on,如果某个表空间flashback off,在dg启动snapshot standby时注意,可能"回不来",
--//通过测试说明问题.
1.环境:
SCOTT@book> @ ver1
PORT_STRING VERSION BANNER
------------------------------ -------------- --------------------------------------------------------------------------------
x86_64/Linux 2.4.xx 11.2.0.4.0 Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
2.设置备库tea表空间关闭flashback.
SCOTT@book> alter tablespace tea flashback off;
Tablespace altered.
SCOTT@book> select * from v$tablespace;
TS# NAME INC BIG FLA ENC
------------ --------- --- --- --- ---
0 SYSTEM YES NO YES
1 SYSAUX YES NO YES
2 UNDOTBS1 YES NO YES
4 USERS YES NO YES
3 TEMP NO NO YES
6 EXAMPLE YES NO YES
7 TEA YES NO NO
7 rows selected.
--//tea表空间FLASHBACK_ON设置为NO.注意这些信息应该记录在控制文件,你可以发现备库还是On .
--//备库:
SYS@bookdg> select flashback_on from v$database;
FLASHBACK_ON
------------------
NO
SYS@bookdg> select * from v$tablespace;
TS# NAME INC BIG FLA ENC
---------- -------------------- --- --- --- ---
0 SYSTEM YES NO YES
1 SYSAUX YES NO YES
2 UNDOTBS1 YES NO YES
4 USERS YES NO YES
3 TEMP NO NO YES
6 EXAMPLE YES NO YES
7 TEA YES NO YES
7 rows selected.
--//备库还是yes,tea表空间.
SYS@bookdg> alter tablespace tea flashback off;
alter tablespace tea flashback off
*
ERROR at line 1:
ORA-16000: database open for read-only access
--//无法在open read only修改.
SYS@bookdg> startup mount
ORACLE instance started.
Total System Global Area 634732544 bytes
Fixed Size 2255792 bytes
Variable Size 197133392 bytes
Database Buffers 427819008 bytes
Redo Buffers 7524352 bytes
Database mounted.
SYS@bookdg> alter tablespace tea flashback off;
Tablespace altered.
SYS@bookdg> select * from v$tablespace;
TS# NAME INC BIG FLA ENC
---------- -------------------- --- --- --- ---
0 SYSTEM YES NO YES
1 SYSAUX YES NO YES
2 UNDOTBS1 YES NO YES
4 USERS YES NO YES
3 TEMP NO NO YES
6 EXAMPLE YES NO YES
7 TEA YES NO NO
7 rows selected.
--//OK,现在成功.
3.备库打开snapshot standby:
--//参考http://blog.itpub.net/267265/viewspace-2134547/
--//实际上就是保证存储点,只要闪回区足够,许多dml操作没有问题,在转换physical standby时,返回原来的存储点;
--//备库:
SYS@bookdg> alter database convert to snapshot standby;
Database altered.
SYS@bookdg> select database_role from v$database;
DATABASE_ROLE
----------------
SNAPSHOT STANDBY
SYS@bookdg> alter database open ;
Database altered.
SCOTT@bookdg> create table tt1 tablespace tea as select * from dba_objects;
Table created.
--//在主库也产生一些日志对于tea表空间:
SCOTT@book> create table empx tablespace tea as select * from emp;
Table created.
--//现在转换为physical standby
--//备库:
SYS@bookdg> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SYS@bookdg> startup mount
ORACLE instance started.
Total System Global Area 634732544 bytes
Fixed Size 2255792 bytes
Variable Size 197133392 bytes
Database Buffers 427819008 bytes
Redo Buffers 7524352 bytes
Database mounted.
SYS@bookdg> alter database convert to physical standby ;
alter database convert to physical standby
*
ERROR at line 1:
ORA-38753: Cannot flashback data file 6; no flashback log data.
ORA-01110: data file 6: '/mnt/ramdisk/book/tea01.dbf'
--//可以发现备库的数据文件6无法转换,这个应该引起足够重视,在备库转换为snapshot standby时,注意检查表空间是否flashvback是否都是on的状态.
$ oerr ora 38753
38753, 00000, "Cannot flashback data file %s; no flashback log data."
// *Cause: An attempt to perform a FLASHBACK DATABASE failed because the file
// does not have enough flashback log data to cover the time to
// flash back. Either the file did not have flashback generation
// enabled for it, or had flashback generation turned off for it
// some time during the time span of the flashback.
// *Action: The file cannot be flashed back. The file must be taken offline
// or the tablespace dropped before continuing with the FLASHBACK
// DATABASE command.
4.恢复:
--//简单一点,主库tea表空间设置为read only;
--//主库:
SCOTT@book> alter tablespace tea read only;
Tablespace altered.
$ scp /mnt/ramdisk/book/tea01.dbf oracle@192.168.100.40:/mnt/ramdisk/book/
tea01.dbf 100% 40MB 40.0MB/s 00:01
--//备库:
SYS@bookdg> alter database convert to physical standby ;
alter database convert to physical standby
*
ERROR at line 1:
ORA-38753: Cannot flashback data file 6; no flashback log data.
ORA-01110: data file 6: '/mnt/ramdisk/book/tea01.dbf'
--//不行:
SYS@bookdg> alter tablespace tea flashback on;
Tablespace altered.
SYS@bookdg> alter database convert to physical standby ;
alter database convert to physical standby
*
ERROR at line 1:
ORA-19926: Database cannot be converted at this time
--//根本不能这样转换.
SYS@bookdg> alter tablespace tea offline;
alter tablespace tea offline
*
ERROR at line 1:
ORA-01109: database not open
SYS@bookdg> alter database datafile 6 offline;
Database altered.
--//关闭备库重来.
SYS@bookdg> startup mount
ORACLE instance started.
Total System Global Area 634732544 bytes
Fixed Size 2255792 bytes
Variable Size 197133392 bytes
Database Buffers 427819008 bytes
Redo Buffers 7524352 bytes
Database mounted.
SYS@bookdg> alter database convert to physical standby ;
Database altered.
SYS@bookdg> shutdown immediate
ORA-01507: database not mounted
ORACLE instance shut down.
SYS@bookdg> startup mount
ORACLE instance started.
Total System Global Area 634732544 bytes
Fixed Size 2255792 bytes
Variable Size 197133392 bytes
Database Buffers 427819008 bytes
Redo Buffers 7524352 bytes
Database mounted.
SYS@bookdg> alter database datafile 6 online;
Database altered.
SYS@bookdg> alter database recover managed standby database using current logfile disconnect ;
Database altered.
SYS@bookdg> @ &r/dg/dg
PROCESS PID STATUS CLIENT_P GROUP# THREAD# SEQUENCE# BLOCK# BLOCKS DELAY_MINS
--------- ------- ------------ -------- ------ ------- ---------- ---------- ---------- ----------
ARCH 2394 CONNECTED ARCH N/A 0 0 0 0 0
ARCH 2396 CONNECTED ARCH N/A 0 0 0 0 0
ARCH 2398 CONNECTED ARCH N/A 0 0 0 0 0
RFS 2403 IDLE UNKNOWN N/A 0 0 0 0 0
RFS 2405 IDLE LGWR 2 1 789 50 1 0
ARCH 2400 CLOSING ARCH 4 1 788 1 183 0
MRP0 2407 APPLYING_LOG N/A N/A 1 789 50 102400 0
7 rows selected.
--//日志开始传输并应用.
SYS@bookdg> alter database recover managed standby database cancel ;
Database altered.
SYS@bookdg> alter database open read only;
Database altered.
SYS@bookdg> alter database recover managed standby database using current logfile disconnect ;
Database altered.
SYS@bookdg> select count(*) from scott.empx;
COUNT(*)
----------
14
SYS@bookdg> select count(*) from scott.tt1;
select count(*) from scott.tt1
*
ERROR at line 1:
ORA-00942: table or view does not exist
--//测试时建立的表不存在.
--//主库执行:
SCOTT@book> alter tablespace tea read write;
Tablespace altered.
SCOTT@book> delete from empx where rownum=1;
1 row deleted.
SCOTT@book> commit ;
Commit complete.
--//在备库检查,发现少一条记录.
SYS@bookdg> select count(*) from scott.empx;
COUNT(*)
----------
13
总结:
--//这个在以后工作中注意,在转换snapshot standby,注意表空间flaashback是否在on状态.
[20180423]表空间闪回与snapshot standby相关推荐
- 闪回的用途与实战(闪回表,闪回删除,闪回重名删除,闪回版本查询)
闪回可以做的操作有如下几种类型: 1.当数据错误删除,并且提交时(flashback table) 2.当错误删除了一张表drop table(flashback drop) 3.通过闪回获取表的历史 ...
- oracle 闪回查询,闪回版本查询,闪回事务查询,闪回表,闪回删除,闪回数据库
文章目录 1. 闪回查询 1.1. 闪回时间查询 1.2. 闪回scn查询 (1) 获取scn号的方法 (2) 闪回scn查询命令 2. 闪回版本查询 3. 闪回事务查询 4. 闪回表 5. 闪回删除 ...
- Oracle:闪回,闪回表,闪回删除,闪回版本查询,闪回事务查询
SQL> --SCN(系统改变号) sysdate的对应关系 SQL> select to_char(sysdate,'yyyy-mm-dd hh24:mi:ss'),timestamp_ ...
- 【Oracle】Drop表后闪回
本文介绍的闪回方式只适用于:删除表的表空间非system,drop语句中没有purge关键字(以上两种情况的误删除操作只能通过日志找回): 1.删除表后直接从回收站闪回 SCOTT@LGR> d ...
- mysql 回滚段 表空间_oracle回滚段和回滚表空间
昨晚因为做了一个大批量的删除,用的 delete .大约用了 6 个小时,导致了回滚段自动扩展到将近 30 个 G .(以后记着,做大批量删除的时候,一定要用脚本实现,分批量提交事务.那样就不会占用太 ...
- oracle 闪回数据表,Oracle 闪回数据库测试
Oracle 闪回数据库测试 1 设置闪回目录和大小 SQL> show parameter recover SQL> alter system set db_recovery_file_ ...
- oracle撤销段的功能,oracle撤销表空间和回滚段
/* 撤销表空间 */ 通过使用撤销技术,能够为Oracle数据库提供以下功能: * 使用ROLLBACK语句撤销事务 * 进行数据库恢复 * 提供数据的读一致性 Oracle强烈建议DBA在Orac ...
- 在toad新增oracle用户,利用toad发现oracle自动为你干了什么(表空间建立和用户建立)...
利用toad发现oracle自动为你干了什么(表空间建立和用户建立) Oracle:10.2.0.1 Windows 2003 一.表空间 sql>Create tablespace dba d ...
- oracle 闪回功能详解
Oracle的闪回技术提供了一组功能,可以访问过去某一时间的数据并从人为错误中恢复.闪回技术是Oracle 数据库独有的,支持任何级别的恢复,包括行.事务.表和数据库范围.使用闪回特性,可以查询以前的 ...
- oracle闪回某个时间点的数据库,Oracle 闪回总结
一.闪回查询(Flashback Query) 1.闪回查询技术 1.1 闪回查询机制 闪回查询是指利用数据库回滚段存放的信息查看指定表中过去某个时间点的数据信息,或过去某个时间段数据的变化情况,或某 ...
最新文章
- linux kvm虚拟化命令,Linux系统下kvm虚拟化(三)日常管理常用命令和配置说明
- 【十五分钟Talkshow】fmplan(十五分钟计划)的初步想法
- springmvc原理详解(手写springmvc)
- AI端计算产业应用:如何快速训练高精度模型并在设备端加速计算 | 公开课报名...
- 共建智慧海关 第四范式打造快、准、稳海关单证识别系统
- ASP.NET MVC编程——控制器
- fsync与fflush的关系和区别
- 使用 Google gflags 简化命令行参数处理
- 长期没有工作是什么感觉?
- python连接服务器informix_连接到Informix数据库 - Python方式
- 数据运营平台-数据采集
- 计算机无法连接到打印机主机,惠普打印机无法连接电脑解决方法
- 【luogu CF1153F】Serval and Bonus Problem(期望)(DP)
- python之路(1)_重要函数使用
- Amy联通必免方案再次发力
- 如虎添翼:施加负压的电磁车模
- YT88 USB 加密狗 使用方法(二)加密算法
- OPJ---7830:求小数的某一位
- 5个方法有效优化调查问卷
- 【K8S】整体原理-什么是K8S的Pod
热门文章
- 第10章 分离并纠正物理层和数据链路层故障
- 五种进程调度的算法实现(二)
- 比long 大的数用__int64 输出符%I64d
- 机器学习基础:核密度估计(Machine Learning Fundamentals: Kernel Density Estimation)
- 给金额字符串加逗号,例如:30000000000.50-30,000,000,000.50
- Mac便笺基本操作|便笺使用太鸡肋?那是你不知道这几个快捷键!
- 光声光谱技术和激光、红外技术的优劣势对比
- Mac端口转发解决eclipse/idea/tomcat不能启动80端口的问题
- drds节点异常处理,docker节点进程一直重启
- 学习MongoDB 六: MongoDB查询(游标操作、游标信息)(三)