锘??xml version="1.0" encoding="utf-8" standalone="yes"?>无码久久精品国产亚洲Av影片,成a人片亚洲日本久久,亚洲天堂中文字幕http://www.tkk7.com/zl4393753/category/37300.htmljust do itzh-cnFri, 12 Nov 2010 11:10:07 GMTFri, 12 Nov 2010 11:10:07 GMT60ORACLE 璋冩暣鏁版嵁搴撳唴瀛?/title><link>http://www.tkk7.com/zl4393753/archive/2010/11/11/337786.html</link><dc:creator>Neil's NoteBook</dc:creator><author>Neil's NoteBook</author><pubDate>Thu, 11 Nov 2010 03:03:00 GMT</pubDate><guid>http://www.tkk7.com/zl4393753/archive/2010/11/11/337786.html</guid><wfw:comment>http://www.tkk7.com/zl4393753/comments/337786.html</wfw:comment><comments>http://www.tkk7.com/zl4393753/archive/2010/11/11/337786.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.tkk7.com/zl4393753/comments/commentRss/337786.html</wfw:commentRss><trackback:ping>http://www.tkk7.com/zl4393753/services/trackbacks/337786.html</trackback:ping><description><![CDATA[<p> <p>濡備綍鎵嶈兘浼樺寲oracle鐨勫唴瀛樺崰鐢ㄦ儏鍐靛憿錛熶負(fù)浜?jiǎn)寮鍙戠殑鏂逛究錛屾兂鍑忓皯oracle騫蟲(chóng)椂鍗犵敤鐨勫唴瀛樸備笅闈㈠氨涓烘?zhèn)ㄤ粙缁嶄竴涓氳繃璋冩暣oracle鍐呭瓨鍙傛暟瀹炵幇鍑忓皯鍐呭瓨鍗犵敤鐨勬柟娉曪紝渚涙?zhèn)ㄥ弬鑰冨涔?fàn)銆?/p> <p>瑙e喅鏂規(guī)硶錛?/p> <p>sqlplus “/ as sysdba"  </p> <p> create pfile='d:/cj.ora' from spfile;  </p> <p>鐒跺悗鍘諱綘鐨刼racle瀹夎鐩綍</p> <p>鎵句竴涓猧nit鏁版嵁搴撳悕.ora榪欐牱涓涓枃浠?/p> <p>鎶婂嚑涓猳racle鍐呭瓨鍙傛暟鏀瑰皬鐐?/p> <p>涓涓?G鐨勫唴瀛樻槸濡備笅閰嶇疆鐨勶細(xì)</p> <p>*.sga_max_size=712M</p> <p>*.large_pool_size=8M</p> <p>*.shared_pool_size=250M</p> <p>*.sort_area_size=0.5M</p> <p>*.db_cache_size=350M</p> <p>鐒跺悗shutdown鏁版嵁搴?/p> <p>shutdown immediate;  </p> <p> create spfile from pfile='d:/cj2.ora';  </p> <p> startup;  </p> <p>鐒跺悗鍚姩錛屽氨鍙互浜?jiǎn)銆?/p> <p>浠ヤ笂灝辨槸璋冩暣oracle鍐呭瓨鍙傛暟錛屽噺灝戞暟鎹簱鍐呭瓨鍗犵敤鐨勬柟娉曚粙緇嶃?/p> </p> <img src ="http://www.tkk7.com/zl4393753/aggbug/337786.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.tkk7.com/zl4393753/" target="_blank">Neil's NoteBook</a> 2010-11-11 11:03 <a href="http://www.tkk7.com/zl4393753/archive/2010/11/11/337786.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>oracle 閫掑綊鏌ヨhttp://www.tkk7.com/zl4393753/archive/2010/10/19/335526.htmlNeil's NoteBookNeil's NoteBookTue, 19 Oct 2010 02:19:00 GMThttp://www.tkk7.com/zl4393753/archive/2010/10/19/335526.htmlhttp://www.tkk7.com/zl4393753/comments/335526.htmlhttp://www.tkk7.com/zl4393753/archive/2010/10/19/335526.html#Feedback0http://www.tkk7.com/zl4393753/comments/commentRss/335526.htmlhttp://www.tkk7.com/zl4393753/services/trackbacks/335526.html1. 閫氳繃瀛愯妭鐐瑰悜鏍硅妭鐐硅拷鏈旓紝璇硶錛?br /> select * from da_tree start with id='195' connect by prior parentid=id;
2. 閫氳繃鏍硅妭鐐歸亶鍘嗗瓙鑺傜偣錛岃娉曪細(xì)
select * from da_tree start with parentid='21' connect by prior id=parentid;

oracle涓殑select璇彞鍙互鐢⊿TART WITH...CONNECT BY PRIOR瀛愬彞瀹炵幇閫掑綊鏌ヨ錛宑onnect by 鏄粨鏋勫寲鏌ヨ涓敤鍒扮殑錛屽叾鍩烘湰璇硶鏄細(xì)

Java浠g爜

select * from tablename start with cond1 connect by cond2 where cond3;

綆鍗曡鏉ユ槸灝嗕竴涓爲(wèi)鐘剁粨鏋勫瓨鍌ㄥ湪涓寮犺〃閲岋紝姣斿涓涓〃涓瓨鍦ㄤ袱涓瓧孌?

