且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

[20180424]打开表空flashback on.txt

更新时间:2022-03-07 16:25:22

[20180424]打开表空flashback on.txt

--//昨天测试完成,链接http://blog.itpub.net/267265/viewspace-2153207/,忘记设置flashback on;.
--//今天设置回来,顺便做一个笔记.

1.环境:
SYS@book> @ &r/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

SYS@book> select open_mode from v$database ;
OPEN_MODE
--------------------
READ WRITE

SYS@book> alter tablespace tea flashback on;
alter tablespace tea flashback on
*
ERROR at line 1:
ORA-01126: database must be mounted in this instance and not open in any instance

--//竟然不能在open状态设置flashback on;.
$ oerr ora 01126
01126, 00000, "database must be mounted in this instance and not open in any instance"
// *Cause:  Obvious
// *Action:

2.测试在表空间offline下是否可行.

SYS@book> alter tablespace tea offline;
Tablespace altered.

SYS@book> alter tablespace tea flashback on;
alter tablespace tea flashback on
*
ERROR at line 1:
ORA-01126: database must be mounted in this instance and not open in any instance

SYS@book> alter tablespace tea online;
Tablespace altered.

--//看来必须在mount状态下调整.

SYS@book> 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@book> alter tablespace tea flashback off;

Tablespace altered.

SYS@book> alter tablespace tea flashback on;

Tablespace altered.

SYS@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  YES
7 rows selected.