Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How find all the partition information for the oracle table

I have a partitioned table t that is partitioned on a column using list partition,

I want to query out all the partition and also its corresponding column values.

It is the same as in PLSQL Developer: when I view sql for this table, it shows all the partitions like:

  partition DATA_20180522 values (20180522)
    tablespace DMSCMDAT
    pctfree 10
    initrans 1
    maxtrans 255
    storage
    (
      initial 8M
      next 1M
      minextents 1
      maxextents unlimited
    )

I google searched,but I don't find the answer.

like image 647
Tom Avatar asked Dec 18 '25 10:12

Tom


2 Answers

To find information on partitions you can query the ALL_TAB_PARTITIONS view:

SELECT *
  FROM ALL_TAB_PARTITIONS

and for much of the other info on a table you can query ALL_TABLES:

SELECT *
  FROM ALL_TABLES

If you want to recreate the source code for a table you need to write code. A good place to start is the code in this question at asktom.oracle.com.

Best of luck.

like image 189

As the other answer suggested, you could look at USER|ALL|DBA_TAB_PARTITIONS. But if your goal is to get the DDL, then the DBMS_METADATA.GET_DDL function is likely going to be loads easier. Use the SET_TRANSFORM_PARAM options to tailor the output to your liking.

like image 30
Don Seiler Avatar answered Dec 19 '25 22:12

Don Seiler



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!