Quantcast
Channel: Peasland Database Blog
Viewing all 106 articles
Browse latest View live

ORA-16789: standby redo logs configured incorrectly

$
0
0

The DG Broker is reporting some warnings for one of my databases in the Broker configuration.

 

DGMGRL> show database orcl

Database - orcl

Role: PRIMARY
 Intended State: TRANSPORT-ON
 Instance(s):
 orcl1
 orcl2
 orcl3
 orcl4
 orcl5
 orcl6
 orcl7

Database Warning(s):
 ORA-16789: standby redo logs configured incorrectly
 ORA-16789: standby redo logs configured incorrectly
 ORA-16789: standby redo logs configured incorrectly
 ORA-16789: standby redo logs configured incorrectly
 ORA-16789: standby redo logs configured incorrectly
 ORA-16789: standby redo logs configured incorrectly
 ORA-16789: standby redo logs configured incorrectly

Database Status:
WARNING

 

If these warnings were seen in the standby database, the most common reason is that the Standby Redo Logs are smaller than the primary’s Online Redo Logs. But note in the above output, this is from the primary database.

 

The reason for these warnings is quite simple…my primary does not have any SRL groups. Once I added the SRL groups, the warnings went away.


Yet Another Reason To Upgrade

$
0
0

As I usually do, I fire up lots of questions on the MOSC and OTN forums and pick and choose which ones I want to answer. This morning, I came across a post from a user who was asking questions about Oracle 9i. As expected, this user got the anticipated responses from the forum faithful about how old/ancient their Oracle version is and they should upgrade to a much more recent version.

Like others, I have written articles about reasons why you should upgrade. Here is one such article I wrote for SearchOracle.com:  Top Reasons To Do An Oracle Upgrade

The article above is not ground breaking and you can certainly find alternative examples from other authors as well. But in reading this forum post, it struck me that there is yet another reason to upgrade your Oracle database that I have yet to see anyone write about. That reason is:

I cannot remember the details about your very old version any more!!!

This morning’s forum discussion was referencing 9i. I haven’t used Oracle 9i since I upgraded everything to 10.2. Oracle 10.2 was released in July 2005. I do not have accurate documentation going back that far but I’m pretty confident I was running 10.2 across the board by July 2006, more than 10 years ago!

Technology changes and the pace of change is fast. I cannot be expected to remember all the intimate details of Oracle 9i (any of its versions), a version I have not used in 10 years or more. Now if you are asking me a question that is still relevant in today’s supported versions, then I can certainly provide an answer. But if the details of your answer are not applicable to today’s 11.2 or 12c versions, then I’m sorry but I cannot adequately answer your question.

In addition, I am not going to find the 9i documentation to cite in any response to your question. If I go to http://docs.oracle.com to look up something I may need to help answer your question, it gives me versions 11.2 and higher. I can choose Earler Versions, but my feeling is if you are too lazy to upgrade your database, then I’m going to be too lazy to go through that extra step of finding your version’s documentation. Another step I am unwilling to take is to download and install the old version and create a database so that I can attempt to reproduce your problem. If I cannot reproduce your issue in one of my current versions, then the answer is obvious…upgrade to resolve your issue.

The bottom line is to upgrade to a more recent version so that you can enjoy obtaining help on whichever forums you post your questions to.I’m not the only one that answers questions on MOSC/OTN but I’m also not the only one that feels this way.

Stay current with your versions so that you can interact with your peers no matter how you discuss Oracle.

The Performance Tuning Maze

$
0
0

One day, you wake up and find that you are an Oracle database administrator. The gods have finally seen the light to your true potential and allowed you to work in the best job in the world! You begin your DBA career so bright-eyed and bushy-tailed. You’re creating new databases, granting privileges, writing PL/SQL code. Life is great. You cannot wait to get up in the morning, pour that first cup of coffee, and point your browser to your favorite Oracle forums, eager to soak up a lifetime’s worth of knowledge all before lunch! If those gods are still smiling on you, you may even answer a few questions and get rewarded with awesome points. Life is good. Life is sweet.

While you are still basking in the glow of your new-found career, someone comes to  you with a problem. A performance problem. You freeze. There’s a small lump in your throat as you come to the self-realization you have no idea how to solve database performance problems. What you did not realize on that day is that every DBA before you has been in exactly this same situation early in their careers. Yet, it doesn’t stop the other person from looking at you wondering why you are not solving the performance issue immediately. After all, you are the DBA and you should know how to do this stuff. This magical stuff they call (cue the angels singing) Performance Tuning. For it has been written, if you are going to be a DBA and survive, and do this job well, you will have to tune performance. Others will never know what goes on behind the curtain as you make potions and cast spells. All they care about is that you solved their performance issue and they can get on with their daily work.

At this point early in their career, every DBA decides they need to learn more about this thing they call Performance Tuning. What is it? How do I do it? How can I become the most important person in my IT department because I discovered the secret sauce to turn that 5 hour report into a 1 minute miracle?

Oh, we were so young back then…so naive. We thought it was easy. Push a few buttons, fire up a few tools and presto. The performance tuning solution is found and we are wonderful! Life seemed so easy as we ventured down that yellow brick road. But on this road, there are no scare crows. No lions. No tin men. Not even any cute little dogs named Toto. No…this road….this Oracle Performance Tuning road is filled with things much greater. On this road, we meet utilities and tools. We meet Explain Plan. We meet tkprof and SQLT. We find wonderful views like V$SGA_TARGET_ADVICE and V$SESSION_WAIT and its twin V$SESSION_EVENT (not identical twins mind you, but one look and you know they’re related).

So there you are. Your shiny DBA title still sitting under your name in every email signature you send. And you now have all of these wonderful tools at your disposal. You’ve picked up ASH and AWR because thankfully your company has gifted you the Diagnostics Pack. Your bookshelf is armed with great tomes like this one. (Shameless plug I know). Some great guy on the forums, like me, clued you in to Lighty. You have an entire toolbox at your disposal. No! Not toolbox….warchest! Small countries in other places in the world do not have the arsenal you have at your disposal. Why…I could touch that super-secret button in the SQL Tuning Advisor and blow away one of those countries, *and* make SQL ID 98byz76pkyql run faster while my coffee still has steam rising from it…I’m so good.