id,parentid閭d箞閫氳繃琛ㄧず姣忎竴鏉¤褰曠殑parent鏄皝錛屽氨鍙互褰㈡垚涓涓爲(wèi)鐘剁粨鏋勩?/p>

鐢ㄤ笂榪拌娉曠殑鏌ヨ鍙互鍙栧緱榪欐5鏍?wèi)鐨勬墍鏈夎褰曘?/p>




Neil's NoteBook 2010-10-19 10:19 鍙戣〃璇勮
]]>
Windows Vista涓嬪畨瑁匫RACLE10G闇娉ㄦ剰浜嬮」http://www.tkk7.com/zl4393753/archive/2009/09/08/294275.htmlNeil's NoteBookNeil's NoteBookTue, 08 Sep 2009 03:39:00 GMThttp://www.tkk7.com/zl4393753/archive/2009/09/08/294275.htmlhttp://www.tkk7.com/zl4393753/comments/294275.htmlhttp://www.tkk7.com/zl4393753/archive/2009/09/08/294275.html#Feedback0http://www.tkk7.com/zl4393753/comments/commentRss/294275.htmlhttp://www.tkk7.com/zl4393753/services/trackbacks/294275.html棣栧厛銆佺‘淇濅綘鏈夎鏂囦歡澶圭殑瀹屽叏鎺у埗鏉冦傦紙淇敼錛氭枃浠跺す鐐瑰彸閿?nbsp;灞炴?銆夊畨鍏?銆夐珮綰?銆夋墍鏈夎?銆?/font>鏀逛負(fù)鑷繁銆傛帴鐫緙栬緫鑷繁鐨勬潈闄愪負(fù)瀹屽叏鎺у埗錛?br style="word-wrap: break-word; line-height: normal; " /> 鍏舵銆佸皢setup.exe鐨勫吋瀹規(guī)ф敼涓?font color="sandybrown" style="word-wrap: break-word; line-height: normal; ">windows server 2003(server pack 1)銆?/font>灝辨槸鍙抽敭灞炴?銆夊吋瀹規(guī)?銆夊吋瀹規(guī)ā寮?/font>涓?br style="word-wrap: break-word; line-height: normal; " /> 鎺ョ潃銆佸彸閿紝浠ョ鐞嗗憳韜喚榪愯銆?br style="word-wrap: break-word; line-height: normal; " /> 鏈鍚庛佷細(xì)鍑虹幇鍏煎鎬ч棶棰樼殑鎻愮ず妗嗐傞夋嫨榪愯紼嬪簭銆?/span>

]]>
Oracle - Rebuild The Temporary Tablespacehttp://www.tkk7.com/zl4393753/archive/2009/03/12/259380.htmlNeil's NoteBookNeil's NoteBookThu, 12 Mar 2009 09:15:00 GMThttp://www.tkk7.com/zl4393753/archive/2009/03/12/259380.htmlhttp://www.tkk7.com/zl4393753/comments/259380.htmlhttp://www.tkk7.com/zl4393753/archive/2009/03/12/259380.html#Feedback0http://www.tkk7.com/zl4393753/comments/commentRss/259380.htmlhttp://www.tkk7.com/zl4393753/services/trackbacks/259380.htmlcreate temporary tablespace TEMP2 TEMPFILE '/home2/oracle/oradata/sysmon/temp02.dbf' SIZE 512M REUSE AUTOEXTEND ON NEXT 640K MAXSIZE UNLIMITED; --鍒涘緩涓漿涓存椂琛ㄧ┖闂?/div>
alter database default temporary tablespace temp2; --鏀瑰彉緙虹渷涓存椂琛ㄧ┖闂?涓哄垰鍒氬垱寤虹殑鏂頒復(fù)鏃惰〃絀洪棿temp2
drop tablespace temp including contents and datafiles;--鍒犻櫎鍘熸潵涓存椂琛ㄧ┖闂?/div>
create temporary tablespace TEMP TEMPFILE '/home2/oracle/oradata/sysmon/temp01.dbf' SIZE 512M REUSE AUTOEXTEND ON NEXT 640K MAXSIZE UNLIMITED; --閲嶆柊鍒涘緩涓存椂琛ㄧ┖闂?/div>
alter database default temporary tablespace temp; --閲嶇疆緙虹渷涓存椂琛ㄧ┖闂翠負(fù)鏂板緩鐨則emp琛ㄧ┖闂?/div>
drop tablespace temp2 including contents and datafiles;--鍒犻櫎涓漿鐢ㄤ復(fù)鏃惰〃絀洪棿


]]>Index Skip Scanninghttp://www.tkk7.com/zl4393753/archive/2009/01/21/252219.htmlNeil's NoteBookNeil's NoteBookWed, 21 Jan 2009 07:22:00 GMThttp://www.tkk7.com/zl4393753/archive/2009/01/21/252219.htmlhttp://www.tkk7.com/zl4393753/comments/252219.htmlhttp://www.tkk7.com/zl4393753/archive/2009/01/21/252219.html#Feedback0http://www.tkk7.com/zl4393753/comments/commentRss/252219.htmlhttp://www.tkk7.com/zl4393753/services/trackbacks/252219.htmlWHERE clause of a statement. In Oracle9i this restriction is removed because the optimizer can perform skip scans to retrieve rowids for values that do not use the prefix.

How It Works

