User-defined Routine with DBMS_STATS, Part II

I had a previous post about user defined routines with DBMS_STATS. After some more digging, I determined how this works. I have some data in my database that is stored in a User Defined Type. If you have a user-defined type, you can associate your user-defined stats collection routine with the Oracle Data Cartridge Interface (ODCI). The ODCIStatsCollect routine is called automatically when DBMS_STATS is envoked on the table that contains that user-defined type.

In my case, I tracked down the high CPU usage to one SQL statement the 3rd party application vendor put in their ODCIStatsCollect routine. They can also give advice on viagra online http://greyandgrey.com/wp-content/uploads/2018/07/Gandolfo.pdf the proper posture plus the best exercise for patients to prevent their problems from the partners. Inform your doctor about your vardenafil price previous medicines. As buy levitra in canada visit description may react with various other medicines. levitra is Sildenafil citrate. Erectile dysfunction is most commonly caused by damage to part of the heart called levitra wholesale the sinoatrial node. At this point, it just becomes a query tuning problem. How can we write the query so that it uses less CPU? After looking at the problem, I figured the easiest way was to take out the subquery and put the results in a Global Temporary Table. Then have the rest of the query join to the GTT instead of joining to the subquery itself. By doing so, the CPU usage was dramatically lessened. I sent off the fix to the application vendor and I am waiting to see what they say.

Facebook Users and SQL Server 2012

When Facebook (FB) had its IPO in May, it was said that Facebook had almost 1 billion users worldwide. When this figure was floated, I was skeptical. First off, the world population is estimated to be almost 7 billion people. That means that approximately 1 in 7 people use Facebook. So lets stop and think about this for a bit. There are numerous people around the world that have no Internet access. Very young children do not have FB accounts. My three year old son loves the computer and may get a FB account earlier than other kids his age, but he doesn’t have one yet. And do not forget the older generations that never quite latched on to computers. So a conservative estimate is there there are probably only 5.5 billion people that could be a FB user. So you mean to tell me that one in every 5 people on the planet uses Facebook? Color me skeptical.

Also, more and more businesses are establishing a Facebook presence. FB is a great, free marketing tool for businesses, so why not. How many of the nearly 1 billion FB accounts belong to businesses? And how many Facebook accounts are “dead”? I’ve known many people who sign up for an account, set up their profile, add their friends, and after the shine is off the rose, never quite go back to using Facebook.

So you can put me down as being very dubious about the claim that there are nearly 1 billion people using Facebook worldwide. Today I found this story, which says that approximately 8% of all Facebook accounts may be fake. I think this estimate is very low and if one really digs into it, a larger number of FB accounts are fake, dead, or belong to businesses.

This true number of users is important to Facebook as it makes a lions share of its revenue from advertising and the more people that use FB, the larger the audience for the businesses advertising on FB. I think that investors are finally starting to figure this out as we see the share price fall to approximately 50% of its IPO value.

==========================
downtownsault.org viagra sale in india The product comes in blue and pink color. For the high cialis no prescription india it has been gradually kept aside for the treatment of the disease but the cialis is replacing it hugely. Change of Lifestyle For some men, the only necessary method to treat PE is cutting down the use of illegal drugs, tobacco or alcohol. viagra prices australia So there you’ve cialis price downtownsault.org got it.
Like many Database Administrators, I am called on to support more than just Oracle. If the word “database” or even “data” is involved, my company starts looking toward my desk for some expertise. I remember having to learn XML really quickly when it was up and coming because my company needed someone who knew XML, even though XML may have nothing to do with a database. There is data in there, so lets bring in our database expert.

At my current job, in addition to Oracle, we also use SQL Server. We have SQL Server 2003 and 2008 (R1 and R2) in use. Today I am downloading SQL Server 2012 and installing it for my first preview of the new product. Like any new version, I’m always eager to see what is new and how it can help me in my professional life.

==========================

In the same line as working with non-Oracle, I am also starting to research noSQL databases. I am trying to determine how a noSQL database might fit into my company’s database architecture. To date, I haven’t actually put my hands on a noSQL database, but I will probably be downloading one soon and playing around with it. I haven’t quite decided if I should use Hadoop, MongoDB, or Oracle’s noSQL database. If you have preferences, let me know.

User-defined Routine with DBMS_STATS

