我最近被分配到DBA(临时)的角色。我是开发人员,所以我无法在Oracle中获得许多知识......但是今天,在监视活动时,我看到以下SQL是从开发人员的工作站(TOAD.EXE)执行的。这是Toad自动生成的某种东西还是手动编写的查询?原因是,我担心个人有权从SYS模式中进行选择。
我咨询了开发人员,他说他们不查询sys表也没有必要。所以我有点担心这个查询是如何生成的。
任何建议都表示赞赏。谢谢!
SELECT INDEX_NAME "Index Name",
INDEX_TYPE "Index Type",
UNIQUENESS "Uniqueness",
STATUS "Status",
TABLE_OWNER || '.' || TABLE_NAME "Table",
TABLE_TYPE "Table Type",
TABLESPACE_NAME "Tablespace",
BUFFER_POOL "Buffer Pool",
INITCAP (partitioned) "Partitioned",
DECODE (temporary, 'N', 'No', 'Yes') "Temporary",
INI_TRANS "Initial Transactions",
MAX_TRANS "Max Transactions",
INITIAL_EXTENT "Initial Extent Size",
NEXT_EXTENT "Next Extent Size",
MIN_EXTENTS "Minimum Extents",
MAX_EXTENTS "Maximum Extents",
PCT_INCREASE "Percent Increase",
PCT_FREE "Percent Free",
FREELISTS "Freelists",
FREELIST_GROUPS "Freelist Groups",
DEGREE "Degree",
INSTANCES "Instances",
LAST_ANALYZED "Last Analyzed",
BLEVEL "BLevel",
LEAF_BLOCKS "Leaf Blocks",
DISTINCT_KEYS "Distinct Keys",
AVG_LEAF_BLOCKS_PER_KEY "Avg Leaf Blocks Per Key",
AVG_DATA_BLOCKS_PER_KEY "Avg Data Blocks Per Key",
CLUSTERING_FACTOR "Clustering Factor",
NUM_ROWS "Num Rows",
SAMPLE_SIZE "Sample Size",
GENERATED "Generated",
DECODE (JOIN_INDEX, 'NO', 'No', 'Yes') "Join Index",
Visibility "Visibility"
FROM SYS.ALL_INDEXES
WHERE OWNER = :OO AND INDEX_NAME = :NN
答案 0 :(得分:3)
TOAD正在针对Oracle的数据字典生成查询。有人点击了TOAD中的索引,这是它生成的查询。索引的名称和所有者将通过绑定变量(:OO和:NN)
提供请注意:
SELECT ... FROM SYS.ALL_INDEXES
与
相同SELECT ... FROM ALL_INDEXES
这是一个可供所有用户使用的视图,显示有关当前用户可见的索引的信息(您作为连接的用户。)
如果您不熟悉字典视图(USER_ ,ALL _ 和DBA_ *视图),即使是开发人员,也应该从以下开始:
http://docs.oracle.com/cd/E11882_01/server.112/e25789/datadict.htm