Rather than restricting the search path using a predicate from the statement, Skip Scans are initiated by probing the index for distinct values of the prefix column. Each of these distinct values is then used as a starting point for a regular index search. The result is several separate searches of a single index that, when combined, eliminate the affect of the prefix column. Essentially, the index has been searched from the second level down.

The optimizer uses statistics to decide if a skip scan would be more efficient than a full table scan.

Advantages

This approach is advantageous because:
  • It reduces the number of indexes needed to support a range of queries. This increases performance by reducing index maintenance and decreases wasted space associated with multiple indexes.
  • The prefix column should be the most discriminating and the most widely used in queries. These two conditions do not always go hand in hand which makes the decision difficult. In these situations skip scanning reduces the impact of makeing the "wrong" decision.

Example

First, create and populate a test table with a concatenated index.
CREATE TABLE test_objects AS
SELECT * FROM all_objects;

CREATE INDEX test_objects_i ON test_objects (owner, object_name, subobject_name);

EXEC DBMS_STATS.gather_table_stats(USER, 'TEST_OBJECTS', cascade => TRUE);
Next, run a query that hits the leading edge of the index. Notice the range scan on the index.
SQL> SET AUTOTRACE ON
SQL> SELECT owner, object_name
2 FROM test_objects
3 WHERE owner = 'SYS'
4 AND object_name = 'DBMS_OUTPUT';

OWNER OBJECT_NAME
------------------------------ ------------------------------
SYS DBMS_OUTPUT

1 row selected.


Execution Plan
----------------------------------------------------------
Plan hash value: 3650344004

-----------------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
-----------------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 1 | 32 | 2 (0)| 00:00:01 |
|* 1 | INDEX RANGE SCAN| TEST_OBJECTS_I | 1 | 32 | 2 (0)| 00:00:01 |
-----------------------------------------------------------------------------------
Next, run a query that does not hit the leading edge of the index. Notice the index skip scan on the index.
SQL> SET AUTOTRACE ON
SQL> SELECT owner, object_name
2 FROM test_objects
3 WHERE object_name = 'DBMS_OUTPUT';

OWNER OBJECT_NAME
------------------------------ ------------------------------
PUBLIC DBMS_OUTPUT
SYS DBMS_OUTPUT

2 rows selected.


Execution Plan
----------------------------------------------------------
Plan hash value: 1293870291

-----------------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
-----------------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 2 | 64 | 14 (0)| 00:00:01 |
|* 1 | INDEX SKIP SCAN | TEST_OBJECTS_I | 2 | 64 | 14 (0)| 00:00:01 |
-----------------------------------------------------------------------------------
Finally, clean up the test table.
DROP TABLE test_objects;
For more information see:
Hope this helps. Regards Tim...

鍘熸枃鍦板潃錛?http://oracle-base.com/articles/9i/IndexSkipScanning.php#HowItWorks


]]>
Oracle Update Join Syntaxhttp://www.tkk7.com/zl4393753/archive/2009/01/20/252061.htmlNeil's NoteBookNeil's NoteBookTue, 20 Jan 2009 07:14:00 GMThttp://www.tkk7.com/zl4393753/archive/2009/01/20/252061.htmlhttp://www.tkk7.com/zl4393753/comments/252061.htmlhttp://www.tkk7.com/zl4393753/archive/2009/01/20/252061.html#Feedback0http://www.tkk7.com/zl4393753/comments/commentRss/252061.htmlhttp://www.tkk7.com/zl4393753/services/trackbacks/252061.htmlupdate 
(
select a.* from da_page a,da_jbxx b, da_pic c 
where a.da_id=b.id 
and a.pic_id=c.id 
and a.ztdm >= '020' 
and a.ztdm < '060' 
and (a.shbz='0' or a.shbz='R'
and a.jsbz='N' 
and b.swjg_dm like '14201%'
)
set jsbz='Y',shr_dm='14201000087'
where 1=1 and rownum <= '10'


]]>Cost Control: Inside the Oracle Optimizerhttp://www.tkk7.com/zl4393753/archive/2009/01/19/251923.htmlNeil's NoteBookNeil's NoteBookMon, 19 Jan 2009 09:11:00 GMThttp://www.tkk7.com/zl4393753/archive/2009/01/19/251923.htmlhttp://www.tkk7.com/zl4393753/comments/251923.htmlhttp://www.tkk7.com/zl4393753/archive/2009/01/19/251923.html#Feedback0http://www.tkk7.com/zl4393753/comments/commentRss/251923.htmlhttp://www.tkk7.com/zl4393753/services/trackbacks/251923.html In Oracle we now see 11g extended optimizer statistics, an alternative to dynamic_sampling for estimating result set sizes.

PART 2 - CBO Statistics

The most important key to success with the CBO is to carefully define and manage your statistics. In order for the CBO to make an intelligent decision about the best execution plan for your SQL, it must have information about the table and indexes that participate in the query. When the CBO knows the size of the tables and the distribution, cardinality, and selectivity of column values, the CBO can make an informed decision and almost always generates the best execution plan.

As a review, the CBO gathers information from many sources, and he has the lofty goal of using DBA-provided metadata to always make the "best" execution plan decision:

Oracle uses data from many sources to make an execution plan

Let's examine the following areas of CBO statistics and see how to gather top-quality statistics for the CBO and how to create an appropriate CBO environment for your database.