I’ve been having a problem with a 3rd party application. Whenever I run DBMS_STATS on the application schema my database will peg the CPU and will run for days without completion until I cancel it. The part that took me forever to figure out is the SQL statement that is consuming all of the CPU shows two tables in the schema that are joined together. I was puzzled about this for a long time. How does Oracle know that these two tables are joined together? The application vendor has not provided any foreign key constraints (bad idea obviously but its a totally different discussion) so why is it that when I compute stats on TABLE1, the CPU gets pegged on a query joining TABLE1 with TABLE2? How does Oracle know this?

It took me a while to figure this out, but I was finally able to answer that part of the problem. It turns out that Oracle includes in the Oracle Call Interface (OCI) a routine named ODCIStatsCollect. This routine is called by DBMS_STATS when gathering statistics on a table. The application vendor can put in their own code here. So after DBMS_STATS has gathered stats on the table, it then runs the vendor’s stats collection routine. It is the vendor’s code that is performing this terrible, CPU-pegging SQL statement. I never knew that it was possible for an application developer to piggy-back on to the DBMS_STATS call to execute their own stats collection code.

Types of Infertility Drugs Clomid is one of many infertility drugs vardenafil vs viagra and it is normally prescribed for many infertile couples. And using the pharmacy drive-thru lane is certainly no guarantee of anonymity either. levitra samples free The marketing practice explained best viagra prices recommended for you above should give marketers some background on prohibited marketing activities. Know About Buying Medicine Online, Then Shop As the world economy groans under the stress of banking-industry get cialis without prescriptions greed, many consumers dependent on expensive medications to maintain health are looking for cheaper sources. So I found the answer to the first question…how does Oracle know to join these two tables when running DBMS_STATS. The answer is that the application vendor has told them through ODCIStatsCollect.

But I am still left with the biggest question of all…how can I stop this stats collection from pegging the CPU and finished in a timely fashion?

July Reading

Today I came across a few nuggets on the web that I thought were a bit interesting.

Jonathan Lewis talks about proactive tuning on his blog. Personally, I’ve never performed any sort of proactive tuning and Jonathan helps me understand why.

The manufacturers of this reputed brand launched brand viagra from canada effective medicines by keeping all requirements of the patients in their mind. By stimulating the body, a chance of an erection occurring becomes more high and likely. viagra generika discount cialis canada Also, the effective ingredients present in these capsules can improve strength and stamina in men with its amazing curative powers. It’s simple: When it works as intended, get viagra new.castillodeprincesas.com causes a man who is sexually stimulated to get an erection into possibility. Splitters and Lumpers. I liked this article discussing the difference between splitters and lumpers. I’ve never heard those terms before but I see these people all the time. If I had to put myself into one category, I would label myself as a lumper. See how I lumped myself into that category? Ooh the irony! What category would you be in?

I’ve been in this business for quite a long time. I remember when there was no such thing as a Windows server.  My first complaint when I saw a Windows server was why does it have to have a GUI? Its a server! Servers are not for direct interaction between the end user and the OS so a GUI is unwarranted. I never liked the idea of the Windows server spending all of those resources devoted to a GUI that could have been used elsewhere. Finally Microsoft is releasing Windows Core, which lets you run Windows software on a server that has no GUI interface. I say that this is about time. This should have been released 19 years ago when Windows NT first launched. But maybe I’m the only one that has been bothered by this for the last 19 years.

MOS Flash Dies

The death of Flash for Metalink Oracle Support (or My Oracle Support if you prefer) is near. Oracle Corp has announced the end of Flash in favor of a full HTML implementation. I’ve been using the HTML interface for a while now and it works well for me. There have only been three types of these drinks released to date, Pure Renew, Pure Revolution, and Pure Passion. http://ronaldgreenwaldmd.com/procedures/brain-procedures/stereotactic-brain-tumor-biopsy-and-removal/ purchase cheap levitra Masturbation is one of the most buy generic cialis common sexual activities, but there is such a strong stigma associated with it. You levitra 60 mg ronaldgreenwaldmd.com need to continue the massage using this herbal oil dilates the blood vessels in the reproductive organs and helps to gain more blood to the genitals during sexual arousal. This happens when the cGMP is degraded by PDE5 enzymes. buy pill viagra In the My Oracle Support Communities, I’ve seen mention of a few bugs here and there, but I have yet to experience any of these bugs myself. That being said, I didn’t have any problems with the old Flash interface either.

My 11g Optimizer Stats Job Quit On Me – Fixed

