Archiv für die Kategorie TOI
Multiple dbverify sessions accessing one large datafile in parallel
Do you use dbverify (dbv) against large datafiles to check for block corruption? Then chances are that you missed an 11gR1 New Feature: dbv can now divide one file into multiple parts and check them in parallel:
SQL> select * from v$version; BANNER -------------------------------------------------------------------------------- Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production PL/SQL Release 11.2.0.3.0 - Production CORE 11.2.0.3.0 Production TNS for Linux: Version 11.2.0.3.0 - Production NLSRTL Version 11.2.0.3.0 - Production SQL> col name for a50 SQL> select name,blocks from v$datafile; NAME BLOCKS -------------------------------------------------- ---------- /home/oracle/prima/system01.dbf 38400 /home/oracle/prima/sysaux01.dbf 25600 /home/oracle/prima/undotbs01.dbf 22912 /home/oracle/prima/users01.dbf 1280
My demo system is on 11.2.0.3, but the feature is already there in 11gR1, as the doc page here shows. See the parameters start and end there.
[oracle@uhesse1 ~]$ dbv file=/home/oracle/prima/users01.dbf start=1 end=500 DBVERIFY: Release 11.2.0.3.0 - Production on Mon Aug 20 21:59:28 2012 Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved. DBVERIFY - Verification starting : FILE = /home/oracle/prima/users01.dbf DBVERIFY - Verification complete Total Pages Examined : 500 Total Pages Processed (Data) : 11 Total Pages Failing (Data) : 0 Total Pages Processed (Index): 0 Total Pages Failing (Index): 0 Total Pages Processed (Other): 136 Total Pages Processed (Seg) : 0 Total Pages Failing (Seg) : 0 Total Pages Empty : 353 Total Pages Marked Corrupt : 0 Total Pages Influx : 0 Total Pages Encrypted : 0 Highest block SCN : 212814 (0.212814) [oracle@uhesse1 ~]$ dbv file=/home/oracle/prima/users01.dbf start=501 end=1280 DBVERIFY: Release 11.2.0.3.0 - Production on Mon Aug 20 22:10:16 2012 Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved. DBVERIFY - Verification starting : FILE = /home/oracle/prima/users01.dbf DBVERIFY - Verification complete Total Pages Examined : 780 Total Pages Processed (Data) : 0 Total Pages Failing (Data) : 0 Total Pages Processed (Index): 0 Total Pages Failing (Index): 0 Total Pages Processed (Other): 0 Total Pages Processed (Seg) : 0 Total Pages Failing (Seg) : 0 Total Pages Empty : 780 Total Pages Marked Corrupt : 0 Total Pages Influx : 0 Total Pages Encrypted : 0 Highest block SCN : 0 (0.0)
Granted, the file here is not large – but you should get the picture: I could have run the two dbv sessions from two different terminal windows in parallel as well. I realized from a recent twitter thread that this 11g New Feature that I teach since years is probably widely unknown – did you know it?
As always: Don’t believe it, test it! 🙂
Automatic Block Media Recovery in Action on Video
The little video below shows the 11gR2 New Feature Automatic Block Media Recovery in Action. I have already introduced the feature in this post, but some things are just more impressive when you actually see it happening, don’t you agree?
No Smart Scan with AUTO_SAMPLE_SIZE
During the Exadata Database Machine Admin Workshop that I deliver this week in Munich, I got the question whether the gathering of Optimizer Statistics could be done via Smart Scan on Exadata. I didn’t know that and that particular topic seems not to be covered much yet in the docs or other Blogs that I researched briefly. Therefore I came up with this little test case here:
SQL> select * from v$version;
BANNER
--------------------------------------------------------------------------------
Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production
PL/SQL Release 11.2.0.2.0 - Production
CORE 11.2.0.2.0 Production
TNS for Linux: Version 11.2.0.2.0 - Production
NLSRTL Version 11.2.0.2.0 - Production
SQL> alter session set workarea_size_policy=manual;
Session altered.
SQL> alter session set sort_area_size=1000000000;
Session altered.
SQL> create table sales as
select
'Oracle Enterprise Edition' as product,
mod(rownum,5) as channel_id,
mod(rownum,1000) as cust_id ,
5000 as amount_sold,
to_date
('01.' || lpad(to_char(mod(rownum,12)+1),2,'0') || '.2010' ,'dd.mm.yyyy')
as time_id
from dual connect by level<=1e7;
Table created.
We go on with the recommended method to gather statistics and compare that with 30 % and 100 % sample size:
SQL> connect adam/adam
Connected.
SQL> exec dbms_stats.gather_table_stats('ADAM','SALES',estimate_percent=>DBMS_STATS.AUTO_SAMPLE_SIZE)
PL/SQL procedure successfully completed.
SQL> select name,value/1024/1024 as mb from v$mystat natural join v$statname
where name='cell physical IO interconnect bytes returned by smart scan';
NAME MB
---------------------------------------------------------------- ----------
cell physical IO interconnect bytes returned by smart scan 0
SQL> exec dbms_stats.delete_table_stats('ADAM','SALES')
PL/SQL procedure successfully completed.
SQL> exec dbms_stats.gather_table_stats('ADAM','SALES',estimate_percent=>30)
PL/SQL procedure successfully completed.
SQL> select name,value/1024/1024 as mb from v$mystat natural join v$statname
where name='cell physical IO interconnect bytes returned by smart scan';
NAME MB
---------------------------------------------------------------- ----------
cell physical IO interconnect bytes returned by smart scan 0
SQL> exec dbms_stats.delete_table_stats('ADAM','SALES')
PL/SQL procedure successfully completed.
SQL> exec dbms_stats.gather_table_stats('ADAM','SALES',estimate_percent=>100)
PL/SQL procedure successfully completed.
SQL> select name,value/1024/1024 as mb from v$mystat natural join v$statname
where name='cell physical IO interconnect bytes returned by smart scan';
NAME MB
---------------------------------------------------------------- ----------
cell physical IO interconnect bytes returned by smart scan 477.690498
Conclusion: It is possible to gather Optimizer Statistics via Smart Scan, but only with a 100 % sample size. Now the question is, whether AUTO_SAMPLE_SIZE will gather statistics faster although running without Smart Scan. The quality of the resulting stats will be very similar in both cases. If you are using ESTIMATE_PERCENT < 100 presently, consider to change to AUTO_SAMPLE_SIZE or 100 % on Exadata, as this may complete faster there with Smart Scan than your non-AUTO_SAMPLE_SIZE value does. As always: Don’t believe it, test it 🙂