Getting top-quality statistics for the CBO. The choices of executions plans made by the CBO are only as good as the statistics available to it. The old-fashioned analyze table and dbms_utility methods for generating CBO statistics are obsolete and somewhat dangerous to SQL performance. As we may know, the CBO uses object statistics to choose the best execution plan for all SQL statements.

The dbms_stats utility does a far better job in estimating statistics, especially for large partitioned tables, and the better statistics result in faster SQL execution plans. Here is a sample execution of dbms_stats with the OPTIONS clause:

exec dbms_stats.gather_schema_stats( - 
ownname => 'SCOTT', -
options => 'GATHER AUTO', -
estimate_percent => dbms_stats.auto_sample_size, -
method_opt => 'for all columns size repeat', -
degree => 34 -
)
Here is another dbms_stats example that creates histograms on all indexes columns:
BEGIN
dbms_stats.gather_schema_stats(
ownname=>'TPCC',
METHOD_OPT=>'FOR ALL INDEXED COLUMNS SIZE SKEWONLY',
CASCADE=>TRUE,
ESTIMATE_PERCENT=>100);
END;
/

There are several values for the OPTIONS parameter that we need to know about:

  • GATHER_ reanalyzes the whole schema
     
  • GATHER EMPTY_ only analyzes tables that have no existing statistics
     
  • GATHER STALE_ only reanalyzes tables with more than 10 percent modifications (inserts, updates,   deletes)
     
  • GATHER AUTO_ will reanalyze objects that currently have no statistics and objects with stale statistics.  Using GATHER AUTO is like combining GATHER STALE and GATHER EMPTY.

Note that both GATHER STALE and GATHER AUTO require monitoring. If you issue the ALTER TABLE XXX MONITORING command, Oracle tracks changed tables with the dba_tab_modifications view. Below we see that the exact number of inserts, updates and deletes are tracked since the last analysis of statistics:

SQL> desc dba_tab_modifications;

Name Type
--------------------------------
TABLE_OWNER VARCHAR2(30)
TABLE_NAME VARCHAR2(30)
PARTITION_NAME VARCHAR2(30)
SUBPARTITION_NAME VARCHAR2(30)
INSERTS NUMBER
UPDATES NUMBER
DELETES NUMBER
TIMESTAMP DATE
TRUNCATED VARCHAR2(3)

The most interesting of these options is the GATHER STALE option. Because all statistics will become stale   quickly in a robust OLTP database, we must remember the rule for GATHER STALE is > 10% row change   (based on num_rows at statistics collection time). Hence, almost every table except read-only tables will be reanalyzed with the GATHER STALE option, making the GATHER STALE option best for systems that are       largely read-only. For example, if only five percent of the database tables get significant updates, then only        five percent of the tables will be reanalyzed with the GATHER STALE option.

Automating sample size with dbms_stats.The better the quality of the statistics, the better the job that the    CBO will do when determining your execution plans. Unfortunately, doing a complete analysis on a large  database could take days, and most shops must sample your database to get CBO statistics. The goal is to take a large enough sample of the database to provide top-quality data for the CBO.

Now that we see how the dbms_stats option works, let's see how to specify an adequate sample size for dbms_stats.

In earlier releases, the DBA had to guess what percentage of the database provided the best sample size and sometimes underanalyzed the schema. Starting with Oracle9i Database, the estimate_percent argument is a great way to allow Oracle's dbms_stats to automatically estimate the "best" percentage of a segment to sample when gathering statistics:

estimate_percent => dbms_stats.auto_sample_size

After collecting automatic sample sizes, you can verify the accuracy of the automatic statistics sampling by    looking at the sample_size column on any of these data dictionary views:

  • DBA_ALL_TABLES
  • DBA_INDEXES
  • DBA_IND_PARTITIONS
  • DBA_IND_SUBPARTITIONS
  • DBA_OBJECT_TABLES
  • DBA_PART_COL_STATISTICS
  • DBA_SUBPART_COL_STATISTICS
  • DBA_TABLES
  • DBA_TAB_COLS
  • DBA_TAB_COLUMNS
  • DBA_TAB_COL_STATISTICS
  • DBA_TAB_PARTITIONS
  • DBA_TAB_SUBPARTITIONS

Note that Oracle generally chooses a sample_size from 5 to 20 percent when using automatic sampling, depending on the size of the tables and the distribution of column values. Remember, the better the quality of  your statistics, the better the decision of the CBO.


Update:

In Oracle we now see 11g extended optimizer statistics, an alternative to dynamic_sampling for estimating result set sizes.


Now that we understand the value of CBO statistics, let's look at ways that the CBO statistics are managed in a successful Oracle shop.


The WISE Oracle tool is the easiest way to analyze Oracle performance and WISE allows you to spot hidden performance trends.


