1z0-062 Oracle Database 12c: Installation and Administration – Module 9: Critical Storage Files

  1. Critical Storage Files Part1A

All right, so there are a couple of files within the database itself that we need to talk about. One set of files, I think, that you will see is obvious to the database itself and the other, a couple of other files that are very important that Oracle must have to make sure that it runs. So you need to be aware of those. And to an extent, you need to be aware of what the contents of those files files are. You may need to do some maintenance on them.

Maybe the database won’t run for some reason, and it could be because those files are corrupt. That may be one place that you’ll want to check. Generally, these files are duplexed. And when I say that they’re duplexed, I mean that is there is a backup automatically. There’s something happening to make them automatically, constantly backed up. And the reason for that is, of course, that they’re very critical to the Oracle system.

And there are other ways that will back up the Oracle system, other ways that will back up these particular files. We’ll talk about backups and restoration in another section, but just be aware that these files are constantly being accessed by the database and therefore they should also, because they’re critical files, constantly be backed up. So a couple of files that we’re going to talk about here first is one, a file called the control file.

The control file is absolutely critical to Oracle. Without a control file, Oracle does not know what to do. Oracle will panic if there is no control file. So you must make sure the control file is operating properly. Now, I don’t mean by saying that, that you specifically must make sure that the control file is operating properly, because obviously the Oracle system is going to do that for you. But there are some things that you can do, some very important things that you can do to make sure that that file is constantly available to Oracle in some place.

Better yet, in a couple of places. Because we want to make sure that this file is going through a constant backup process. That is, it’s going through a process where it’s duplexing, at least duplexing. And duplexing. By that term, I mean within Oracle world, when we say duplexing, we mean it’s constantly copying itself. Better yet, you may want to multiplex this particular file. And the reason why you want to multiplex it is because duplexing having two copies of it may not be good enough for you.

You may want to make sure that there are very many copies of this file, maybe eight of them. And I say maybe eight because I’ve actually worked within database systems where there were eight, each located on a different machine. So if one particular machine went down, the other machine was able to pick it up right away. And I’m not saying that one machine was a failover to the other. In other words, if Machine One goes down, machine Two is an absolute copy of Machine One.

That wasn’t the situation at all. What I’m saying is there were data files running on Machine One, different data files running on Machine two, different data files running on Machine three. But this particular file is so important to the running of the Oracle database that that file ran multiplexed on eight different machines. And that’s not all that uncommon. It is so important for that file to run. And by the way, one thing I will say also about that particular configuration, not all of those machines were even in the same area of the building. They were all within the building, but they weren’t all within the same area. So even if the building caught fire, there was a pretty good chance unless the whole building went down, there was a pretty good chance that this file was going to survive and that the Oracle database was going to continue to run.

So the people might have been running out of the building and fire alarms might have been going off and who knows what, what chaos was going to be happening within this, in this company. But that Oracle database was going to be up no matter what. It was going to run 24/7 in rain, sleet, snow, and fire, that system was going to run. So that particular file that I have been talking about that is critical to the database system is called the control file.

We want to make sure that the control file is up and running at all times, and it should be at least duplexed, if not multiplexed. I strongly recommend multiplexing it. And even if you’ve got a small Oracle database system, and that Oracle database system is just running on, say, one machine, just one server, make sure that the control file is at least duplexed, because who knows what can happen? There could be a bad head on the hard drive and that could somehow corrupt that one file.

Oracle needs to be able to jump to at least one other file. Never worked with an Oracle database system. I’m probably lying about that. I probably have, but just didn’t realize it. But to my knowledge, I’ve never worked with an Oracle database system except for training purposes, where there were only just two, where there’s just a duplexed, not a multiplexed control file. The other files that we want to talk about in this particular section, in fact, we’ll talk about more than just these two kinds of files, but the other kinds of files that we’ll talk about, which is this is the type of file that everybody thinks about when they think about a database.

