oracle 查找表分区详细信息

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/13087386/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 01:11:41  来源:igfitidea点击:

Finding table partition details

sqloracle

提问by Pravin Satav

Possible Duplicate:
How can I get all the information about a table in Oracle?

可能的重复:
如何在 Oracle 中获取有关表的所有信息?

I need to add partitions into existing tables, we dont have production database access and we need to send sql queries to find details regarding existing partitions, I tried

我需要将分区添加到现有表中,我们没有生产数据库访问权限,我们需要发送 sql 查询以查找有关现有分区的详细信息,我试过了

desc <table-name>;

but it gives only info regarding table structure, we need table strucuture along with partition details.

但它只提供有关表结构的信息,我们需要表结构和分区详细信息。

Database is oracle 10g

数据库是oracle 10g

Thanks

谢谢

回答by Nick Krasnov

get_ddlfunction of dbms_metadatapackage will give you such information:

get_ddldbms_metadata包的功能会给你这样的信息:

SQL> create table Tb_Test(
  2    id number primary key
  3  )
  4  partition by range(id)(
  5    partition part1 values less than (100),
  6    partition part2 values less than (300),
  7    partition part3 values less than (maxvalue)
  8  )
  9  ;

Table created 

SQL> select dbms_metadata.get_ddl('TABLE', 'TB_TEST')
  2    from dual
  3  ;

DBMS_METADATA.GET_DDL('TABLE',
--------------------------------------------------------------------------------

  CREATE TABLE "BUDGET2011"."TB_TEST"
   (    "ID" NUMBER,

     PRIMARY KEY ("ID")

  USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255
  STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
  PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
  TABLESPACE "USERS"  ENABLE
   ) PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255
  STORAGE(
  BUFFER_POOL DEFAULT)
  TABLESPACE "USERS"
  PARTITION BY RANGE ("ID")
 (PARTITION "PART1"  VALUES LESS THAN (100)
  PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255
  STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
  PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
  TABLESPACE "USERS" NOCOMPRESS ,
 PARTITION "PART2"  VALUES LESS THAN (300)
  PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255
  STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
  PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
  TABLESPACE "USERS" NOCOMPRESS ,
 PARTITION "PART3"  VALUES LESS THAN (MAXVALUE)
  PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255
  STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
  PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
  TABLESPACE "USERS" NOCOMPRESS )