鍘熸枃鍦板潃錛?http://www.dba-oracle.com/art_otn_cbo_p2.htm



]]>
Cost Based Optimizer (CBO) and Database Statisticshttp://www.tkk7.com/zl4393753/archive/2009/01/19/251907.htmlNeil's NoteBookNeil's NoteBookMon, 19 Jan 2009 08:00:00 GMThttp://www.tkk7.com/zl4393753/archive/2009/01/19/251907.htmlhttp://www.tkk7.com/zl4393753/comments/251907.htmlhttp://www.tkk7.com/zl4393753/archive/2009/01/19/251907.html#Feedback0http://www.tkk7.com/zl4393753/comments/commentRss/251907.htmlhttp://www.tkk7.com/zl4393753/services/trackbacks/251907.html
  • Rule Based Optimizer (RBO) - This method is used if the server has no internal statistics relating to the objects referenced by the statement. This method is no longer favoured by Oracle and will be desupported in future releases.
  • Cost Based Optimizer (CBO) - This method is used if internal statistics are present. The CBO checks several possible execution plans and selects the one with the lowest cost, where cost relates to system resources.
  • If new objects are created, or the amount of data in the database changes the statistics will no longer represent the real state of the database so the CBO decision process may be seriously impaired. The mechanisms and issues relating to maintenance of internal statistics are explained below:

    Analyze Statement

    The ANALYZE statement can be used to gather statistics for a specific table, index or cluster. The statistics can be computed exactly, or estimated based on a specific number of rows, or a percentage of rows:
    ANALYZE TABLE employees COMPUTE STATISTICS;
    ANALYZE INDEX employees_pk COMPUTE STATISTICS;

    ANALYZE TABLE employees ESTIMATE STATISTICS SAMPLE 100 ROWS;
    ANALYZE TABLE employees ESTIMATE STATISTICS SAMPLE 15 PERCENT;

    DBMS_UTILITY

    The DBMS_UTILITY package can be used to gather statistics for a whole schema or database. Both methods follow the same format as the analyze statement:
    EXEC DBMS_UTILITY.analyze_schema('SCOTT','COMPUTE');
    EXEC DBMS_UTILITY.analyze_schema('SCOTT','ESTIMATE', estimate_rows => 100);
    EXEC DBMS_UTILITY.analyze_schema('SCOTT','ESTIMATE', estimate_percent => 15);

    EXEC DBMS_UTILITY.analyze_database('COMPUTE');
    EXEC DBMS_UTILITY.analyze_database('ESTIMATE', estimate_rows => 100);
    EXEC DBMS_UTILITY.analyze_database('ESTIMATE', estimate_percent => 15);

    DBMS_STATS

    The DBMS_STATS package was introduced in Oracle 8i and is Oracles preferred method of gathering object statistics. Oracle list a number of benefits to using it including parallel execution, long term storage of statistics and transfer of statistics between servers. Once again, it follows a similar format to the other methods:
    EXEC DBMS_STATS.gather_database_stats;
    EXEC DBMS_STATS.gather_database_stats(estimate_percent => 15);

    EXEC DBMS_STATS.gather_schema_stats('SCOTT');
    EXEC DBMS_STATS.gather_schema_stats('SCOTT', estimate_percent => 15);

    EXEC DBMS_STATS.gather_table_stats('SCOTT', 'EMPLOYEES');
    EXEC DBMS_STATS.gather_table_stats('SCOTT', 'EMPLOYEES', estimate_percent => 15);

    EXEC DBMS_STATS.gather_index_stats('SCOTT', 'EMPLOYEES_PK');
    EXEC DBMS_STATS.gather_index_stats('SCOTT', 'EMPLOYEES_PK', estimate_percent => 15);
    This package also gives you the ability to delete statistics:
    EXEC DBMS_STATS.delete_database_stats;
    EXEC DBMS_STATS.delete_schema_stats('SCOTT');
    EXEC DBMS_STATS.delete_table_stats('SCOTT', 'EMPLOYEES');
    EXEC DBMS_STATS.delete_index_stats('SCOTT', 'EMPLOYEES_PK');

    Scheduling Stats

    Scheduling the gathering of statistics using DBMS_Job is the easiest way to make sure they are always up to date:
    SET SERVEROUTPUT ON
    DECLARE
    l_job NUMBER;
    BEGIN

    DBMS_JOB.submit(l_job,
    'BEGIN DBMS_STATS.gather_schema_stats(''SCOTT''); END;',
    SYSDATE,
    'SYSDATE + 1');
    COMMIT;
    DBMS_OUTPUT.put_line('Job: ' || l_job);
    END;
    /
    The above code sets up a job to gather statistics for SCOTT for the current time every day. You can list the current jobs on the server using the DBS_JOBS and DBA_JOBS_RUNNING views.

    Existing jobs can be removed using:
    EXEC DBMS_JOB.remove(X);
    COMMIT;
    Where 'X' is the number of the job to be removed.

    Transfering Stats

    It is possible to transfer statistics between servers allowing consistent execution plans between servers with varying amounts of data. First the statistics must be collected into a statistics table. In the following examples the statistics for the APPSCHEMA user are collected into a new table, STATS_TABLE, which is owned by DBASCHEMA:
      SQL> EXEC DBMS_STATS.create_stat_table('DBASCHEMA','STATS_TABLE');
    SQL> EXEC DBMS_STATS.export_schema_stats('APPSCHEMA','STATS_TABLE',NULL,'DBASCHEMA');
    This table can then be transfered to another server using your preferred method (Export/Import, SQLPlus Copy etc.) and the stats imported into the data dictionary as follows:
      SQL> EXEC DBMS_STATS.import_schema_stats('APPSCHEMA','STATS_TABLE',NULL,'DBASCHEMA');
    SQL> EXEC DBMS_STATS.drop_stat_table('DBASCHEMA','STATS_TABLE');

    Issues

    • Exclude dataload tables from your regular stats gathering, unless you know they will be full at the time that stats are gathered.
    • I've found gathering stats for the SYS schema can make the system run slower, not faster.
    • Gathering statistics can be very resource intensive for the server so avoid peak workload times or gather stale stats only.
    • Even if scheduled, it may be necessary to gather fresh statistics after database maintenance or large data loads.
    For more information see:
    Hope this helps. Regards Tim...

    鍘熸枃鍦板潃錛?http://www.oracle-base.com/articles/8i/CostBasedOptimizerAndDatabaseStatistics.php#AnalyzeStatement


    ]]>
    ORACLE緇熻淇℃伅鐨勫鍑恒佸鍏?/title><link>http://www.tkk7.com/zl4393753/archive/2009/01/16/251599.html</link><dc:creator>Neil's NoteBook</dc:creator><author>Neil's NoteBook</author><pubDate>Fri, 16 Jan 2009 08:46:00 GMT</pubDate><guid>http://www.tkk7.com/zl4393753/archive/2009/01/16/251599.html</guid><wfw:comment>http://www.tkk7.com/zl4393753/comments/251599.html</wfw:comment><comments>http://www.tkk7.com/zl4393753/archive/2009/01/16/251599.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.tkk7.com/zl4393753/comments/commentRss/251599.html</wfw:commentRss><trackback:ping>http://www.tkk7.com/zl4393753/services/trackbacks/251599.html</trackback:ping><description><![CDATA[1\ 鍒涘緩涓涓笓鐢ㄨ〃淇濆瓨鍚勮〃鐨勭粺璁′俊鎭細(xì)<br /> exec dbms_stats.create_stat_table(''ks38'',''fys'');<br /> <br /> 2\ 灝嗗悇琛ㄧ殑緇熻淇℃伅瀵煎叆鍒発s38.fys琛ㄤ腑錛?br /> exec dbms_stats.export_table_stats(''ks38'',''tcl_cust_base_info'',null,''fys''); <br /> ---鍙互鍒涘緩涓嶆槸鐧婚檰鐢ㄦ埛涓嬬殑琛紱濡傜敤system鐧婚檰錛屽彲浠ュ垱寤鴻〃鍒?#8216;ks38''鐢ㄦ埛涓?br /> <br /> 鎴栧皢鎸囧畾schema鐨勭粺璁′俊鎭鍏ュ埌ks38.fys琛ㄤ腑<br /> exec dbms_stats.export_schema_stats(''ks38'',''fys'');<br /> <br /> 娉細(xì)<br /> 鑻ュ皢鏁翠釜鏁版嵁搴撶殑緇熻淇℃伅瀵煎嚭鍒版煇涓〃蹇呴』鎸変互涓嬫柟寮忓仛錛?br /> 1錛夌敤SYSDBA瑙掕壊鐨勭敤鎴風(fēng)櫥闄嗭紙濡俿ystem)<br /> 2) exec dbms_stat.create_stat_table(''system'',''tbl_name''); ----璁頒綇錛氭澶勫垱寤虹殑琛ㄥ繀欏繪槸鐧婚檰鐢ㄦ埛涓嬬殑琛ㄣ?<br /> 3) exec dbms_stat.export_database_stats(''tbl_name'')<br /> <br /> ****<br /> 瀵煎嚭琛ㄧ姸鎬併丼CHEMA緇熻淇℃伅錛屼繚瀛樺鍑轟俊鎭殑琛ㄧ殑SCHEMA鍙互鍜岀櫥闄嗙敤鎴峰悕涓嶄竴鑷達(dá)紱鍙﹀瀵煎叆緇熻淇℃伅鐨勮〃鍜屽師琛ㄥ敖鍙兘<br /> 鏄悓涓schema涓嬬殑<br /> 瀵煎嚭鏁翠釜鏁版嵁搴撶粺璁′俊鎭紝淇濆瓨瀵煎嚭淇℃伅鐨勮〃鐨凷CHEMA蹇呴』鍜岀櫥闄嗙敤鎴峰悕涓鑷達(dá)紝蹇呴』鏄疍BA瑙掕壊銆?br /> <br /> 3\ 鏌ョ湅緇熻淇℃伅鏄惁瀵煎叆錛?br /> select * from ks38.fys;<br /> <br /> 4\ 鍒犻櫎鏌愬紶琛ㄧ殑緇熻淇℃伅錛?br /> exec dbms_stats.delete_table_stats(''ks38'',''tcl_cust_base_info'');<br /> <br /> 5\ 鏌ョ湅緇熻淇℃伅鏄惁琚垹闄わ細(xì)<br /> select table_name ,to_char(LAST_ANALYZED,''yyyymmdd hh24:mi:ss'') <br /> from ALL_tables where lower(table_name) LIKE ''tcl_cust_%_info%'';<br /> <br /> 6\ 瀵煎叆鍏堝墠瀵煎嚭鐨勭粺璁′俊鎭細(xì)<br /> exec dbms_stats.import_table_stats(''ks38'',''tcl_cust_base_info'',''fys'');<br /> 娉ㄦ剰錛歵cl_cust_base_info鍜宖ys閮芥槸鍦?#8217;ks38''鐢ㄦ埛涓嬬殑琛ㄣ?br /> <br /> 鍘熸枃鍦板潃錛?<a >http://database.e800.com.cn/articles/2007/819/1187467720638726675_1.html</a><br /> <img src ="http://www.tkk7.com/zl4393753/aggbug/251599.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.tkk7.com/zl4393753/" target="_blank">Neil's NoteBook</a> 2009-01-16 16:46 <a href="http://www.tkk7.com/zl4393753/archive/2009/01/16/251599.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>鍒嗘瀽鐢ㄦ埛鎵鏈夎〃涔嬪悗http://www.tkk7.com/zl4393753/archive/2009/01/16/251592.htmlNeil's NoteBookNeil's NoteBookFri, 16 Jan 2009 08:23:00 GMThttp://www.tkk7.com/zl4393753/archive/2009/01/16/251592.htmlhttp://www.tkk7.com/zl4393753/comments/251592.htmlhttp://www.tkk7.com/zl4393753/archive/2009/01/16/251592.html#Feedback0http://www.tkk7.com/zl4393753/comments/commentRss/251592.htmlhttp://www.tkk7.com/zl4393753/services/trackbacks/251592.html涓綃囪創(chuàng)瀛?/a>, 璁╂垜鎯寵搗浜屽勾澶氬墠甯埆浜哄鐞嗚繃鐨勪竴涓渚? 鏈変綅DBA瀵規(guī)煇鐢ㄦ埛涓嬬殑鎵鏈夎〃榪涜浜?jiǎn)鍒嗘?

        鍩烘湰鎯呭喌鏄? IBM P570, 16CPU, 32GB鍐呭瓨, 24GB鐨凷GA, 鏀寔涓嶄簡(jiǎn)涓涓?0G鐨?i鏁版嵁搴?OLTP綾誨瀷), 浜岀櫨涓互鍐呯殑浼?xì)璇? 鍦ㄥ垎鏋愪箣鍓岰PU鍒╃敤鐜囨槸50-70%宸﹀彸, 鍦ㄥ垎鏋愬悗鍒欎竴鐩存槸100%. 闈復(fù)榪欐牱鐨勬儏鍐靛悗, 鐢變簬娌℃湁鍋氱粺璁′俊鎭?Statistics)鐨勫浠? 鍥犳鏃犳硶鎭㈠浠ュ墠鐨勬儏鍐? 棣栧厛鍋氱殑鏄垹闄ゆ墍鏈夐潪鍒嗗尯琛ㄧ殑緇熻淇℃伅, 瀵瑰垎鍖鴻〃鍋氭洿綺劇‘鐨勭粺璁′俊鎭垎鏋? 浣夸箣榪愯浜嶳ULE鏂瑰紡, 鎯呭喌紼嶆湁濂借漿, 浣嗙敤鎴瘋繕鏄笉鑳芥帴鍙? 鐩鎬俊Oracle鐨凜BO娌℃湁閭d箞宸? 鍥犳鎬ц兘闂鐨勫叧閿茍涓嶅湪浜庣粺璁′俊鎭簡(jiǎn). 鍦ㄥ鐞嗕簡(jiǎn)浠ヤ笅鍑犱釜闂?shù)箣鍚? 鎴愬姛鍦伴檷搴曚簡(jiǎn)CPU鐨勫埄鐢ㄧ巼.

        1, 鍙戠幇綣佺儲(chǔ)鐨?strong>騫惰榪涚▼, 鍙戠幇涓涓嚑鏈夊嚑鍗丮B澶у皬鐨勮〃, 瀹冪殑騫惰搴︿笉涓?, 鍥犳瀵艱嚧浜?jiǎn)杩欎釜琛ㄤ笂鐨勪竴涓墽琛屾瘮杈冪箒鐑?chǔ)SQL閲囩敤浜?jiǎn)迤堣澶勭? 灝嗗茍琛屽害鏀規(guī)垚1鍚? CPU鍒╃敤鐜囬檷浣庝簡(jiǎn)20%, 鍩烘湰涓婃仮澶嶅埌浜?jiǎn)鍒嗘瀽鍓嶇殑姘村?

        2, 鍙戠幇涓涓悗鍙板彂紲ㄦ墦鍗扮▼搴忕殑SQL鏈夊お澶氱殑閫昏緫璇? 瀵?strong>鍙戠エ鎵撳嵃妯″紡榪涜鍒嗘瀽鍚? 寤鴻灝嗘墽琛岀箒鐜囦粠姣?0縐掓墽琛屼竴嬈¢檷搴曞埌1鍒嗛挓鎵ц涓嬈? 鍥犱負(fù)浠庡敭璐у彴鍒版墦鍗板彂紲ㄧ殑鍦版柟鍙栧彂紲ㄩ渶瑕佽蛋1鍒嗛挓宸﹀彸. 鍐嶆鏌ュ叾SQL, 鍙戠幇鍏朵腑鐨勬棩鏈熸潯浠墮粯璁ゆ槸涓ゅ勾, 涔熷氨鏄鏌ユ渶榪戜袱騫寸殑閿鍞褰? 鍐嶆壘鍑烘病鏈夋墦鍗拌繃鐨勮褰曡繘琛屽鐞? 閫氳繃璇㈤棶閿鍞漢鍛樻湁娌℃湁浜轟細(xì)鏉ヨ姹傛墦鍗頒袱鍛ㄤ互鍓嶇殑鍙戠エ, 褰撶劧鏄緢灝戠殑浜? 鍚庢潵灝嗚繖涓粯璁ょ殑鏃ユ湡鏉′歡鏀規(guī)垚浜?jiǎn)鏈榪戜竴涓湀. 鍋氫簡(jiǎn)榪欎釜鏀瑰姩鍚? 緋葷粺鐨凜PU鍒╃敤鐜囦笅闄嶅埌浜?0%.

        3, 鎺ヤ笅鏉ュ鐞嗕簡(jiǎn)涓涓簱瀛樻煡璇㈡湁鍏崇殑SQL, 瀵硅繖涓猄QL鏈韓娌℃湁浣滀換浣曚慨鏀? 鍥犱負(fù)鐢ㄦ埛鍙互鑷畾涔夋潯浠?鍔ㄦ佹瀯閫燱HERE鏉′歡)榪涜鏌ヨ, 鍙戠幇寰堝鐢ㄦ埛鍙変簡(jiǎn)鏈灝戠殑鏉′歡榪涜榪囨護(hù), 瀵艱嚧浜?jiǎn)杩欎釜SQL榪愯鏁堢巼鏋佷綆, 瑙e喅鍔炴硶灝辨槸鍩硅鍓嶅彴鐢ㄦ埛, 璁╀粬浠嬌鐢ㄨ繖涓姛鑳芥椂, 灝藉彲鑳藉湴鎻愪緵姣旇緝鍑嗙‘鐨?strong>鏌ヨ鏉′歡. 榪欐牱涓鏉? CPU鍒╃敤鐜囦笅闄嶅埌浜?5%宸﹀彸.

        4, 璋冩暣浜?jiǎn)涓浜汼QL鍚? 鏂扮殑SQL鍙堝嚭鐜頒簡(jiǎn), 榪欎竴嬈$殑闂鏄? 鐪嬭繖涓猄QL鐨勬墽琛岃鍒? 灞呯劧鐢ㄤ簡(jiǎn)INDEX鍚堝茍(Combine), 鍦╳here鏉′歡涓敤鍒頒簡(jiǎn)涓や釜鍒? 寮鍙戜漢鍛樺湪榪欎袱涓垪涓婂垎鍒緩浜?jiǎn)鐑?chǔ)寮? 浣嗕粠鍗曚釜鍒楃殑瑙掑害鏉ョ湅, 鏁堢巼涓嶉珮, 浣嗕竴緇勫悎鏁堢巼鍒欏緢楂? 鍥犳鐢?strong>澶嶅悎绱㈠紩瑙e喅姝や簨. CPU鍒╃敤鐜囧啀嬈″皬闄?%.

        5, 鍚庨潰鍙堣皟浜?jiǎn)鍑犱釜SQL, 榪欐鏄?strong>鍒涘緩浜?jiǎn)鍑犱釜鏂扮殑鐑?chǔ)寮?/strong>, CPU鐨勫埄鐢ㄧ巼宸茬粡涓嬮檷鍒頒簡(jiǎn)20-25%, 鐩爣瀹屾垚.

        鎬誨湴鏉ヨ, 鍒嗘瀽琛ㄤ粠鏉ラ兘涓嶆槸浼樺厛鑰冭檻鐨勮皟浼樻墜孌? 浠庝釜浜鴻搴︽潵鐪? 鍙湁鍙戠幇Oracle鍦ㄦ煇涓〃涓婇夋嫨浜?jiǎn)閿欒鐨勬墽琛岃鍒掑? 鎵嶄細(xì)瀵瑰崟涓〃榪涜鍒嗘瀽(鍒嗘瀽涔嬪墠鍏堝仛澶囦喚, 闄ら潪寰堢‘瀹?, 鐒跺悗瑙傚療, 鍐嶅垎鏋愪笅涓涓〃.


    鍘熸枃鍦板潃錛?nbsp;http://www.anysql.net/dba/after_analyze_whole_schema.html

    ]]>
    主站蜘蛛池模板: 亚洲日产无码中文字幕| 97无码人妻福利免费公开在线视频| 亚洲av中文无码乱人伦在线观看| 91热久久免费精品99| 亚洲视频免费观看| 老司机精品视频免费| 亚洲成A人片在线观看中文| 亚洲AV成人一区二区三区观看| 在线观看国产情趣免费视频| 亚洲乱人伦中文字幕无码| 国产男女猛烈无遮挡免费视频网站| 久久青草亚洲AV无码麻豆| 国产成人精品一区二区三区免费| 日本一道高清不卡免费| 久久亚洲国产精品一区二区| 久久精品无码精品免费专区| 可以免费观看一级毛片黄a | 无码永久免费AV网站| 一本色道久久综合亚洲精品蜜桃冫| 好吊妞788免费视频播放| 国产精品亚洲五月天高清| jjizz全部免费看片| 亚洲色无码一区二区三区| 美女视频黄的免费视频网页| 国产在线观看免费完整版中文版 | 大地资源在线资源免费观看| 亚洲欧洲日韩不卡| 国产线视频精品免费观看视频| 亚洲色大成网站www永久一区| 91精品手机国产免费| 亚洲综合色婷婷在线观看| 国产精品成人免费福利| 亚洲av成人片在线观看| 亚洲VA成无码人在线观看天堂| 男女免费观看在线爽爽爽视频 | 亚洲精品麻豆av| 久久中文字幕免费视频| 无码亚洲成a人在线观看| 亚洲国产精品久久久天堂| 精品国产呦系列在线观看免费| 免费欧洲毛片A级视频无风险|