And that’s the data files. First thing we want to talk about saving, about making sure that they don’t become corrupt or don’t go down, are the data files. And there are many, many ways to make sure that the data files do not go down many, many ways. And we’ll talk about these in another section when we talk about backup and restoration. Many ways to make sure that we don’t lose data from the data files.

So two critical kinds of files that we’re going to talk about in this particular section. One, the control file. I shouldn’t say control file because I really want to say control files because they should always be multiplexed, if not duplexed. But I say multiplexed in a live database situation. Then the other set of files that we’re going to talk about in this particular chapter here are going to be our data files. That is the place where we keep data. Talk about some other files, too, but those are the two main concepts we want to go through in this particular section. All right, so let’s talk about the control file. A lot of oracle’s. Now remember, Oracle is an old, relatively old relational database management system. It has been around for a long time. And because of that, a lot of the files that Oracle works with are simple text files. And if you want to open them and take a look at them, no problem. In fact, you often will, you’ll often open up the files and say, hey, that’s an interesting file, I need to take a look at that. Very often you will change things within an Oracle text file to change some parameters within your database system. That’s not at all uncommon.

Now, are there graphical user tools that you can use to change these things? Sure there are. And do those graphical user tools do nothing more than just rewrite to a text file? Yes, they do. And if you’re more comfortable using the graphical user tool or you just think it’s easier to use the graphical tool, fine, that’s fine, you can do that. But I just want to tell you, lots of Oracle files are nothing more than text files. And if you want to change the parameters within those text files, go for it. You may have to shut down and start up again before the parameters within those text files that you’ve made changes to become applicable to your database. But many of these files are just text files and you can make changes to them. We’ll see how to do that with some of these files in a later section.

Can’t do that with the control file, though, because the control file as it happens, is a binary file. So if you’re going to actually read the data from the control file, you’re going to have to do that through some graphical tool. And there are graphical tools out there that will do that. But you probably will not make changes directly to the control file. You will probably make changes to other parts of the database, like a change to say, the data dictionary or something along those lines. And then that change will go back and be reflected into the control file. It’s pretty rare for you to make changes directly to the control file through a graphical user tool. And I don’t think that you will ever make changes directly to the control file because it is, like I said, a binary file.

So you can’t even read the text that’s in it. I’m not saying it’s impossible to do that. It just is pretty tough to read binary within a file, let alone make changes and be sure that you haven’t made changes that have corrupted the database. The control file, as I said, is a critical file. Lose the control file and lose the database. That’s it. The control file does what it says. It literally controls the database. And the database continues to read it throughout operation, delete the control files from wherever they’re stored. And eventually the database probably quickly will begin to cease operations. It will begin to shut down. It may shut down abruptly. You need to have a control file, probably, like I said, a multiplexed control file. Let’s take a look at why. Let’s take a look at the different things that are in the control file and why it’s critical to the Oracle database system.

So, first of all, I’ve already said it’s a binary file, but mostly it keeps database information. And look at this important information that it keeps. For instance, it keeps the name of the database. Yes, the database needs to obviously know its own name at all times. Users access the database based upon its name. For example, users access other things within the database based upon the name of the database. Everything that’s stored within the database knows where it is and where it’s attached by the database name. So that is a very critical piece of information. Obviously, we lose the control file, we lose the name of the database. The database is going to stop working very quickly. So that’s why the control file must be multiplexed, in my opinion, at least. duplexed, certainly. You’re really flying on a wing and a prayer if you don’t have the control file. duplexed or multiplexed. And that’s something, by the way, if you’re working in an operating environment, you may want to check that just to be sure if you’re the person that maybe set up the Oracle database system. If you followed the wizard. When you set up the Oracle database system, your control file was multiplex, so you don’t have to worry about that. You may not have liked the placement of the control file.

