Advertisement

Monday, November 30, 2015

Oracle Database 12c - Statistics Gather Reporting

 
Database 12c came up with a brilliant feature of reporting of stats, i.e, you can run stats gather in reporting mode, rather than just running it. 

This will tell you on what all tables statistics are going to be gathered when you run your stats gather procedure with specific arguments. 

6 new procedures introduced for this
dbms_stats.report_gather_?_stats
where ? can be any of - Table, schema, dictionary, database, fixed_obj, auto

All the arguments to gather_stats procedure are valid and 2 new arguments introduced which are - 

1. detail_level - basic, typical, and all; depending on the type of details. typical is the deafult value
2. format - xml, html, and text. Text is the default value (I personally prefer html)

Below is an example of getting details of getting schema stats gather.



SQL> variable report_out clob;
SQL> set long 10000000
SQL> exec :report_out:=DBMS_STATS.REPORT_GATHER_SCHEMA_STATS ( ownname => 'MY_SCHEMA', -
                                    estimate_percent => 30, -
                                    method_opt => 'FOR ALL COLUMNS SIZE AUTO', -
                                    granularity => 'ALL', -
                                    cascade => TRUE, -
   detail_level => 'ALL', -
   format => 'HTML');
SQL> spool /tmp/stats_report.html
SQL> print report_out
..

Below is a screenshot from the html file output.  I have truncated the output and kept screenshot of only relevant data to this discussion. 




As is clear from the screenshot, we get a picture on what all tables the stats gather will take place. 
This is a really good feature, helping in developing a good stats gather technique.. 



Tuesday, November 3, 2015

Exadata - ExaWatcher configuration

 
Exawatcher is the elder brother or say sibling to OSWatcher on Exadata. It has additional diagnostics options for RDS logs/diags which are specific to Exadata only.

In this blog we see how to change the destination and the total available size for Exawatcher Logs.

I can wrap it up in 3 steps
1. Change the config
2. Stop Exawatcher
3. Start Exawatcher

Pretty neat !!

Now let's do it 

You cd to opt/oracle.ExaWatcher/archive and edit the file ExaWatcher.conf

Look for the below section precisely (it is the first section generally)
.
.
.
<ResultDir> /opt/oracle.ExaWatcher/archive
<ZipOption> bzip2
<SpaceLimit> 6047
.
.
Parameters we are looking for are ResultDir and Space Limit. 

Above is the default configuration (for X5 ODA, generally is similar for all versions of Exa Hardware)

Next we edit this to our own mount point and custom size so that it looks something like 

[root@Myexadata01 oracle.ExaWatcher]# cat ExaWatcher.conf | grep -E 'Result|Space' | tail -2
<ResultDir>  /mymount/Myexadata01
<SpaceLimit> 40960

What I have done here is redirected the output to a NAS device and then increased the space available. With all defaults 40960 should be good for around 40-45 days and Exawatcher will not clean it

On a side note cleaning of the logs is done by exawatcher script only, on the logic that it wipes clean data if mount on which it is writing is 80% or more utilized.

Okay, coming back now all we need to do is stop and start. 
We are still in the /opt/oracle.ExaWatcher directory

[root@Myexadata01 oracle.ExaWatcher]# ./ExaWatcher.sh --stop
 41500 ?        SN     0:00 /bin/bash ./ExaWatcher.sh --fromconf
[INFO     ] ExaWatcher successfully terminated!

so --stop does the stop, but starting is bit different, Below is how to start


[root@Myexadata01 oracle.ExaWatcher]# /opt/oracle.cellos/validations/bin/vldrun.pl -script oswatcher
Logging started to /var/log/cellos/validations.log
Command line is /opt/oracle.cellos/validations/bin/vldrun.pl -script oswatcher
Run validation oswatcher - PASSED


Wait for a a minute or so and Exawatcher will come up, you can see check out the status using ps utility. I have taken out one line to highlight the difference.

ps -ef | grep -i exaw

sh -c /usr/bin/vmstat  5  2 >> /mymount/Myexadata01/Vmstat.ExaWatcher/2015_11_03_04_14_00_VmstatExaWatcher_Myexadata01.mydomain