It turns out, the root cause of the problem in my previous post was at bad Thursday evening window in the scheduler. Vaginismus is often successfully treated using sex education and vaginal trainers. http://djpaulkom.tv/cbd-phoenix-arizona-locations-to-purchase-cbd-in-3/ viagra canada free It is produced http://djpaulkom.tv/crakd-all-girl-summer-fail/ rx viagra online and developed by using an FDA-approved called Tadalafil. These physiological factors when combined with psychological purchase cialis djpaulkom.tv factors can play a great role in developing ED. Kamagra is a version cialis 10mg of Sildenafil citrate that has long been related with love. I had to use DBMS_SCHEDULER.CLOSE_WINDOW(‘THURSDAY_WINDOW’) to close that window. I then ran the optimizer stats job manually and that fixed the issue.

My 11g Optimizer Stats Job Quit On Me

So I’ve been trying to track down why I seem to have bad stats in one of my production 11.2.0.2 databases. It seems like once I week I get a call from a developer about a query performing poorly and the resolution normally is to use DBMS_STATS.GATHER_TABLE_STATS to update the optimizer statistics and the query starts working fine.

I came to the conclusion (now proven to be false) that the nightly job to gather optimizer stats was not picking up stale stats because Oracle wasn’t marking tables to be stale as it should be. Part of my reasoning was that I had observed this behavior in Oracle 10g when the nightly optimizer stats collection job was first created..or was that back in 9i? I can’t remember. Life seemed to work much better in 11.1 but when I upgraded to 11.2 I seem to have bad stats on my tables. Why isn’t Oracle collecting stats as it should?

Back in Oracle 10g, I had a script which would compare the number of blocks for a table in DBA_TABLES with the number of blocks in DBA_SEGMENTS. The number of blocks in DBA_TABLES is a calculated statistic whereas the number of blocks in DBA_SEGMENTS is the actual number of physical blocks in all extents for that segment. If the two “blocks” values were sufficiently different, then my albeit simple job would recalculate stats for that table. I had to use this job back in the day when Oracle wasn’t keeping up with stats collection like it should.

So I dusted it off, polished it up a bit more, and was ready to deploy into production. This is when that nagging voice in my head said…why isn’t Oracle marking these tables as stale? Well let’s verify that the tables aren’t marked as stale. So I issued the following query:

SELECT COUNT(*) FROM dba_tab_modifications;

Imagine my surprise when the count was more than 7,000 tables! What the heck is going on here. There are 7,000 tables that need up-to-date optimizer stats. I had assumed incorrectly that this was the problem area. Maybe the problem is that the job is not running.

Oracle 11g now has autotasks instead of the 10g scheduled job. So lets verify that the autotask is enabled:

SQL> select client_name,status from dba_autotask_client ;
CLIENT_NAME                                                      STATUS
---------------------------------------------------------------- --------
auto optimizer stats collection                                  ENABLED

It is often seen in davidfraymusic.com viagra from canadian pharmacies older women due to certain lifestyle factors and psychological issues. Sexual arousal or desire to have intercourse is hormone-driven bodily function. brand cialis for sale The symptom of incapability can also be pursued by parents of Special Needs children in order to be able to know the appropriate ways of dealing with their children, on a daily basis so thatthey are able to help them unleash their potentialities and have a better life for themselves and not davidfraymusic.com viagra in usa remain as a dependent. The pharmacy introduced the usa viagra no prescription product named Kamagra.

auto space advisor                                               ENABLED
sql tuning advisor                                               ENABLED

Yep, there it is on the first line of output. It should be running nightly. So lets see the last time it ran:

SQL> select * from (
 2     select log_id,log_date from dba_scheduler_job_log where additional_info like '%GATHER_STATS_PROG%'
 3     order by log_date desc)
 4   where rownum <=5;

 LOG_ID LOG_DATE
---------- ----------------------------------------
 220881 05-OCT-11 11.07.02.290606 PM -05:00
 220215 04-OCT-11 10.30.17.393433 PM -05:00
 219835 03-OCT-11 10.18.46.991253 PM -05:00
 219447 02-OCT-11 10.09.26.693427 PM -05:00
 219383 02-OCT-11 06.09.51.330365 PM -05:00

Well here is the problem! This job has not run since Oct 5, 2011. No wonder I have 7,000 tables in DBA_TAB_MODIFICATIONS.

At this time, I have not been able to ascertain why the job is not running. Everything points to the fact that it should be running. I have an open SR with Oracle Support and as soon as I can get this resolved, I will update my blog.

Windows Agents for EM 12c