We will talk about that later when we talk about installation. And after you take a course like this, you may be thinking, oh my goodness, I did quite a few things wrong when I installed Oracle on our database, on our machine. So there are some things I may want to talk about now, or there are some things I may want to change now. And the control file is one of those things. You may want to talk about. But certainly when you do an installation of an Oracle database system in the future, you will know, for instance, it’s probably a bad idea to locate the control file on the same machine as the database itself, where all your tables and everything are stored. It’s a bad idea because if the control file goes down, it’s going to take down the whole database.

Or if that hard drive goes down, without a control file, there’s no way that you could switch over to say, another hard drive where maybe a backup or another copy, a duplexed copy of the database itself exists. Control file is critical. It probably ought to be on some other server someplace that’s very protected. What else do we have in the control file? Well, the block size, block size is something that I’ve recommended you not worry too much about. So, for instance, we know that Windows has a block size of eight, and most of our current operating systems that we’ll have, that you’ll use in practice are going to have a block size of eight because that’s by far the most common configuration of block sizes. There are some exceptions to that rule. You will see 16 byte block sizes, you will see 32 byte block sizes. That’s very rare, though chances are your block size is going to be eight. But anyway, whatever it is, that information is going to be stored in the control file. Remember, when I say block size, I’m talking about the block size of the Oracle database, not the block size of the OS. Because the block size of the OS may be irrelevant to your Oracle installation. You may have a block size of eight in your OS, but you may want the block size of your Oracle installation to be 32.

I’ve said before, and I’ll say it again, that’s kind of a crazy idea. You really, really, in almost all circumstances, in all, as far as I know, want your block size of Oracle to match the block size of the OS. But there could be some exceptions that I’m just not aware of. But chances are that block size is going to be eight because almost all of your OS block sizes out there are eight byte block sizes. Okay, so anyway, back to my point. The block size is kept within the control file. The block size of the database is kept within the control file. The character set also is kept within the control file. What do we mean when we say character set? Typically your character sets going to be a Unicode character set. If you’re running an older database system, I think that was switched to a Unicode character set. In Oracle eight I prior to eight I, there was an ASCII character set that was used, and I won’t swear to that, but that’s about the time I think they switched to a Unicode character set.

If for some reason you don’t want to use, don’t need to use a Unicode character set, then that would be changed or the fact that it’s been changed would be stored within the control file. Recovery information. We’ll talk about recovery in a later section, but how the database is going to be recovered, what needs to be done, when the database is going to be recovered. There are lots of methods of recovery, a whole lot of methods of recovering. Five main methods. Five. So, I mean, Oracle wants to make sure that it does recover, but there are other methods that you can use to recover. But information for Oracle to begin to do the recovery process or to execute the recovery process is contained within the control file. The creation timestamp, that is the time. And this is an Oracle timestamp. So it’s not the timestamp that we might think of, say, noon on a particular day, but the Oracle creation timestamp is kept within the control file. The locations and sizes of all the data files and the redo logs. Redo logs also critically important. You might do backup with just the redo logs alone.

That’s entirely possible. So you can see why they might be critical. But obviously the location and size of the data files is very important. So that information is kept within the control file. And lastly, information for R man I shouldn’t say lastly because I haven’t listed all the information on this slide that’s kept within the control file, but other information is located regarding our man. R man is a tool that you’ll probably have. Our man stands for Recovery Manager. And it’s kind of Oracle’s default method for doing recovery. So there’s going to be some information in the control file about Rman, so that if Rman begins recovery, it knows where to look for certain things, it knows how to recover the database. And also within the control file are the files required to open the database so that the database can get started and begin to mount itself and then eventually to open itself.

So that’s the type of information that is not a comprehensive list. That is some of the type of information that’s contained within the control file. But you can see from that list the control file is incredibly important to Oracle, arguably the most important file outside of the database itself that exists. And that’s why I say you really need to multiplex the control file probably across multiple computers. So control file very important, and that’s what it’s all about.

  1. Critical Storage Files Part1B

