Let’s talk about the Archive log in RMAN.

The archive logs I will probably have configured by default device type backup type to compress Mac upset and so I’m going to be favoring up to space from I do that and then we have the scripture you saw yesterday backup incremental level 14 recover of coffee with the tank, so this one scratch then automates the complete three-tier storage hierarchy and depending on what retention policy goes in your tape library so notice I’ve not got the maintenance commands, but your tape library might be deleting everything more than six months old in that case you would then be wanting to do the cross-check well look what your tape channel running cross-check or maybe you just rely on obsolete, so that’s just an example of a slightly more complex script and that will be either stored or just invoke from the operating system from the as a shell script other scripts that stored the operating system calling our line right the example since I’ve realized I missed some of the windows once or provide them.

That we’ll see some examples which we should see coming up here there’s a Linux shell scripts example so set your date formats find the stuff more than 10 days old you may recognize that sand last chapter Luke through doing what you have to do now here’s a Windows version after the patch file you just run through the schedule you, so compact form dido actually don’t do that nowadays you set your date format and I’m using for files here so here I’m using for files to delete everything / d minus 10 if you’re going until going to run the CC run the command CMD del this will for all files in that directory the sir over 10 days old delete them and then I’ve got a for loop for Cassandra Santos in three names the Assumption here in these are the three database instances on this machine so for each of that three destiny that databases look through them and what are you going to do give it a run that script you’re going to run more and while logging the output Oh door typing error.

I’ve left the win the Unix environment variable there my apologies that should be percent Oracle said it’s a cent sorry about that well nobody’s perfect I’m certainly not but otherwise, maybe that sort of thing will give you a few hints if even if your shell scripting that if you want some ideas for shell scripting and notice we haven’t got the email in there and I did get another example which I’ll put into the copy-paste of pasting that’s got that now p-type ones somewhere here we are right this is an example which is copying TV the chance what I’m doing here is calling a script that sets and variables that’s nothing sequel plus and running sequel plus I’m looking on 10 if I’m running Ewell scripture tries to do some DEL if there’s an error I if that fails what am I going to do I’m going to use the black utility which is very useful as a wonderful little emailed it doesn’t come as standard with Windows you have to search for blasting downloaders.

But what I’m doing with black is I sending an email with that message alerts from NASA dress I’m sending us at the body and by me mailings out through that server, so that’s an example of shell scripts that will run something and send an email depending on the results I’ll put that in the chat so realize I didn’t have this in the manual now if you’re not familiar with blacks look it up it just downloaded some wonderful to utility it’s very similar to the male acts as I’m using that were using here, so that’s the example of the script here some shelves so previous slide we’re doing some file system Langston’s there with the find or down here with four files and then we’re running the script Aryan daily backup so next slide we’ve got online daily backup us can press back upset formats and this format, of course, is going to be platform-specific which is why you might want to configure a default format and what I’m doing here is % v will give you the database name.

And then I’ve got the date coming in and % little new there’s a lowercase you and DR. case you they give you slightly different variables and then to run if my daily maintenance or then my daily maintenance cap barely make sense our mom that’s going to run all of that wall what’s the channels that are just two examples that will launch your channel and do a backup and this one will launch a channel and do the maintenance work okay and the cattle and I’ll put and maybe see what’s happening now but this is basically platform independence except for those phones you can call our run with the scheduler is tight backup scripts it launches Aryan this command interpreter and then the scheduler job itself is the scripts and finally just to finish off examples you might find helpful database exports now I think I mentioned a while back it should be consistent to make sure you get consistency across tables.

Here’s an example of doing it with Linux unix washer Bosch shell source bash profile set some variables and once again loop so for food in those three databases exp I’m doing this a 50 VA that’s not best practice many people will tell you never do anything 15a I can’t remember why we did, in this case, we must have had a reason to do it so I’m running expdp and I’ve had to escape the quotes you’ll find all platform variations here stuff in the flashback times assistance to make sure the export is consistent there’s a directory I’m using and there I’m generating a unique file name using back quote dates whatever to see what that’s actually giving you it’s just an example but it would be so date + % it’s not going to give you a con Tu and go since I wrote that date space + % being a dated space + % an alright give me the day of the week good mood say to my export file my dump file will be database name followed by the day of the week.

And I think we’ve got some operating system Jordan it deletes everything that week old I’ll show you the equivalent for windows and put us on the page and here’s what I’m here export the whole database and I’m relying on Windows default format so now just set some of our variables to dump file name equals less I’m using date colon tilde 0 that does make some sort of sense let’s try it if I copy and then echo I haven’t got Oracle said sets and there’s something wrong whereas well quite worked as if I probably run from within the batch from within a batch file yes I will too if I copy calm be dot that that in controls I’d write and then just run it so being dot bat I’ve got a bag fashion that shouldn’t be there I set my Oracle said okay that backside shouldn’t be there is a mistake by someone but whatever that dumb file name equal something rather delete the one that was created the week before like almost windows default that’s why it’s not working.

I’ve changed my date formats, of course, have I’ve changed my date I changed a formatted my session that’s why I don’t work in that will work if you’re in the default format that will work right so create a file name delete the previous version of its run expel doing for the system there you go and then go to another database so I’ll copy that into the chance to go to windows example as well in case of other handy there we go, so that was exports do you export your data bases not for backup we wouldn’t do it on some of us like I have one that takes over I’m four hours to export yeah yeah you’re using power isn’t announced multiple workers, yeah I mean if I had we had to do it I would do washable workers and I would do it I could get it downside too long yep it’s on this thing it’s nice to have if you can it’s nice tile vertically tampered good money for sure remember.

I would never want we had to actually run through the process of export and then import it and it takes like a big jumping like ours to import, so that wouldn’t be my first collection to a resort I want to sit down a database who is the way we’re doing is yeah we normally do it for specific reasons our developers we always expect export the schemers where there’s any program development going on because of the developers mess something up they say oh can you restore from yesterday’s back up I’m not going to restore the whole damn database because one developer would it made a mistake, yeah things are like we don’t keep that in this system we don’t have them doing that type of development this is more of an application system, yeah yeah there’s some direct development self but a lot of systems in might come in handy I guess it depends on the size of it that’s exactly that it just may not be possible in many cases.

Furthermore, I’ve not been with the scripted interface the online user interface is not brilliant to put it mildly, but that’s okay I’m sure you’ve all been frustrated and annoyed doing our exercises and how bad it is to lose well get your scripts written and they’ll go and run perfectly they’ll run perfectly afterwards and automate them with chrome for UNIX or with the window shall and with the window scheduler and you probably know more about the window share you rather than I do but I do have problems the window scheduler usually with permissions if it’s just who your effective user ID is when the schedule job is running and I get dreadfully confused at who I am when running scripts through the window change now who is going to run ass what permissions it has but you and your system administrators can probably do a better job than I can but the confusion I’ve had with maps is why in some in scripts like um this that’s why I’m calling a shell scripts that sets all my commissions and so on to make sure.


Furthermore, I really am who I think I am because otherwise, we found we couldn’t run sequel plots and things, so that’s the only sure how to win those it’s really permissions UNIX using chrome is much simpler now because krong becomes the person and it goes straight through.

Leave a Comment