Oracle11g新特性之edition
SQL> select * from v$version;
BANNER
--------------------------------------------------------------------------------
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
PL/SQL Release 11.2.0.3.0 - Production
CORE 11.2.0.3.0 Production
TNS for IBM/AIX RISC System/6000: Version 11.2.0.3.0 - Production
NLSRTL Version 11.2.0.3.0 - Production
--------------------------------------------------------------------------------
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
PL/SQL Release 11.2.0.3.0 - Production
CORE 11.2.0.3.0 Production
TNS for IBM/AIX RISC System/6000: Version 11.2.0.3.0 - Production
NLSRTL Version 11.2.0.3.0 - Production
--1,使用者準備
SQL> create user edtest identified by edtest;
User created.
SQL> grant connect,resource to edtest;
Grant succeeded.
SQL> grant create any edition,drop any edition to edtest;
Grant succeeded.
SQL> grant create view to edtest;
Grant succeeded.
SQL> alter user edtest enable editions;
User altered.
SQL> select editions_enabled from dba_users where username='EDTEST';
E
-
Y
-
Y
--2,使用edtest使用者登入,建立測試表
SQL> create table emp(x int,y int);
Table created.
SQL> insert into emp select rownum,rownum from dual connect by level<21;
20 rows created.
SQL> commit;
Commit complete.
--3,使用edtest使用者登入,建立editioning view
SQL> SELECT SYS_CONTEXT('userenv', 'current_edition_name') FROM DUAL;
SYS_CONTEXT('USERENV','CURRENT_EDITION_NAME')
--------------------------------------------------------------------------------
ORA$BASE
--------------------------------------------------------------------------------
ORA$BASE
SQL> create editioning view v_emp as select * from emp;
View created.
SQL> select view_name,editioning_view from user_views;
VIEW_NAME E
------------------------------ -
V_EMP Y
------------------------------ -
V_EMP Y
SQL> select view_name,editioning_view,edition_name from user_views_ae;
VIEW_NAME E EDITION_NAME
------------------------------ - ------------------------------
V_EMP Y ORA$BASE
------------------------------ - ------------------------------
V_EMP Y ORA$BASE
SQL> select * from user_EDITIONING_VIEWS_AE;
VIEW_NAME TABLE_NAME
------------------------------ ------------------------------
EDITION_NAME
------------------------------
V_EMP EMP
ORA$BASE
------------------------------ ------------------------------
EDITION_NAME
------------------------------
V_EMP EMP
ORA$BASE
SQL> select * from USER_EDITIONING_VIEW_COLS_AE;
VIEW_NAME VIEW_COLUMN_ID VIEW_COLUMN_NAME
------------------------------ -------------- ------------------------------
TABLE_COLUMN_ID TABLE_COLUMN_NAME EDITION_NAME
--------------- ------------------------------ ------------------------------
V_EMP 1 X
1 X ORA$BASE
------------------------------ -------------- ------------------------------
TABLE_COLUMN_ID TABLE_COLUMN_NAME EDITION_NAME
--------------- ------------------------------ ------------------------------
V_EMP 1 X
1 X ORA$BASE
V_EMP 2 Y
2 Y ORA$BASE
2 Y ORA$BASE
--4,使用edtest使用者登入,建立editioning view
SQL> create edition ed_test;
Edition created.
SQL> SELECT SYS_CONTEXT('userenv', 'current_edition_name') FROM DUAL;
SYS_CONTEXT('USERENV','CURRENT_EDITION_NAME')
--------------------------------------------------------------------------------
ORA$BASE
--------------------------------------------------------------------------------
ORA$BASE
SQL> alter session set edition = ed_test;
Session altered.
SQL> SELECT SYS_CONTEXT('userenv', 'current_edition_name') FROM DUAL;
SYS_CONTEXT('USERENV','CURRENT_EDITION_NAME')
--------------------------------------------------------------------------------
ED_TEST
--------------------------------------------------------------------------------
ED_TEST
SQL> create editioning view v_emp as select x from emp;
create editioning view v_emp as select x from emp
*
ERROR at line 1:
ORA-00955: name is already used by an existing object
SQL> create or replace editioning view v_emp as select x from emp;
View created.
SQL> desc v_emp
Name Null? Type
----------------------------------------- -------- ----------------------------
X NUMBER(38)
SQL> alter session set edition = ora$base;
Session altered.
SQL> desc v_emp
Name Null? Type
----------------------------------------- -------- ----------------------------
X NUMBER(38)
Y NUMBER(38)
Name Null? Type
----------------------------------------- -------- ----------------------------
X NUMBER(38)
Y NUMBER(38)
SQL> select view_name,editioning_view from user_views;
VIEW_NAME E
------------------------------ -
V_EMP Y
------------------------------ -
V_EMP Y
SQL> select view_name,editioning_view,edition_name from user_views_ae;
VIEW_NAME E EDITION_NAME
------------------------------ - ------------------------------
V_EMP Y ORA$BASE
V_EMP Y ED_TEST
------------------------------ - ------------------------------
V_EMP Y ORA$BASE
V_EMP Y ED_TEST
SQL> select * from user_EDITIONING_VIEWS;
VIEW_NAME TABLE_NAME
------------------------------ ------------------------------
V_EMP EMP
==>return only session edition
------------------------------ ------------------------------
V_EMP EMP
==>return only session edition
SQL> select * from user_EDITIONING_VIEWS_AE;
VIEW_NAME TABLE_NAME
------------------------------ ------------------------------
EDITION_NAME
------------------------------
V_EMP EMP
ORA$BASE
------------------------------ ------------------------------
EDITION_NAME
------------------------------
V_EMP EMP
ORA$BASE
V_EMP EMP
ED_TEST
ED_TEST
SQL> select * from USER_EDITIONING_VIEW_COLS_AE;
VIEW_NAME VIEW_COLUMN_ID VIEW_COLUMN_NAME
------------------------------ -------------- ------------------------------
TABLE_COLUMN_ID TABLE_COLUMN_NAME EDITION_NAME
--------------- ------------------------------ ------------------------------
V_EMP 1 X
1 X ORA$BASE
------------------------------ -------------- ------------------------------
TABLE_COLUMN_ID TABLE_COLUMN_NAME EDITION_NAME
--------------- ------------------------------ ------------------------------
V_EMP 1 X
1 X ORA$BASE
V_EMP 2 Y
2 Y ORA$BASE
2 Y ORA$BASE
V_EMP 1 X
1 X ED_TEST
1 X ED_TEST
select * from all_editions
EDITION_NAME PARENT_EDITION_NAME USABLE
------------------------------ ------------------------------ ------
ORA$BASE YES
ED_TEST ORA$BASE YES
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/18922393/viewspace-773503/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- oracle11g r2新特性Edition-Based RedefinitionOracle
- oracle11g新特性之--虛擬列Oracle
- Oracle11g新特性點評之RMANOracle
- Oracle11g新特性之只讀表Oracle
- Oracle11g新特性:SQL Result Cache [zt]OracleSQL
- oracle11g flashback archive feature新特性OracleHive
- 【PARTITION】Oracle11g新特性之間隔分割槽運用說明Oracle
- 【RMAN】Oracle11g備份恢復新特性Oracle
- oracle11g 的Data Guard方面的新特性Oracle
- ZT:資料庫Oracle11g新特性RMAN資料庫Oracle
- oracle11g中SQL最佳化新特性之Adaptive Cursor Sharing (ACS)OracleSQLAPT
- Oracle11g新特性 - 快速線上新增not null欄位OracleNull
- Oracle11g新特性——LOB型別功能增強Oracle型別
- Oracle11g新特性——密碼區分大小寫Oracle密碼
- oracle11g中SQL最佳化(SQL TUNING)新特性之SQL Plan Management(SPM)OracleSQL
- Oracle11g新特性導致空表不能匯出Oracle
- 10G新特性筆記之安裝新特性筆記
- Oracle11g新特性:dba_users不再顯示密碼Oracle密碼
- 關於oracle11g的關於cardinality feedback新特性Oracle
- 【MySQL】5.7新特性之四MySql
- 【MySQL】5.7新特性之五MySql
- 【MySQL】5.7新特性之六MySql
- 【MySQL】5.7新特性之七MySql
- C++ 11 新特性之容器相關特性C++
- Oracle11g新特性-PLSQL函式快取結果(一)[zt]OracleSQL函式快取
- 10G新特性筆記之備份恢復新特性筆記
- Oracle11g新特性之Replay a captured workload 捕獲工作負載新環境重放負載測試壓力OracleAPT負載
- JDK8新特性之stream()JDK
- HTML5 新特性之 WebsocketHTMLWeb
- Java8新特性之:OptionalJava
- Java 8 新特性之方法引用Java
- ES6 新特性之SymbolSymbol
- MySQL 8 新特性之Clone PluginMySqlPlugin
- Java 10 新特性之 AppCDSJavaAPP
- C++11 新特性之 lambdaC++
- C++ 11 新特性之ClassC++
- IOS11新特性之maskedCornersiOS
- Oracle 12c新特性之Sequence的Session特性OracleSession