Where would you find the control file? How do you know? Because now you’ve heard me talking about it and you’re really worried. Hey, where is that control file? Is that control file sitting on the same machine as the data files? And is there only one of them? Is there only one control file? If that one machine, that one hard drive goes down, is that it? Is that going to take down the entire system? Because if you’ve only got one control file and it goes down or the hard drive that that control file is sitting on goes down, that’s it. Oracle will stop operating very, very quickly because it’s constantly accessing the control file to get the information that it needs.

So how are we going to check this? How are we going to check where our control file or files are? Hopefully files and it’s in the data dictionary. How do we know it’s in the data dictionary? Let’s look at this query. Select name and name also gives us the path. So name is actually the name of the control file and the path to the control file. So select a name from Vdol control file and how can we tell it’s one of those data dictionary views? It’s got that V dollar sign in front of it that’s almost always going to tell you unless somebody really wrote some weird views or some weird tables or named things strangely within your database system. Don’t let them do that. V dollar sign is strictly reserved for the views within the data dictionary and you should not break that naming convention. Select name from v dollar control file that’s going to tell us where the control file is located.

And here some fool set up this database system. How do I know it was some fool? Because it was me. No, I’m just kidding because there’s only one control file and let’s see where it’s located. It’s a Windows system, I guess because it’s on the C drive. C, Oracle, Data and Control one CTL. That’s by the way, the default naming convention for the control file is whatever CTL. In fact, the default naming convention is Control one CTL.

So probably what’s happened here is somebody’s allowed the standard installation to occur, which I think I won’t swear to it, but I think that includes two control files. But somebody has altered it somehow so that on this particular Windows system they’ve only allowed one control file. By the way, typically Oracle will install into a subdirectory called Oracle. So it looks like somebody has installed probably the data files and the control file and maybe all of the files into this one subdirectory here. Kind of a foolish install. But we all know that now and we’re not going to allow that to happen in the future. When we do our Oracle install in the future, we’ll know not to put the control file if we can avoid it on the same hard drive as the data files, but maybe somebody was just using this as a learning database or something. Select Name from vdol control file. That will tell us how many control files we have because there will be an entry for there will be a row for every single control file and it will tell us the location of our control file.

So here we’ve got the location of our single control file. How do we duplex or how do we see if we have a duplexed control file? Well, here we are with the same query. Select Name from VDOT control file. Now we can see we have looks like a C here. We also have a Windows configuration. I’m almost certain. C Oracle. Datacontrol one control. Now we’ve got a second row that was returned to us. D oracle two, data Control two CTL. Looks like we’ve got two duplexed control files. And here I’ve got a little note here saying make sure you’ve got the fifth possible in your configuration. Try and put your control files on different machines and try to at least duplex them, if not multiplex them. That’s very important. We don’t want to lose that control file. Lose the control file, lose the Oracle database system. Let’s talk about data files. So data files are where we’re going to put the data. This is where the tables go. For instance, tables aren’t the only place where we might store data, but 99. 99% of the time, data is going to go into tables. The tables go into data files. Data files are logical structures where we’ll put other objects, most commonly tables. So they’re used for the physical data storage. So this is where the actual data storage is going to go on the hard drive.

And data files are stored in table spaces. The largest structure that we’ll generally have, the structure into which everything else will go on the hard drive is going to be a table space. The largest logical structure will be the table space. Everything else will fit in some way or another into a table space. So our data files, the area where we keep our data, are going to go into one or more tablespacess in the database system. It would be an extremely unusual database system if there were only one table space.

In fact, it’s almost impossible, and I’ll show you why later to have just one table space. Oracle does not want one table space. You’d have to kind of jury rig it in order for there to be just one tablespace. Normally you’re going to have almost absolutely you’re going to have more than one table space. And that will happen by default unless you set it up to happen in a different way. But it’s still going to happen. You’re going to have more than one table space. So data files are stored inside of table space.

img