Remember that day you received your first performance issue and you had that lump in your throat? There’s another day like that in your DBA career. Its the day you reach the Performance Tuning Maze (cue the thunder and lightning). But this isn’t any maze. This is different. Most mazes have one entrance and one exit, with many turns and decisions along the way. This maze, why, this maze is obviously different. This maze has many, many entrances. And this maze has many, many exits. Each entrance is a different performance tuning tool. And each exit is a solution, but not all solution’s really solve the performance problem. And this is the conundrum Oracle performance tuning specialists face. I have a performance problem. I know on the other side of this maze is my solution. But which entrance do I choose? One entrance has Explain Plan written above it. Another entrance has V$DB_CACHE_ADVICE written on it. Why there are all these entrances, one for each tool at my disposal. This is a tale of my youth and hopefully, as Bilbo wrote to Frodo, this story can help you in your adventures as well.

So I pick an entrance.

I enter the maze.

Did I make a good choice?

Well let’s see where this goes. Up ahead, the road makes a left turn. But its my only choice so I go with it. Next, I come to an intersection. I can go right or left. I make a right turn. Oops…dead end. So I backtrack and take that left instead. Another dead end. Drats. I entered the maze incorrectly. Sometimes, the tools do not lead you to any solution. So I go back to the entrances and make another choice, chose a different tool.

I’ve now entered the maze a second time. But things are looking much better. I keep going. Just a few more turns. I can see light so I know I’m getting close to the end. Yes…there it is, the exit. I finally come out the other side of the maze. I have my performance tuning solution in hand but after I implement the solution, I quickly realize this did not solve my performance problem at all. Sometimes, tools can lead you to solutions that have no bearing on your specific problem. So its time for my third entrance into the maze.

Now, being an astute performance tuning specialist, I realized all they entrances I chose so far are related to overall database performance but what I’m really looking for is performance related to a specific SQL statement. But I do not know which SQL statement needs tuning. How can I figure out which one? Well three doors down is an entrance to the maze marked SQL Trace. Right next to it is a door marked EM Search Sessions. I flip a coin and choose SQL Trace. Shortly after I enter the maze, I come to a T-intersection. If I go left, it takes me back to the EM Search Sessions door. If I go right, its a straight shot to the exit. Naturally I go right. But it is at this moment that I know that sometimes, two different tools will lead you to the same answer. As I exit the maze I am given a free pass to tkprof because after all, don’t all SQL Trace roads lead straight to tkprof? I now have the offending SQL statement. But my problem isn’t solved yet. What to do?

I head back to the maze entrance. Sometimes, we get an answer from our tuning tools and we have to perform another run through the maze to drill down into the final answer. This time, I enter the SQLT door. A few twists and turns, but this maze path is pretty easy, or so it seems. I get to the end, and I not only have one answer, I have many answers. Oh…glorious day! I have found the mother of all tools.

I heard other DBAs speak of these miracle tools like SQLT and AWR Reports. How wonderful they are. These tools are so great, some DBAs only see the SQLT and AWR Report entrances.  I always thought this was stuff of legends, but here at last, I too have found the one tool to rule them all…ok…one for each hand. I have all of these answers at my disposal. Now which answer is directly related to my performance issue. Here I have my SQLT report and I have all these answers contained therein. Which answer is mine. Which one?!?!? Sometimes, tools will give you too much information. For me, who is new this this performance tuning thing, the output of SQLT might as well be written in Klingon. But lucky me, I know a fellow DBA that sits two cubes down from me that speaks Klingon. I hand him my SQLT output. He thumbs through it and within 30 seconds, he points out one tiny section of the report and says those magical words. “See…right there…that’s your problem.” With a quizzical look on my face, he waves his hand over the report and as if by magic, Google Translate has changed a few words on the page and I can now clearly see I have a table with very bad stats. Sometimes, tools with all those answers are great time savers for those that know how to use them. This Klingon speaking DBA pushes up his glasses and reveals another section of the SQLT report. “See here he says…those bad stats are forcing a FTS” as if I’m supposed to know what an FTS is at this point in my career. But I don’t want to seem like a total n00b so I smile and nod in agreement.

Ok…I’m getting closer to solving my problem. I know I have bad stats. I’m heading back to my desk eager to get to work to finally solve my problem. As I pass by the water cooler and go around the ever-present throng of my coworkers with nothing better to do all day but chat, the sun shines off one door to the maze and catches the corner of my eye…just one door. Above that door is a sign that says DBA_TABLES. Well like any good DBA, I say to myself that its not a bad idea to double check these things. Begin drawn to it, I enter the DBA_TABLES door and am once again in the maze. I make a quick turn and something jumps out at me as if to startle me. But I’m becoming good at this. I don’t care that some little maze dweller insists on telling me this table resides in tablespace USERS. I am quick to know that this makes no difference to my issue at hand. I push on and ignore all of these little imps with their spurious information. I press on. And there I have it…confirmation at the maze exit that there are no stats on this table. A quick lesson was learned here, sometimes, the tools will give you information that isn’t relevant to you on this day.

I may be new at this DBA game, but I do know this. I need to see how things are performing now, make a change, and measure the performance improvement if any. So I head back to the maze. This time, I enter the door marked SQL Developer Autotrace and I execute the offending SQL statement. I not only get the runtime of the SQL statement but I can see the number of reads and the execution plan. I quickly update the stats on the table my Klingon-speaking friend pointed out to me. (quick aside…I used to think he was a jerk but now he’s not so bad. I can learn from this guy. Maybe one day I too can speak Klingon). Then I enter the SQL Developer Autotrace door again. Not only did my query executing go from 2 minutes of execution down to 2 seconds, but reads dropped significantly and the Explain Plan improved. Ok, that last part is a bit of a stretch. I’m still too green to know the Explain Plan was better but looking back on it later in my career I know it was. I quickly learn that sometimes, the performance tuning tools are my disposal are not only there to help find the root cause of the problem, but are also there to confirm the solution actually fixed the problem. And sometimes, the tools to confirm the results are not the tools I used to find the root cause. 

