Take Oracle _ TABLE name_field name_comment and other practical statements

Source: Internet
Author: User

Use the SQL code www.2cto.com, such as the Oracle _ TABLE name_field name_comment, to view all the tables in the ORACLE database: SELECT table_name FROM user_tables; <? Xml: namespace prefix = o ns = "urn: schemas-microsoft-com: office"/> -- view all the tables of all users in the ORACLE database select user, table_name from all_tables; -- View All columns of the user in the ORACLE database select table_name, column_name from user_tab_columns; -- View All columns of the user in the ORACLE database select user, table_name, column_name from all_tab_columns; -- view the serial number select * from user_sequences in the ORACLE database; -- all the above objects can be obtained through the following SQL statement query -- Query all the ORACLE Objects generated by the user SELECT * FROM user_objects; -- view the comments of all tables in the ORACLE database: select table_name, comments from user_tab_comments; -- view the comments of all columns in the ORACLE database: select table_name, column_name, comments from user_col_comments; -- add oracle comment on table aa10 IS 'System parameters' to the TABLE; -- add oracle comment on column aa10.aaa100 IS 'parameter category' to the COLUMN; -- view the attribute of the COLUMN in the TABLE, including the data type and whether it is non-empty DESC aa10; -- view the attributes of the columns in the table through the system table, including the data type, whether it is non-empty SELECT table_name, COLUMN_ID, column_name, data_type, data_length, DATA_PRECISION, nullable from user_tab_columns order by table_name, COLUMN_ID; -- view the size of database space occupied BY tables and indexes in the database www.2cto.com SELECT * FROM user_segments; -- view the NUMBER of records in all tables create table table_count (table_name VARCHAR2 (50), columns NUMBER (20); -- run the following statement in PB to obtain the result set, execute the result set in PB, and finally submit select 'insert into table_count values (''' | table_name | ''', (select count (1) from '| table_name |'); // '| comments from user_tab_comments; -- all table records have SELECT * FROM table_count in table_count; // synchronize the ORACLE database comments to PB. The Code starts to delete from pbcatcol where PBC_TNAM LIKE '%'; delete from pbcattbl where PBT_TNAM LIKE '%'; insert into pbcattbl (PBT_TNAM, PBT_OWNR, PBT_CMNT) SELECT region, region, region FROM ALL_TAB_COMMENTS WHERE region = 'lh 'AND TABLE_NAME LIKE' % '; // synchronous field name insert into pbcatcol (PBC_TNAM, PBC_OWNR, PBC_CNAM, PBC_LABL, PBC_CMNT, PBC_HDR) SELECT ALL_COL_COMMENTS.TABLE_NAME, comment, comment, ALL_COL_COMMENTS.COMMENTS, comment, comment FROM ALL_COL_COMMENTS WHERE comment = 'lh 'AND TABLE_NAME LIKE' % '; COMMIT; -- synchronize ORACLE Database comments to PB code end www.2cto.com -- synchronize PB comments to ORACLE select 'comment on table' | pbt_tnam | 'is ''' | pbt_cmnt | '''; 'From pbcattbl where pbt_tnam not like 'pb % 'UNION select 'comment on column' | pbc_tnam | '. '| pbc_cnam | 'is ''' | pbc_cmnt | ''';' from pbcatcol where pbC_tnam not like 'pb % '; -- Query Process select object_id, session_id, locked_mode from v $ locked_object; select t2.username, t2.sid, t2.serial #, t2.logon _ time from v $ locked_object t1, v $ session t2 where t1.session _ id = t2.sid order by t2.logon _ time; -- kill the alter system kill session '3, 123 ';

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.