Oracle DB 11.2.0.4 中SYS.ALL_CONSTRAINTS的定义 和 SYS.ALL_CONS_COLUMNS的定义

SYS.ALL_CONSTRAINTS的定义如下:

CREATE OR REPLACE VIEW ALL_CONSTRAINTS
(owner, constraint_name, constraint_type, table_name, search_condition, r_owner, r_constraint_name, delete_rule, status, deferrable, deferred, validated, generated, bad, rely, last_change, index_owner, index_name, invalid, view_related)
AS
select ou.name, oc.name,
       decode(c.type#, 1, 'C', 2, 'P', 3, 'U',
              4, 'R', 5, 'V', 6, 'O', 7,'C', 8, 'H', 9, 'F',
              10, 'F', 11, 'F', 13, 'F', '?'),
       o.name, c.condition, ru.name, rc.name,
       decode(c.type#, 4,
              decode(c.refact, 1, 'CASCADE', 2, 'SET NULL', 'NO ACTION'),
              NULL),
       decode(c.type#, 5, 'ENABLED',
              decode(c.enabled, NULL, 'DISABLED', 'ENABLED')),
       decode(bitand(c.defer, 1), 1, 'DEFERRABLE', 'NOT DEFERRABLE'),
       decode(bitand(c.defer, 2), 2, 'DEFERRED', 'IMMEDIATE'),
       decode(bitand(c.defer, 4), 4, 'VALIDATED', 'NOT VALIDATED'),
       decode(bitand(c.defer, 8), 8, 'GENERATED NAME', 'USER NAME'),
       decode(bitand(c.defer,16),16, 'BAD', null),
       decode(bitand(c.defer,32),32, 'RELY', null),
       c.mtime,
       decode(c.type#, 2, ui.name, 3, ui.name, null),
       decode(c.type#, 2, oi.name, 3, oi.name, null),
       decode(bitand(c.defer, 256), 256,
              decode(c.type#, 4,
                     case when (bitand(c.defer, 128) = 128
                                or o.status in (3, 5)
                                or ro.status in (3, 5)) then 'INVALID'
                          else null end,
                     case when (bitand(c.defer, 128) = 128
                                or o.status in (3, 5)) then 'INVALID'
                          else null end
                    ),
              null),
       decode(bitand(c.defer, 256), 256, 'DEPEND ON VIEW', null)
from sys.con$ oc, sys.con$ rc, sys."_BASE_USER" ou, sys."_BASE_USER" ru,
     sys."_CURRENT_EDITION_OBJ" ro, sys."_CURRENT_EDITION_OBJ" o, sys.cdef$ c,
     sys.obj$ oi, sys.user$ ui
where oc.owner# = ou.user#
  and oc.con# = c.con#
  and c.obj# = o.obj#
  and c.type# != 8
  and (c.type# < 14 or c.type# > 17)    /* don't include supplog cons   */
  and (c.type# != 12)                   /* don't include log group cons */
  and c.rcon# = rc.con#(+)
  and c.enabled = oi.obj#(+)
  and oi.owner# = ui.user#(+)
  and rc.owner# = ru.user#(+)
  and c.robj# = ro.obj#(+)
  and (o.owner# = userenv('SCHEMAID')
       or o.obj# in (select obj#
                     from sys.objauth$
                     where grantee# in ( select kzsrorol
                                         from x$kzsro
                                       )
                    )
        or /* user has system privileges */
          exists (select null from v$enabledprivs
                  where priv_number in (-45 /* LOCK ANY TABLE */,
                                        -47 /* SELECT ANY TABLE */,
                                        -48 /* INSERT ANY TABLE */,
                                        -49 /* UPDATE ANY TABLE */,
                                        -50 /* DELETE ANY TABLE */)
                  )
      )

SYS.ALL_CONS_COLUMNS的定义如下:

CREATE OR REPLACE VIEW ALL_CONS_COLUMNS
(owner, constraint_name, table_name, column_name, position)
AS
select u.name, c.name, o.name,
       decode(ac.name, null, col.name, ac.name), cc.pos#
from sys.user$ u, sys.con$ c, sys.col$ col, sys.ccol$ cc, sys.cdef$ cd,
     sys."_CURRENT_EDITION_OBJ" o, sys.attrcol$ ac
where c.owner# = u.user#
  and c.con# = cd.con#
  and (cd.type# < 14 or cd.type# > 17)   /* don't include supplog cons   */
  and (cd.type# != 12)                   /* don't include log group cons */
  and cd.con# = cc.con#
  and cc.obj# = col.obj#
  and cc.intcol# = col.intcol#
  and cc.obj# = o.obj#
  and (c.owner# = userenv('SCHEMAID')
       or cd.obj# in (select obj#
                      from sys.objauth$
                      where grantee# in ( select kzsrorol
                                         from x$kzsro
                                       )
                     )
        or /* user has system privileges */
          exists (select null from v$enabledprivs
                  where priv_number in (-45 /* LOCK ANY TABLE */,
                                        -47 /* SELECT ANY TABLE */,
                                        -48 /* INSERT ANY TABLE */,
                                        -49 /* UPDATE ANY TABLE */,
                                        -50 /* DELETE ANY TABLE */)
                  )
      )
  and col.obj# = ac.obj#(+)
  and col.intcol# = ac.intcol#(+)
时间: 2024-10-10 18:47:50

Oracle DB 11.2.0.4 中SYS.ALL_CONSTRAINTS的定义 和 SYS.ALL_CONS_COLUMNS的定义的相关文章

Oracle DB 12.1.0.2 中SYS.ALL_CONSTRAINTS的定义 和 SYS.ALL_CONS_COLUMNS的定义

SYS.ALL_CONSTRAINTS的定义如下: CREATE OR REPLACE VIEW ALL_CONSTRAINTS AS select OWNER, CONSTRAINT_NAME, CONSTRAINT_TYPE, TABLE_NAME, SEARCH_CONDITION, SEARCH_CONDITION_VC, R_OWNER, R_CONSTRAINT_NAME, DELETE_RULE, STATUS, DEFERRABLE, DEFERRED, VALIDATED, G

rhel7.4安装oracle 11G 11.2.0.4.0 RAC

一.操作系统 red hat 7.4oracle数据库版本11.2.0.4oracle grid版本11.2.0.4对应的文件p13390677_112040_Linux-x86-64_1of7.zip - database softwarep13390677_112040_Linux-x86-64_2of7.zip - database softwarep13390677_112040_Linux-x86-64_3of7.zip - grid software IP地址规划:DNS serve

ORACLE RAC 11.2.0.4 CentOS release 6.9 静默安装1.0版本

RAC11.2.0.4静默安装 1.0版本,20180613 #本文档IP地址使用X隐藏,个人可按照自己的当前环境IP进行适当修改 1. 清除原环境中的单实例软件 #清除原环境: 删除/etc/ora* 删除 /usr/local/bin/oraenv 删除 /usr/local/bin/dbhome 删除 /usr/local/bin/coraenv 删除 $ORACLE_BASE/* 删除 cd /picclife/app  rm -rf * #解释说明: /etc/oratab ?数据库实

Install Goldengate On Oracle Rac 11.2.0.4

安装环境: source: OS:redhat 6.3 DB:11.2.0.4 rac OGG:11.2.1.0.1 target: OS:redhat 6.3 DB:11.2.0.4 OGG:11.2.1.0.1 rac到单机的一个传输配置,这里测试ogg没有放入到共享存储中.建议生产环境将ogg放入共享存储,以免单点故障. Prepare(Source And Target DB): useradd ogg -g oinstall Add Environment Varible vi /ho

CentOS7 静默安装Oracle 11gR2(11.2.0.1)

最近有个项目需要迁移,项目中数据库用的是oracle,期间折腾了好久,特此记录. 一,下载Oracle 1,首先下载Oracle 11gR2,地址如下:http://www.oracle.com/technetwork/database/enterprise-edition/downloads/index.html?spm=a2c4e.11153940.blogcont566703.10.36ae6c23iChOrf2,在页面上方勾选同意许可:3,在下方选择对应的oracle版本,这里选择11g

Oracle Rac 11.2.0.3迁移OCR和VOTEDISK

环境:AIX7.1+Oracle Rac 11.2.0.3 迁移描述:今天在装Oracle Rac的时候,错误的将500G的数据盘用作OCRDG了,遂后续比较麻烦,只能讲ocr和votedisk迁移到新建的OCRDG上,并把DATADG删除并格式化该盘.(OCRDG为normal 冗余) 操作如下: [email protected]:/home/grid>/oraapp/grid/gridhome/bin/ocrcheck Status of Oracle Cluster Registry i

Oracle 11g(11.2.0.4)手动打补丁PSU(11.2.0.4.8)

一.准备工作 1,数据库环境操作系统版本   : Redhat 6.5 x64数据库版本     : Oracle 11.2.0.4 x64Oracle database: 11.2.0.4 2,准备内容OPatch : p6880880_112000_Linux-x86-64.zipDB PSU : p21352635_112040_Linux-x86-64.zip 仅单实例使用.OPatch下载地址:https://updates.oracle.com/download/6880880.ht

Database Control 在Oracle DB 11.2版本之后被放弃支持

参考自: Database Control To Be Desupported in DB Releases after 11.2 (Doc ID 1484775.1) 适用于: Oracle Server - Enterprise Edition Information in this document applies to any platform. 细节: Oracle宣布如下:Database Control (也称作DBControl or Database Console)将会在 O

关于:Oracle DB 10.2.0.5 简易安装说明

1.系统需求: 1)操作系统:(暂不讨论 x32 系统) Windows Vista x64(10.2.0.4) Windows 7 x64(10.2.0.5) Windows Server 2008 x64(10.2.0.4) Windows Server 2008 R2(10.2.0.5) 2)Internet Explorer 7 / 8 3)JDK 1.5.0 4).Net Framework 2.0 2.安装步骤: 以下,在 Windows Server 2008 R2 系统中进行.