I quickly informed my end user that the issue is resolved. The user grumbles something I couldn’t quite make out and checks to see if his life is actually better. And that’s when I receive it. The greatest gift a DBA could ever receive. That’s right… I received user adoration. Today, I am a miracle worker or so the user thinks.  As I am standing in this user’s cubical he shouts out “HE FIXED IT” and on cue, the entire department’s head pop up over the cubical walls like gophers out of the ground. Hurray..they cheer! I am loving life basking in the glow. Why the boss even offers to take us out to the pub after work..first round is on her.

I walk back to my desk, eager to take on the next challenge. This job could not be any sweeter.

I remember my first encounters with this Performance Tuning Maze as if it were yesterday. When we were joking over pints at the pub that night, I dared not speak of some of the things I saw in that maze. My coworkers wouldn’t understand anyway. I never tell anyone of my fights with the MOS dragons. I’ve been burned too many times. I never tell anyone how boring it is to run a query, wait an hour for a result, try again, wait for an hour, try again, wait for an hour..oops..I dozed off there. The trials and tribulations of my youth are better saved for another time. Maybe I’ll write another book.

But I learned a lot back in those days. Over time, I became better and choosing the best entrance to the maze for the problem at hand. After all, it is only with experience that one can get better with these magical performance tuning elixirs. I’ve also learned that sometimes, one tool seems to be the correct one for the job only to discover part way through the tuning effort that another tool is better suited.

I’ve also learned that it is only working with the tools and learning what they are good at and conversely what they are not good at, that I can best choose the appropriate tool for the job. Back in the day, If often felt like I was trying to pound a screw in with a hammer. Now I see a screw and know the best tool is a screwdriver.

Over time, I’ve grown the number of entrances to my performance tuning maze. I still go through the tried and true doors like with one with just a number above it, 10046. In the past, I’ve been told about magical doors that led to rainbows and unicorns only to discover yet one more grumpy old troll under a bridge. I was skeptical about Lighty being such a magical tool in the beginning, but I was wrong about that one.

Oh the tales I could tell you, but this story is really about that Performance Tuning Maze. It always comes down to that maze. Choose the best door possible, but only experience can tell you which one is best. That will let you arrive at your solution the quickest. Make a wrong turn and start over. Don’t be afraid to enter the maze multiple times. When you think you have the solution, go through the maze to verify. This magical Performance Tuning Maze with all of those wonder Oracle performance tuning utilities and tools has now become one of my favorite places to hang out. I like to add more entrances all the time, hoping that each new tool will lead me to the end of the maze much faster. Sometimes they do and sometimes they don’t.

I still remember the days when I used to hang out in the old “ratio-based tuning” maze, but I’ve moved on to greener pastures. I still chuckle when I see some new DBA standing in front of that old maze, covered in spider webs and they just can’t take the hint. And then I get cranky when I yell at them to forget about that maze and come over here where everyone else is hanging out, only to be spurned by someone who thinks they know better. Well if we ever see them again, we can say “I told you so” and have a good laugh.

I often work with people who see me using some of these shiny tools. They watch me enter the maze and come out the other side with the answer. So their obvious next question is “can I go in that door too?” I chuckle. “Sure…go right ahead”, I tell them. Armed with this cool tuning tool, but zero knowledge on how to tune Oracle, they make a pretty good, but feeble attempt. They call me over to the maze and ask me to help them solve the problem. So we fire up the tool and look at it. I instantly recognize the root cause of the issue, but the tool’s shiny bells and whistles are confusing the neophyte. At this point, I’m now speaking Klingon. Within seconds I say “See…right there…that’s your problem.” and I get back that same quizzical look I provided to my DBA mentor so many years ago. These novices always want access to the tools and think they can wield them like a master. They have no clue what is in the maze nor any clue how to navigate it. Too many people think the tools are the secret sauce when its really the person wielding the tool. Sadly, some people with access to the tools just want a quick and easy answer. They don’t want to put the time in like so many of us.

Time, time to follow the masters. We all have our version of Mt Rushmore. Carved in stone. People like Millsap, Lewis, and Shallahammer to name a few. Your Mt Rushmore may have other names or even similar ones. Others who view our Mt Rushmore, all set in stone, do not realize these fine people were our guides in the maze. They showed us how to navigate the maze. They showed us how to use the tools and which tools to use when. Those of us who learned from the masters try our level best to pay it forward and teach others, although we may never achieve such lofty heights, and that’s ok.

The moral of the story is to learn these tools, learn what they do and what they don’t do. Learn which problems they help tackle. Leverage the tools, but realize that you need to learn as much as you can so that you to can walk the maze with confidence. Sadly, I have to end my story here. Someone just came into my office with another performance tuning problem. Time to enter the maze again. Now which door do I take?

 

Filtering Alert Logs in EM13c

$
0
0

I’ve been receiving ORA-1555 (snapshot too old) alerts from my databases via Enterprise Manager 13c. For production environments, these are good alerts to receive and can be an indicator that I have an issue to resolve. For my development databases, ORA-1555 errors are not a concern of mine. It is common for developers to write queries that run a long time and then tune them later on. I do not want to see alerts on ORA-1555 errors in my Inbox from dev databases. Yet EM13c does not have an obvious way to stop these alerts from coming. I recently learned that one can filter out rows of the Alert Log from EM13c’s notification functionality, thus supressing any ORA-1555 alerts from being generated.
To do this, log in to EM13c and navigate to the database in question (or update a template). Then click on Oracle Database –> Monitoring –> Metric and Collection Settings.  In the DB Alert Log section is Generic Alert Log Error. Press the pencils icon on the right for this line to edit the settings.

