Gets the elements of the Oracle table, piecing together hive statements and the required conf____oracle

Source: Internet
Author: User

1. Get the Build Table statement:

Select T.owner,t.column_id,t.column_name, ', ' STRING ', ', concat (concat (' COMMENT ', T2. COMMENTS), ', ') as Commentname from
all_tab_columns T-left 
join all_tab_comments t1 on
t.owner=t1. OWNER and
t.table_name=t1. table_name left
join All_col_comments T2 on
t.owner=t2. OWNER and
t.table_name=t2. TABLE_NAME and
T.column_name=t2. column_name
where t.table_name= ' table name ' ORDER by
t.owner,t.table_name,column_id;

2. Get the middle of the field separated by commas

Select Wm_concat (column_name) from (
select T.column_name from All_tab_columns t where t.table_name= ' table name ' and
t . Owner= ' owner ' ORDER by t.owner,t.table_name,column_id)

3. Query the size of the table (based on the size of the table to determine whether incremental or full migration data 1G a full amount, 1G above increment)

Select segment_name, To_char (Sum (bytes)/1024/1024/1024, ' FM999999.99 ') from
 dba_segments T
where t.segment _name= ' table name '
Group by segment_name

You can use Java code to cobble together the results of the above SQL into a hive statement, and a conf that needs to be configured

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.