Backup Recovery statistics

Source: Internet
Author: User
**************************************** * ************************************ Operations on the production database sys User: exec dbms_stats.create_stat_table ('gc ', 'stat _ gc_0825'); Exec dbms_stats.export_schema_stats ('gc ', 'stat _ gc_0825 '); **************************************** *********************************** command: database statistical information backup and recovery (only for sys users) exec dbms_stats.create_stat_table ('sys ', 'stat _ 1'); Exec dbms_stats.export_database_stats ('stat _ 1 '); exec dbms_stats.import_database_stats ('stat _ 1'); the statistical information of the solution is backed up and restored (only under the user of the solution owner) exec dbms_stats.create_stat_table ('nibe ', 'stat _ 2 '); exec dbms_stats.export_schema_stats ('gc ', 'gc _ stat'); Exec dbms_stats.import_schema_stats ('gc', 'stat _ GC '); statistical backup and recovery of tables (only under the user of the table owner) exec dbms_stats.create_stat_table ('nibe ', 'stat _ 3'); Exec dbms_stats.export_table_stats ('nibe ', 't_hd_room_group_type ', null, 'stat _ 3'); Exec dbms_stats.import_table_stats ('nibe', 't_hd_room_group_type ', null, 'stat _ 3'); experiment: train of Thought: first export the database statistics, then delete the table statistics, and then import the statistics, check whether the table has statistical information. SQL> conn nibe/nibe @ orclconnected to Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 connected as nibe SQL> Create Table ABC as select * From t_c_customer; table createdsql> select table_name, last_analyzed from user_tables where table_name = 'abc'; table_name last_analyzed tables ----------- abc SQL> exec dbms_stats.gather_table_stats ('nibe ', 'abc '); PL/SQL procedure into completedsql> select table_name, last_analyzed from user_tables where table_name = 'abc'; table_name last_analyzed tables ------------- ABC 2011-6-15 16: SQL> conn sys/Oracle @ orcl as sysdba; connected to Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 connected as syssql> exec dbms_stats.create_stat_table ('sys ', 'stats _ tab '); PL/SQL procedure successfully completedsql> exec dbms_stats.export_database_stats ('stats _ tab'); PL/SQL procedure successfully completed SQL> select count (*) from stats_tab; count (*) ---------- 295639 SQL> conn nibe/nibe @ orcl; connected to Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 connected as nibe SQL> exec dbms_stats.delete_table_stats ('nibe ', 'abc '); PL/SQL procedure successfully completedsql> select table_name, last_analyzed from user_tables where table_name = 'abc'; table_name last_analyzed tables ------------- abc SQL> conn sys/Oracle @ orcl as sysdba; connected to Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 connected as sys SQL> exec tables ('stats _ tab'); PL/SQL procedure successfully completedsql> conn nibe/nibe @ orcl; connected to Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 connected as nibe SQL> select table_name, last_analyzed from user_tables where table_name = 'abc'; table_name last_analyzed tables ------------- ABC 2011-6-15 17:

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.