Scroll down to the very bottom of the next page. In the section titled Metric Collection Properties, there is one box labelled Alert Log Filter Expression. This box is a regular expression. Any lines in the Alert Log that match the regex will be filtered out from consideration. As you can see below, I added the “01555” error code.

 

Not only can you filter out any ORA-1555 errors, but you can see others that can be filtered out as well.

 

 

RU or RUR?

$
0
0

Oracle 12.2 has changed the patches. It used to be so easy back in the day. Just download the Cumulative Patch Update (CPU) and apply the latest/greatest security patches. Then Oracle decided security patches were not enough so they gave us the Patch Set Update (PSU) which contained the regression fixes on top of plugging security holes. The CPU was renamed to be the Security Patch Update (SPU) which in my opinion contributed to some monkey business.

Now I’ve always been of the opinion to introduce as little change as possible to a stable production environment. I do need to patch security holes but if I’m not experiencing any other issues, why apply extra patches on top? With the PSU/SPU choice, I always chose the SPU. Oracle’s recommendation was to apply the PSU and beginning with 12.1, the SPU was no longer available.

At some point, Oracle also introduced the Bundle Patch (BP) which contains all of the changes in the PSU plus even more changes for optimizer fixes and functional fixes. Given a choice between SPU, PSU and BP, I’d still choose the SPU if that option were available to me. Oracle now recommends the BP.

Well if that were not confusing enough (remember when it was simple with just the CPU?), Oracle now has the Release Update (RU) and Release Update Revision (RUR). The PSU is gone. I haven’t heard yet, but I suspect the BP is on its way out since the RU covers it.

So what is the RU and RUR? Rather than try to describe it and totally botch the description, I’ll refer you to this blog post by Oracle’s Mike Dietrich. Please give it a read. It does a very nice job detailing the history of what is in the PSU, BP, RU, and RUR. I had to read this post a few times before I got it all sorted out in my head.

That being said, Oracle seems to be making this even more complicated. I know have to understand that the RUR is released the quarter after the RU it modifies. and if I’m reading the last diagram correctly, it means in one quarter, RU1 is released. In the second quarter, RU2 and RUR1 for RU1 is released. And in the third quarter, RU3 is released along with RUR2 for RU1 and RUR1 for RU2. Seems confusing to me. It should be simpler than this. I’m sure Oracle will tell me to keep it simple by applying the RU’s and never worry about the RUR. But again…that introduces more change to a stable production system that I may not be comfortable with.

 

 

Where are my Patches?

$
0
0

I thought I had posted something like this on my blog previously but I couldn’t find it when I was looking for someone earlier today. So here is the information anew. If my old blog post is not more than just a figment of my imagination, it probably needs updating anyway. 🙂

How do I find the latest/greatest patches for my database? Well the answer is often to apply the most recent quarterly Cumulative Patch Update (CPU). All too often on the MOSC and OTN forums, I see people who ask where the most recent CPU is and someone provides the patch number for them. That’s great but in 3 months, the info will be out of date. Here is how you can find your most recent patches for currently supported versions.