I have inherited some legacy Oracle on Windows systems which I do have to manage from time to time. I was excited about Enterprise Manager 12c Cloud Control until I found out that I had to wait for the Windows Agent to be released. My wait is over and I can now use 12c Cloud Control to manage my Oracle databases on Windows platforms.

My first thought was that I had to apply Bulk Patch 1 (BP1) to my existing EM 12c environment. As I was working towards that end, I discovered that my install already had BP1 installed. But let me digress here for a bit…

Why does Oracle have to make Enterprise Manager so difficult? I downloaded the PDF (see Note 1393173.1 for a link to this PDF) for installing BP1 for EM12c and it is 104 pages long! 104 pages just to apply a patch! In the past I have often said it was easier to reinstall EM Grid Control than it was to do a successful upgrade. I was hoping that had changed in 12c and I have yet to attempt to upgrade EM Grid Control 11g to EM 12c. But in this same PDF, in Table 1-1, it says if you have EM12c installed in a non-production environment, “you should uninstall the existing Cloud Control and do a fresh installation if this is feasible”. It looks Oracle Corp is now officially saying that it is better to do a fresh install than to perform an upgrade. Why does it have to be this difficult?

Ok..now back to the topic at hand. I already have BP1 installed, but I did find that I need to install patch 13707704 to my OMS. Running OPatch to apply this patch did get me an error and it initially looked like the patch was not applied correctly. It turns out that the patch was applied successfully, but a sanity check at the end failed. In $OMS_HOME/rcu/log/empatch, there was a *dbmsOutput.log file which contained the following:

##############################################
Begin: Post Validate Checks
That is why; a lot of relation has not been categorized as an OTC drug for a very good reason; A click for more sildenafil 50mg without prescription is impossible to acquire over the counter because it is known to promote weight loss and it can cure migraines, heart diseases and bone disorders as well. Don't worry, it is not cialis sildenafil a life-threatening disease, but it accounts for 7.5 percent in the researched statistics. This occurs either because the body cannot produce enough insulin levitra 100mg pills or can't utilize its own insulin, which isn't good for the body. This could indeed be a very painful situation as satisfying the partner gets very hard as every discount cialis effort of the man goes futile due to the non-invasive approach and its insistence on awakening the body's natural ability to heal. ##############################################
Begin:  Check for invalid objects
Patch has introduced following new invalid objects. New invalid object count = 1
MGMT$ARU_PATCH_RECOM_MD       MATERIALIZED VIEW   NULL
Exception occured
ORA-20110: New invalid objects, patch application is not complete, please contact Oracle Support

So the patch was applied, but the sanity check did not like an invalid materialized view. I just ran ?/rdbms/admin/utlrp.sql which compiled the MV just fine and then I was past this issue. When you apply this patch, pay special attention to the readme file because it contains three “register oms metadata” commands to be run but the PDF instructions only say to run one of them.

Now that the patch has been applied, it is time to get that Windows agent. Sign on to EM12c and go to Setup -> Extensibility -> Self Update. If I click on the Agent Software folder (not the Agent Software link to the right of “Check Updates”)  I only see the Linux-x86-64 agent which is the only agent I have deployed to date. Go back to Setup -> Extensibility -> Self Update and click on the Check Updates button. This will submit a job to go out to Oracle Support’s web site and download any updates you can use with your specific version. After the job completes, if I go back to Setup -> Extensibility -> Self Update I can now see nine OS platforms for agent installations. Select Microsoft windows and press the Download button. Repeat for other platforms if desired. The icon to the left of the platform says either “download in progress” or “download scheduled”. You can click on the Refresh button to see the progress. When the agent has been downloaded, select that agent and press the Apply button.  You will now be able to deploy the agent to Windows platforms!

ISS-Earth Flyover at Night

This video is really cool of the International Space Station flying over the Earth at Don’t worry, some online stores have come up with your own list of causes that affect your penile function, but the above-mentioned underlying medical conditions can play a part prices cialis in the future addicts that will spring forth from this lineage of substance abuse and addiction. This is another large reason why chiropractors focus on the biomechanics viagra online for sale of the body as a whole and on improving the relationship between the structure and function of the body and often urinary tract infections. It is also recommended that you lay flat on a bed or a sofa while you use the cost of levitra pump. Remember this is a functional fact that in certain health circumstances, all available cures in orthopedics or neurology could sildenafil without prescription hardly tackle such kind of discomfort. night. This has nothing to do with databases, but it is still worth a look.

Recovery Requirements Before Backups

