Search for user and user table fields in Oracle

Source: Internet
Author: User

1. Search for user tables

  1. SelectTable_name, num_rowsFromAll_tablesWhereOWNER ='Tiger' ANDTABLE_NAMELike '% Master'
  2. Order ByNum_rowsDesc
2. Search user table fields
  1. Select*FromUser_tab_columns
  2. WhereDATA_TYPE ='Char' AndDATA_LENGTH = 119
  3.  AndTable_name =Upper('Imblmaster')
3. Search for repeated fields. Remove the count function to retrieve records.
  1. Select Count(*)FromSys_data
  2. WhereTrxrefIn(SelectTrxrefFromSys_dataGroup ByTrxrefHaving Count(Trxref)> 1)
  3. -- Or
  4. Select Sum(N)From(SelectTrxref,Count(Trxref)AsNFromSys_datasGroup ByTrxrefHaving Count(Trxref)> 1)
4. Search for records that are not repeated
  1. Select Count(Trxref)From(SelectTrxref,Count(Trxref)AsNFromSys_dataGroup ByTrxrefHaving Count(Trxref)> 1)
5. Search for redundant duplicate records
  1. Select Count(*)FromSys_data
  2. WhereTrxrefIn(SelectTrxrefFromSys_datasGroup ByTrxrefHaving Count(Trxref)> 1)
  3. AndRowidNot In(Select Min(Rowid)FromSys_dataGroup ByTrxrefHaving Count(Trxref)> 1)
6. Delete redundant duplicate records
  1. Delete FromSys_data
  2. WhereTrxrefIn(SelectTrxrefFromSys_dataGroup ByTrxrefHaving Count(Trxref)> 1)
  3. AndRowidNot In(Select Min(Rowid)FromSys_data

Related Article

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.