【翻译自mos文章】为table 的partition 建立synonym

本文参考自:

How to Create a Synonym on a Table Partition (Doc ID 119805.1)

How to Create a Synonym on a Table Partition:
=============================================

You cannot directly create a synonym on a table partition by specifying the
partition name and table name with the CREATE SYNONYM command.  You have
to create a view on the partition, and then create a synonym on the view.
This is a two-step method instead of a single-step method.

Follow the steps in this example to create the synonym:

 $ sqlplus scott/tiger

 SQL> create table emp_pt
      ( empno number primary key,
        ename varchar2(30))
      partition by range (empno)
      ( partition p8000 values less than (8001),
        partition p9000 values less than (9001),
        partition p10000 values less than (10001),
        partition pothers values less than (99999999));

 SQL> insert into emp_pt
      select empno, ename from emp;

       --- Populated the partition table EMP_PT with existing
       --- data from the EMP table.

 SQL> commit;

 SQL> select * from emp_pt;

      EMPNO ENAME
      ----- -----------------
      7369  SMITH
      7499  ALLEN
      7521  WARD
      7566  JONES
      7654  MARTIN
      ...
      9999  ANDY

 SQL> select * from emp_pt partition (p8000);

      EMPNO ENAME
      ----- ---------------------
      7369  SMITH
      7499  ALLEN
      7521  WARD
      7566  JONES
      7654  MARTIN
       ...
      7934  MILLER

 SQL> create view emp_pt_p8000 as select * from emp_pt partition (p8000);

 SQL> desc emp_pt_p8000

      Name                                Null?    Type
      ----------------------------------- ------ -----------
      EMPNO                                       NUMBER
      ENAME                                       VARCHAR2(30)

 SQL> create synonym p8000 for emp_pt_p8000;

 SQL> desc p8000

      Name                                Null?    Type
      ----------------------------------- ------ -----------
      EMPNO                                       NUMBER
      ENAME                                       VARCHAR2(30)

SQL> select * from p8000;

     EMPNO ENAME
     ----- ------------------------------
     7369 SMITH
     7499 ALLEN
     7521 WARD
     7566 JONES
     7654 MARTIN
     ...
     7934 MILLER

 SQL>
时间: 2024-10-13 08:32:40

【翻译自mos文章】为table 的partition 建立synonym的相关文章

【翻译自mos文章】控制OGG Director 中Repository Table 保留几天记录的参数

控制OGG Director 中Repository Table  保留几天记录的参数 翻译自mos文章: Can I Purge The Director "STATSENTRYB" Repository Table? (Doc ID 971709.1) QUESTION My Director Repository Table "STATSENTRYB" has grown to more than 100,000 rows. Is there a way to

【翻译自mos文章】Main Note - ogg的 Supplemental Logging and TRANDATA

Main Note - ogg的 Supplemental Logging and TRANDATA 参加原文: Main Note - Supplemental Logging and TRANDATA for OGG (Doc ID 1537838.1) 适用于 Oracle GoldenGate - Version 9.5_EA and later Information in this document applies to any platform. 目的 从oracle redo l

【翻译自mos文章】SYS_OP_C2C 导致的全表扫描(fts)/全索引扫描

SYS_OP_C2C 导致的全表扫描(fts)/全索引扫描 参考原文: SYS_OP_C2C Causing Full Table/Index Scans (Doc ID 732666.1) 适用于: Oracle Database - Enterprise Edition - Version 10.1.0.2 to 12.1.0.1 [Release 10.1 to 12.1] Information in this document applies to any platform. This

【翻译自mos文章】在OGG (Oracle GoldenGate) 中使用SCHEMATRANDATA的话,需要额外的db patch

在OGG (Oracle GoldenGate) 中使用SCHEMATRANDATA的话,需要额外的db patch 参考原文: Patches needed to support SCHEMATRANDATA in OGG (Oracle GoldenGate) (Doc ID 1426440.1) 适用于: Oracle GoldenGate - Version 11.1.1.1.1 and later Information in this document applies to any

【翻译自mos文章】在不使用par file的情况下,export or import 含有大小写表名的表

在不使用par file的情况下,export or import 含有大小写表名的表 参考原文: How to Export or Import Case Sensitive Tables Without Using a Par File (Doc ID 1622134.1)1 适用于: Oracle Database - Enterprise Edition - Version 10.2.0.1 to 11.2.0.4 [Release 10.2 to 11.2] Information i

【翻译自mos文章】ABMR:在asm 环境中测试Automatic Block Recover 特性的方法

ABMR:在asm 环境中测试Automatic Block Recover 特性的方法 参考原文: ABMR: How to test Automatic Block Recover Feature with ASM setup (Doc ID 1510090.1) 适用于: Oracle Database - Enterprise Edition - Version 11.2.0.3 and later Information in this document applies to any

【翻译自mos文章】将expdp的dmp文件从asm磁盘组里边放到本地文件系统里边

将expdp的dmp文件从asm磁盘组里边放到本地文件系统里边 参考原文: How To Extract Datapump File From ASM Diskgroup To Local Filesystem? (Doc ID 566941.1) 适用于: Oracle Database - Enterprise Edition - Version 11.1.0.6 to 11.1.0.7 [Release 11.1] Information in this document applies

【翻译自mos文章】11gR2中的asm后台进程

11gR2中的asm后台进程 参考原文: ASM Background Processes in 11.2 (Doc ID 1641678.1) 适用于: Oracle Database - Enterprise Edition - Version 11.2.0.2 to 11.2.0.4 [Release 11.2] Information in this document applies to any platform. 1 ASMB - ASM Background Process 与as

【翻译自mos文章】使用索引快速全扫(index ffs) 来避免全表扫描

使用索引快速全扫(index ffs) 来避免全表扫描 参考原文: Index Fast Full Scan Usage To Avoid Full Table Scans (Doc ID 70135.1) 适用于: Oracle Database - Enterprise Edition - Version 7.3.0.0 to 11.2.0.3 [Release 7.3.0 to 11.2] Information in this document applies to any platfo