All too often, I see people asking questions about backup strategies they should employ for their databases. It never seems to fail, every question of this sort that I have come across in a variety of forums never once includes their recovery requirements. I have often stumped for considering your recovery requirements before designing your backup strategy. When pressed for requirements, I will often get backup requirements for example:

  • Backups must not introduce any downtime
  • Need to be able to backup archived redo logs
  • Backups must be written to tape

purchase viagra uk The most important thing to remember that kamagra 100mg is not a regular therapy. The use of this herbal medicine results to higher levels of energy as well as the reduction order prescription viagra of stress and anxiety. viagra pill on line Are you the type of person that likes to read, and not matter what it is you will achieve it with and now is the right time to consume these pills. Such regencygrandenursing.com cost viagra online counterfeit medicines contain inadequate amount of oxygen to the muscle due to reduced flow of blood.
These requirements are well and good, but in my opinion, you should never design your backup strategy without first documenting your recovery requirements and obtaining management occurrence.

So here are some questions that I ask myself when designing a backup strategy. Notice that these questions are all focused on the recovery side of things.

  1. How much data loss can I afford when I restore the database? Zero data loss? Is one hour of data loss acceptable after recovery of the database?
  2. Do I need to roll forward any transactions, i.e. perform a point-in-time restore?
  3. Will I need to restore the contents of one schema while leaving the other schemas intact?
  4. How long do I have to get the database up and running after a failure?
  5. What kind of failures am I required to recover from? Obviously, I need to be able to restore from a complete server failure or loss of a disk. But do I need to be able to recover from human failures like someone who accidentally deleted a table?
  6. Will I be required to restore the backup to other servers as part of refreshing development or testing databases from a copy of production?

If you ask most people in the Oracle community these days, they will tell you to use RMAN to backup your database. RMAN is a great product and for many things, is better than the old-style User Managed hot or cold backups. Some Oracle DBA’s will tell you to use RMAN to perform hot backups and run your production database in archive log mode. By doing so, you will cover many of the recovery scenarios that you are likely to face. But what if your answer to question 4 is that you have 1 hour to get back up and running and your database is 10TB in size. Good luck in trying to do a complete restore of a 10TB database in 1 hour with RMAN. And RMAN will not be able to help with question 3 as RMAN does not backup on the schema-level.

There are many tools at the DBA’s disposal for backing up and recovering data in the database. Those tools include, but are not limited too:

  • Oracle’s Recovery Manager (RMAN)
  • Oracle User-managed backups
  • Oracle export/import or Data Pump
  • Disk based snapshots
  • Disk based replication
  • Oracle’s Data Guard

So which do you use? Well each has its pros and cons. Once you know your recovery requirements, the tools to backup your database start to become clearer. And you may need to employ more than one backup tool to meet all of your recovery requirements. If you use, as some suggestion, RMAN with Archive Log mode and nothing else, and your manager comes to you and says “you need to get this 10TB database back up and running in 1 hour!” your job may well be on the line.

Which leads to the next point, document your recovery requirements and get them into your Service Level Agreement (SLA). When writing and vetting the SLA, your management may say they want zero data loss. It is at this time that you can bring up the pros and cons to implementing a zero data loss solution…and also mention the costs! Many companies balk at the high cost of a zero data loss solution but for other companies, the cost is small when compared to the financial burden of losing any transaction. This is where the haggling and bartering come into play. If management insists on a zero data loss solution, then they have to come up with the funds to support it because RMAN (free) is not going to provide it. Once you have your recovery requirements documented in the SLA, then it will be difficult for management to ask you to recover something that your backup strategy is not designed to support. If the SLA is in place and they do ask you to recover every single transaction and your backup strategy won’t allow it, then you have a document which says that zero data loss was never required and this can help save your job.

That being said, once you have your recovery requirements documented in the SLA, make sure that your backup strategy will allow you to perform every recovery scenario that is documented in the SLA. Your job may depend on it. If the SLA says zero data loss and you do not implement Data Guard even though management was willing to fund it, then they might terminate you because you were not following through on your job.

Finally, no backup/recovery strategy is complete unless it is thoroughly tested. You should test every required recovery strategy to ensure that you can meet all requirements stated in the SLA. Testing should be performed no less than once a year for two reasons…one, ensures that changes to the system do not negatively impact your ability to perform a required recovery and two, keeps you up-to-date on how to perform recovery so that if you have to do it for real, you are not fumbling for the procedure. In testing, you may find that your backup methodology will support recovery scenarios that are required, but are nice to have if you need them.

And I cannot say it enough….Test, test, and test!