Import and export of oracle statistics

Source: Internet
Author: User
Tags oracle documentation

For more information about the import and export of oracle statistics, see the official oracle documentation. 1. database version: SQL> select * from v $ version 2/BANNER Release Oracle Database 10g Enterprise Edition Release 10.2.0.4.0-64bi PL/SQL Release 10.2.0.4.0-Production CORE 10.2.0.4.0 Production TNS for Solaris: version 10.2.0.4.0-Production NLSRTL Version 10.2.0.4.0-Production 2. create test table www.2cto.com SQL> create Table test_stat as select * from dba_objects; table created 3. check whether the test has statistical information: SQL> select. TABLE_NAME,. NUM_ROWS,. BLOCKS,. LAST_ANALYZED from dba_tables a where. table_name = 'test _ stat'; TABLE_NAME NUM_ROWS BLOCKS LAST_ANALYZED ------------------------------ ---------- ----------------- TEST_STAT 4. no result in the previous step, so collect the statistical information: SQL> execute dbms_stats.gather_table_stats (ownname => 'danghb', tabname => 'test _ stat', estimate_percent => 20, degree => 5, no_invalidate => false); PL/SQL procedure successfully completed 5. view statistics again: SQL> select. TABLE_NAME,. NUM_ROWS,. BLOCKS,. LAST_ANALYZED from dba_tables a where. table_name = 'test _ stat'; TABLE_NAME NUM_ROWS BLOCKS LAST_ANALYZED ------------------------------ ---------- ----------------- TEST_STAT 67780 1044 11: 6. create a TABLE for storing statistics: SQL> execute dbms_stats.create_stat_table (ownname => 'danghb', stattab => 'stat _ table'); PL/SQL procedure successfully completed 7. export Statistics: SQL> execute dbms_stats.export_table_stats (ownname => 'danghb', tabname => 'test _ stat', stattab => 'stat _ table '); PL/SQL procedure successfully completed 8. check whether the table storing statistics has content: SQL> select count (*) from stat_table; COUNT (*) -------- 14 9. delete the statistics of the TEST table: SQL> execute dbms_stats.delete_table_stats (ownname => 'danghb', tabname => 'test _ stat'); PL/SQL procedure successfully completed 10. delete: SQL> select. TABLE_NAME,. NUM_ROWS,. BLOCKS,. LAST_ANALYZED from dba_tables a where. table_name = 'test _ stat'; TABLE_NAME NUM_ROWS BLOCKS LAST_ANALYZED ------------------------------ ---------- ----------------- TEST_STAT 11. import statistics: SQL> execute dbms_stats.import_table_stats (ownname => 'danghb', tabname => 'test _ stat', stattab => 'stat _ table '); PL/SQL procedure successfully completed 12. check whether the import is successful: SQL> select. TABLE_NAME,. NUM_ROWS,. BLOCKS,. LAST_ANALYZED from dba_tables a where. table_name = 'test _ stat'; TABLE_NAME NUM_ROWS BLOCKS LAST_ANALYZED ------------------------------ ---------- ----------------- TEST_STAT 67780 1044 11: -- EOF

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.