First, point your browser to OTN (http://otn.oracle.com) then in the Essential Links section, click on Critical Patch Updates.

The next page shows you each quarter’s CPU patches. Near the top of the page is a section showing you the CPUs. One thing I like about this page is that it shows you the next four release dates. In my screen shot below, the next CPU will be released on 18 Jan 2018. This is great for planning. As I write this on 8 Nov 2017, I know that I’m still more than 2 months away. But if I were looking for the most recent CPU and today were 17 Jan 2018, I’d probably just wait one more day to download the next newest CPU and be even more current.

The table that follows contains a link to each CPU. You can always find the most recent one at the top of the table. In the screenshot above, the Oct 2017 CPU can be seen as the most recent. Almost every time, you will be downloading the most recent CPU. But on rare occasions, you may be interested in one from the past. Click on the link under the Critical Patch Update page of the quarter you need.

This will bring you to a page with a big table showing links to every possible CPU for every possible Oracle product. To get to the CPU, you will click on the link under the Patch Availability column. If you click on the link under the first column, as I have done more times than I’d like to admit, you will not end up in the correct place.

I typically only deal with the Database. So I scroll down the list of products until I find the Oracle Database Server line and then click on the Database link on the right.

That’s it, you have now arrived at the MOS Note for that quarter’s CPU for your product.

Happy patching!

Large .patch_storage

$
0
0

I received an alert from Enterprise Manager that one of my production databases was getting low on disk space. I tracked it down to $GRID_HOME/.patch_storage which was consuming 30GB of my 90GB drive. Yikes!

The first thing I did was to run the opatch cleanup routine as I documented here back in 2013: http://www.peasland.net/2013/03/21/patch_storage/

Unfortunately, it didn’t clean up anything.

This time, I had to resort to a manual cleanup. Here are the steps I did.

The files in .patch_storage start with the patch molecule number and a timestamp. For example: 19582630_Nov_14_2014_21_43_23

I need to ask opatch if that patch is still in the inventory.

$ORACLE_HOME/OPatch/opatch lsinventory|grep 19582630
20075154, 20641027, 22271856, 20548410, 19016964, 19582630

lsinventory shows the patch is in the inventory. I move on to the next patch.

When my lsinventory command returns nothing, the patch is not in the inventory.  MOS Note 550522.1 says you can remove that directory as its  no longer needed.  The ever-cautious DBA personality in me wants to ensure I can recover from a simple “rm -rf dir_name” command. So I tar and gzip the directory first, then remove the directory.

tar cvf 25869825_Jul_3_2017_23_11_58.tar 25869825_Jul_3_2017_23_11_58

gzip 25869825_Jul_3_2017_23_11_58.tar

rm -rf 25869825_Jul_3_2017_23_11_58

Its painstaking work doing this for each and every patch. I’m sure someone who is better than me with sed and awk and shell scripting could automate this process.

By following these steps, my .patch_storage directory dropped from 30GB down to 11GB.

Next quarter when I apply my CPU again, should opatch cry foul and demand these be placed back, I can quickly unzip and extract the tarball and opatch should be happy.

I did this operation on $GRID_HOME but it will work on $RDBMS_HOME as well. Also, since this is Oracle RAC, I may want to do this on all nodes in the cluster.

PRVG-2027 Owner of file is inconsistent across nodes

$
0
0

I recently ran into an issue right after I applied the latest/greatest CPU to an Oracle RAC system. Both GI and RAC were patched. The GI alert log showed error messages like:

2018-05-13 22:03:01.121 [SRVM(32264)]CRS-10051: CVU found following errors with Clusterware setup : PRVG-2027 : Owner of file “/pkg/grid/crs12.1.0.2/lib/ libclntsh.so.12.1” is inconsistent across nodes. [Found = “{root=[host50], oracle=[host51]}” on Nodes = “host51,host50”]

The file above was not the only one with this error. After analysis, host50 is correct and host51 has the incorrect file ownership.

Fixing this required downtime and I needed to run the following commands:

$GRID_HOME/crs/install/rootcrs.sh -unlock

$GRID_HOME/crs/install/rootcrs.sh -patch

Running those commands will stop then start Grid Infrastructure and fix the file ownership and any permissions.


RAC Sequence Contention

$
0
0

I recently ran into a case where selecting the next value from a sequence was causing contention issues in Oracle RAC.  See this screen shot from Lighty (click on the image to see a larger picture)

The wait events will look the same if viewed in Enterprise Manager’s performance screens, which does require one to license the optional Diagnostics Pack.

We can see high waits on the row cache lock wait event as well as multiple global cache wait events (all start with “gc”).

The problem was the sequence was created with CACHE set to zero. Sequences in Oracle RAC with a cache setting too low will see wait events like this. The solution is simple, increase the CACHE size.

ORA-65139: Mismatch between XML metadata file and data file

$
0
0

I was trying to plug a non-CDB into our new Multitenant environment as we make the move to Multitenant. I am going to create a golden image of our production non-CDB and then all dev and test databases will just be clones off the golden image. But first, I need to get the non-CDB plugged in. I have the disk snapshot mounted to the Multitenant database servers. I also generated the XML file and I’m ready to plug in the non-CDB with this command:

CREATE PLUGGABLE DATABASE gold180904
USING '/home/oracle/source_db.xml'
NOCOPY
SOURCE_FILE_NAME_CONVERT=('/u01/app/oracle/oradata/data01',
         '/u01/app/oracle/oradata/mt_golden_2018_09_06_095555/data01',
'/u01/app/oracle/oradata/data02','/u01/app/oracle/oradata/mt_golden_2018_09_06_095555/data02',
'/u01/app/oracle/oradata/data03','/u01/app/oracle/oradata/mt_golden_2018_09_06_095555/data03',
'/u01/app/oracle/oradata/data04','/u01/app/oracle/oradata/mt_golden_2018_09_06_095555/data04')
TEMPFILE REUSE;

Unfortunately, I ran into the following error:

CREATE PLUGGABLE DATABASE gold180904
*
ERROR at line 1:
ORA-65139: Mismatch between XML metadata file and data file
/u01/app/oracle/oradata/mt_golden_2018_09_06_095555/data03/datafile12.dbf for
value of rdba (4194824 in the plug XML file, 4458552 in the data file)

In my research, the ORA-65139 error is normally seen when the XML file was generated with the database open as READ WRITE. But I know for a fact that my database was READ ONLY when the XML file was generated.  Furhtermore, all of the similar issues I found on MOS and in Google searches all had “value of fcpsb” whereas the last line of my error message says “value of rdba”. Well I’m not sure what the RDBA has to do with this and neither of the values in the error message map to the datafile listing in the message. So this was a puzzler for me.

After trying a few different things, I decided to run the check for plugin compatiblity.

DECLARE
compatible BOOLEAN;
BEGIN
compatible:=DBMS_PDB.CHECK_PLUG_COMPATIBILITY(
     pdb_descr_file=>'/home/oracle/source_db.xml',
     pdb_name=>'GOLD180904');
END;
/

When querying PDB_PLUG_IN_VIOLATIONS, one line had an error.  Its message in that view said:

PSU bundle patch 180717 (DATABASE PATCH SET UPDATE 12.1.0.2.180717): Installed in the PDB but not in the CDB.

This now makes more sense. The source database is a production environment with the latest PSU applied. The CDB is brand new and has yet to see any patches. I applied the latest PSU to the CDB and the plugin operation worked successfully on the next try.

In the end, it was obvious the error message had nothing to do with the root cause of the problem. At least not to me.

Oracle DBA Mentor

$
0
0

My new book is now available from Apress. Oracle DBA Mentor is different from most other Oracle books. The others will teach you some great things and show you how Oracle works and how you should use it. This book teaches you to teach yourself. Where do you turn when those books do not contain the answers you seek? This book is your mentor. Pick up a copy today!
https://www.apress.com/us/book/9781484243206

GI 19c RPM Package Manager Database

$
0
0

I am upgrading an Oracle 18c Grid Infrastructure cluster to the new Oracle 19c version, release for on-premises last week. The OUI pre-requisite checks finds two issues that need my attention. The first issue is that I am missing Patch 28553832 which should be easy to solve. Simply download the patch and apply it before attempting this upgrade. The second issue says “RPM Package Manager database”. What is this? To learn more, I clicked on the Details link for this finding. You can see the information in the screenshot below.

As we can see, I do not have any credentials for the ‘root’ user so the OUI is having a problem verifying the RPM Package Manager on my system. The solution is easy enough. Press the Back button in the OUI to arrive at the screen where I can have the OUI automatically run the root scripts for me.

Normally, I run the rootupgrade.sh script manually and I leave these fields blank. This time, I checked the box to run the config scripts automatically. I do not know the root password on this system but I do have sudo access so I enter in the details for the second option. I then press Next and have the OUI check the pre-requisites once again. This time, the check for the RPM Package Manager succeeds.

Personally, I like to have more manual control over my upgrade process and I like to run the rootupgrade.sh script myself. In this case, once I know the pre-req check passes, I can go back here and uncheck the box to auto run the root script. The pre-req check will fail again, but I can ignore it this time.

What do you do if you do not have the root password or sudo access? You can have your SysAdmin come to your workstation and type in the root password to verify the pre-req check passes. Then re-run the OUI and ignore the finding the next time. You will probably have to get your SysAdmin to run the rootupgrade.sh script when it is time to do so.

Oracle Documentation

$
0
0

Oracle has changed their documentation, making it much harder to find the Oracle Database docs. To access the docs, go to http://docs.oracle.com. From there, you could click on the Database category. As it stands now, the only icons on the doc main page are all cloud-related.

It took me a few minutes to figure out where they buried the Database documentation. Click on the three lines in the top left corner to pull down the menu. Then select Database –> Oracle Databases.

asdf

ORA-01173 Opening PDB in Upgrade Mode

$
0
0

I am working on upgrading a Multitenant environment from Oracle 12.1.0.2 to Oracle 19c. I have 40 PDBs supporting all sorts of dev and test environments. We typically upgrade a few dev databases first and then follow with test databases before upgrading production. When production is upgraded, we like to keep a few dev databases around at the old version for a period of time. This way, if someone thinks the database upgrade caused a problem, we can repeat the test in the old version to verify. All of this is a long way of saying that I cannot upgrade the CDB along with all of its PDBs at the same time.

To upgrade, I chose to prepare the PDB for upgrade and unplug it form the 12.1.0.2 CDB. The PDB is then plugged into a 19.3 CDB, opened in upgrade mode and then upgrade. All of this is documented here.

So the PDB is prepacked and unplugged form the old version CDB. The PDB is then plugged into the new version CDB and opened in Upgrade mode when I get this error:

SQL> alter session set container=my_PDB;

Session altered. 

SQL> alter pluggable database open upgrade; 
alter pluggable database open upgrade 

ERROR at line 1: 
ORA-01173: data dictionary indicates missing data file from system tablespace 

Oracle Support told me the ORA-1173 error indicates corruption in the Data Dictionary. This never made any sense to me. The PDB does not contain any data dictionary for the data files. That is stored in the CDB. If you query DBA_DATA_FILES in the PDB, its just a pass-through to the CDB filtering out other files not belonging to that PDB. When the PDB is unplugged, the datafile information is written to a XML file. If there is any dictionary corruption it would occur when the XML file is generated or when the PDB is plugged in. Yet we verified the XML file’s contents are accurate and so is the Data Dictionary contents after being plugged in. The ORA-1173 is not accurate to the root cause of my problem.

After three months of working with Oracle Support, I never obtained a resolution. However, I have devised a workaround. I received the ORA-1173 error when the 19c CDB was created fresh at that version. However, when I created a new, empty 12.1.0.2 CDB and upgraded it to 19.3, I did not receive the ORA-1173 error when opening a plugged-in PDB in upgrade mode. So that is my workaround. Create the new CDB then upgrade it to the target version.

19.3 PDB Close ORA-65107 ORA-16078

$
0
0

When closing a cloned PDB in 19.3, I am receiving the following errors:

ORA-65107: Error encountered when processing the current task on instance:1
ORA-16078: media recovery disabled

This may exist in 12.2 or 18c, but I skipped those versions. If anyone has info if this is an issue in the versions I skipped, comment below.

I tracked this down the fact that I’m closing the cloned PDB with ABORT. If I close IMMEDIATE, I do not get the error. Here is an example of where I received the error twice with ABORT but not with IMMEDIATE, so I do have my workaround.

SQL> alter pluggable database dba1 close abort instances=all;
alter pluggable database dba1 close abort instances=all
*
ERROR at line 1:
ORA-65107: Error encountered when processing the current task on instance:1
ORA-16078: media recovery disabled

SQL> alter pluggable database dba1 close immediate instances=all;

Pluggable database altered.

SQL> alter pluggable database dba1 open instances=all;

Pluggable database altered.

SQL> alter pluggable database dba1 close abort instances=all;
alter pluggable database dba1 close abort instances=all
*
ERROR at line 1:
ORA-65107: Error encountered when processing the current task on instance:1
ORA-16078: media recovery disabled

SQL> alter pluggable database dba1 close immediate instances=all;

Pluggable database altered.


PDB Unplug ORA-17528 Error

$
0
0

I am trying to remove a PDB in Oracle 19.3 that is no longer needed. I get the following error:

SQL> alter pluggable database DEV_PDB close immediate instances=all;

Pluggable database altered.

SQL> alter pluggable database DEV_PDB unplug into '/tmp/DEV_PDB.xml';
alter pluggable database DEV_PDB unplug into '/tmp/DEV_PDB.xml'

*
ERROR at line 1:

ORA-17500: ODM err:Invalid argument
ORA-01114: IO error writing block to file 5590 (block # 1)
ORA-17500: ODM err:Invalid argument
ORA-01114: IO error writing block to file 5589 (block # 1)
ORA-17500: ODM err:Invalid argument
ORA-01114: IO error writing block to file 5588 (block # 1)
ORA-17500: ODM err:Invalid argument
ORA-01114: IO error writing block to file 5587 (block # 1)
ORA-17500: ODM err:Invalid argument
ORA-01114: IO error writing block to file 5586 (block # 1)
ORA-17500: ODM err:Invalid argument
ORA-01114: IO error writing block to file 5585 (block # 1)
ORA-17500: ODM err:Invalid argument
ORA-01114: IO error writing block to file 5584 (block # 1)
ORA-17500: ODM err:Invalid argument
ORA-01114: IO error writing block to file 5583 (block # 1)
ORA-17500: ODM err:Invalid argument

ORA-01114: IO error writing block to file 5582 (block # 1)
ORA-17500: ODM err:Invalid argument
ORA-01114: IO error writing block to file 5581 (block # 1)
ORA-17500: ODM err:Invalid argument
ORA-01114: IO error writing block to file 5580 (block # 1)
ORA-17500: ODM err:Invalid argument
ORA-01114: IO error writing block to file 5579 (block # 1)
ORA-17500: ODM err:Invalid argument
ORA-01114: IO error writing block to file 5578 (block # 1)
ORA-17500: ODM err:Invalid argument
ORA-01114: IO error writing block to file 5577 (block # 1)
ORA-17500: ODM err:Invalid argument
ORA-01114: IO error writing block to file 5576 (block # 1)
ORA-17500: ODM err:Invalid argument
ORA-17528: A read-only file or a file opened read-only cannot be written to:
/u01/app/oracle/oradata/DEV_PDB/data04/users01.dbf.

Hmm…interesting. I did not have this problem when I did the same process in Oracle 12.1.0.2 (I skipped 12.2 and 18).

Thanks to MOS Note 2419236.1 and some of my own work (the Note doesn’t exactly match my problem), I was able to resolve the issue. The problem is that this PDB was once the basis for cloned PDB’s in my environment. We create a PDB in our Multitenant environment and the clone it to create multiple dev and test databases for our IT staff. I learned that in Oracle 12.2 and higher, Oracle will change the file permissions at the OS level for any clone source PDB. The file permissions are set to read only. When I try to unplug the PDB, it needs to write info to the datafile headers and we get the above errors.

The workaround is to simply change the file permissions of the datafiles to 640 and try the unplug operation again. The workaround in Note 2419236.1 requires downtime but my workaround does not.

It’s In The Details

$
0
0

I have an Oracle 12.1.0.2 Multitenant database that I’m trying to remove a PDB from. However, I mistakenly removed the storage from the database server and the PDB cannot access its files. When unplugging the PDB, I get the following error:

SQL> alter pluggable database GOLD2019_08_22_125953 unplug into '/tmp/GOLD2019_08_22_125953.xml';
alter pluggable database GOLD2019_08_22_125953 unplug into '/tmp/GOLD2019_08_22_125953.xml'
*
ERROR at line 1:
ORA-01157: cannot identify/lock data file 50277 - see DBWR trace file
ORA-01110: data file 50277:
'/u01/app/oracle/oradata/mt_golden_2019_08_22_125953/data03/datafile_20.dbf'

Well that is unfortunate but to be expected in my case. I mistakenly yanked out the storage for this PDB before I unplugged it. Most of the literature on Oracle’s support site says to restore the PDB from your backup. But this PDB is a clone of production and I do not care to back it up. It is 25+TB and if something goes wrong with it, I remove the PDB and create a new clone of production. No backup is needed except may to save me from my silly mistake of removing the storage before unplugging.

Since I could not unplug the PDB, I attempted to just drop the PDB but I get a different error:

SQL> drop pluggable database GOLD2019_08_22_125953 keep datafiles;
drop pluggable database GOLD2019_08_22_125953 keep datafiles
*
ERROR at line 1:
ORA-65179: cannot keep datafiles for a pluggable database that is not unplugged

Now I feel as though I’m in a Catch-22 situation. I cannot unplug the PDB nor can I drop it.

I’ve seen this error on many occasions and always wished I could just drop the PDB without having to unplug it first. I have no desire to plug this into another CDB. I just want the thing gone for good. And that’s when I realized that it’s in the details. When I read that ORA-65179 error message, I focused on the latter part of it. The PDB is not unplugged first. I’ve read this error message at least 20 times in my work with Multitenant and I missed the critical detail that stopped me from dropping the PDB which I will now highlight below.

ORA-65179: cannot keep datafiles for a pluggable database that is not unplugged

The detail I keep skipping was that I could not KEEP the datafiles. Does that mean I can drop the PDB if I also remove the datafiles?

SQL> drop pluggable database GOLD2019_08_22_125953 including datafiles;

 Pluggable database dropped. 

Sure enough, I could easily drop the PDB. Sometimes, the most interesting things are found in the details if we just slow down a bit and make sure we see everything in front of us instead of jumping to the end.

Invalid ODCIPARTINFOLIST on Upgrade

$
0
0

I have been working on upgrading Oracle 12.1.0.2 databases to Oracle 19.3 when I ran into a problem that took me quite awhile to figure out. I did a search on My Oracle Support and a quick Google search and didn’t see anyone else have this problem. So hopefully this will save someone time in the future. Side note: I had the same problem upgrading from 12.1.0.2 to 18.3 but did not check 12.1.0.2 to 12.2.0.1.

During the upgrade, the DBUA gives me an error that the type SYS.ODCIPARTINFOLIST is invalid. After a few more minutes, I get a lot of error messages and XDB will not upgrade correctly. As I learned, XDB relies heavily on indextype CTXSYS.CONTEXT, which depends on type CTXSYS.TEXTINDEXMETHODS, which depends on type SYS.ODCIPARTINFOLIST. I boiled the root cause of the problem down to these three objects in the database.

I figured out how to resolve the issue and move forward. I cannot stop this problem from occurring. But if I fix the issue and press the Retry button on the DBUA, it still will not upgrade the database for me so I am left with a manual upgrade.

Fixing the first two invalid objects is easy. Just compile them. Fixing the CONTEXT indextype is a bit more complicated. Here are the steps I used to get everything valid again and get my database upgraded.

$NEW_HOME/bin/dbupgrade -l /tmp/19c_upgrade
alter type sys.odcipartinfolist compile;
grant execute on odcipartinfolist to public;
alter type ctxsys.textindexmethods compile;
drop indextype ctxsys.context;
@?/ctx/admin/catctx.sql password SYSAUX TEMP LOCK
@?/rdbms/admin/utlrp.sql
exec dbms_registry.valid('CONTEXT');

At this point my database was upgraded and ready to roll. So let’s go over the steps above. After starting the database in UPGRADE mode, I used the dbupgrade utility to perform the manual upgrade. I still received the same errors that DBUA reports. Once the upgrade was complete, I compiled the ODCIPARTINFOLIST type. That was easy. For some reason I cannot figure out, the grant to PUBLIC on the type is dropped during the upgrade. I had to issue the grant otherwise the next compile would not be successful. Then compile the TEXTINDEXMETHODS type for Oracle Text.

I wish I could have just compiled the CONTEXT indextype but it would never compile for me. So I had to drop the indextype and then run the catctx.sql script to get it created again. Then run utlrp.sql to recompile everything else.

A note on dropping the indextype. If you have indexes that reference the indextype, you will receive an error. Query DBA_INDEXES where ITYP_OWNER=’CTXSYS’ to find any indexes you have using this indextype. Use DBMS_METADATA.GET_DDL to obtain the statement to recreate those indexes. Drop the indexes and then drop the index type. After you have the database up and running, recreate the indexes.

I spent the better part of a week working through all of this so hopefully this blog post finds you if you have a similar problem and you can be on your way much quicker than I was.

The Value of Data Over Time

$
0
0

By now, everyone knows that data is very valuable. Major corporations use data to make decisions that hopefully drive the business forward and achieve a higher level of profitability. As database administrators, we safeguard the data, especially Personally Identifiable Information (PII). Systems are hacked to obtain data. There is a lot of value in data and you would have to be living under the proverbial rock to be learning this today.

What I rarely read about, and the subject of this blog post, is how the value of data changes over time. The value of the data should be used to drive your retention policies.

Most data loses its value the older it gets. I was recently working on a project concerning application performance and the metrics we capture to measure that performance. Some people on the project wanted to keep those metrics around for more than five years. I spoke up and let the group know that five year old performance metrics have zero value. Our application changes too much over the years. We cannot compare the performance of the application today with the performance of the application five years ago. It will not be an apples-to-apples comparison.

Not all data value declines at the same rate. In the example I gave in the previous paragraph, the metric data for application performance is worth zero in five years. However, a retailer that has data to indicate a customer purchased diapers five years ago, now knows that the customer is likely to purchase clothing for a five or six year old child today. That child is most likely in elementary school and may need school supplies. In this case, the data of that customer’s purchases from five years ago still has some value. The data is not worthless. That being said, we do not need all of the data points from five years ago. We only need a summary of that customer’s activity to make meaningful conclusions about their current and future purchases.

All too often, I see people treat database systems as a dumping ground. Data is just dumped in there and very few people give much thought to what to do with that data over the long term. Very few people give much thought to how much that data is worth over the long term. There is a cost associated with storing that data. If the data has little or zero value due to its age, is it worth the cost of keeping that data in the database?

There are mitigating strategies to employ for older data. The database administrator may move older, lesser value, data to a cheaper storage tier. If the data has zero value, the data should be destroyed. Many times, we no longer need the full details of that old data when summaries will suffice in which case we aggregate the data and store the results. Then get rid of the details.

As the database administrator, it is your responsibility to be the steward of your data and the resources needed to host it. You should always be asking for the appropriate steps needed to care for that data as it ages.

ORA-1114 Running Datapatch

$
0
0

I have an Oracle 19.3 Multitenant database that I am attempting to apply the 19.7 Release Update. The RU was installed by opatch just fine. But datapatch will incur the ORA-1114 error. I get errors like the following in one of the logs:

SQL> alter pluggable database GOLD2020_06_18_123653 open read write instances=all;
alter pluggable database GOLD2020_06_18_123653 open read write instances=all
*
ERROR at line 1:
ORA-65107: Error encountered when processing the current task on instance:1
ORA-17500: ODM err:Invalid argument
ORA-01114: IO error writing block to file 12346 (block # 1)
ORA-17500: ODM err:Invalid argument
ORA-01114: IO error writing block to file 12345 (block # 1)
ORA-17500: ODM err:Invalid argument

Before I can explain what the problem is, let me discuss how we use Multitenant in my environment. Once a week, we have a cron job that create a copy of our production database (using disk-based hardware snapshots). We call this copy of production our “golden image”. This golden image is plugged into our database as one of our PDBs. The PDB name is of the format GOLDyyyy_mm_dd_hhmiss so that we know when that PDB was created.

All of our dev and test databases are then created from this golden image PDB. When I need to refresh DEV1 or TEST, we simply shutdown the PDB for DEV1 or TEST and drop it. We then create a snapshot clone of the latest golden image. The golden image PDB is in READ ONLY mode to facilitate the snapshot clone.

As I wrote about here, the when a PDB is used as the source for a snapshot clone, Oracle will change the file permissions to 220. This is Oracle protecting us from ourselves. We shouldn’t be allowed to modify the source of a snapshot clone so Oracle makes the datafiles read only. Whomever at Oracle that decided changing the file permissions was a good idea didn’t talk about it with the datapatch developers.

Datapatch sees the READ ONLY PDB and wants to open it as READ WRITE, patch the inside of the PDB, and then set back to READ ONLY. However, datapatch cannot open the PDB in read write mode because the file permissions won’t allow it. Hence the errors I am receiving.

Oracle did this to me…they forced file permissions one way and then datapatch can’t do what they now want it to do.

I haven’t received official word with my Service Request yet, but I expect this to become a bug. Datapatch should be skipping any PDBs that are sources for snapshot clones, in my opinion.

In the meantime, you can brute force your way through this. I tried to use the -exclude_pdbs parameter for datapatch but that didn’t work. Apparently there is a known bug where that parameter doesn’t work if your list of PDBs has a comma. So I had to get datapatch run as follows:\

./datapatch -verbose -pdbs cdb\$root
./datapatch -verbose -pdbs pdb\$seed
./datapatch -verbose -pdbs dev1,dev2

First, I ran datapatch to patch CDB$ROOT. Then I patched PDB$SEED. Then I patched my dev PDBs. I just didn’t patch my golden image PDBs.

Viewing all 106 articles
Browse latest View live