Using Oracle Enterprise Manager doesn’t mean your organization isn’t still using its existing suite of technologies and tools. One such very popular tool for database administrators is found in the Unix world: thecronutility.
This tool enables users to launch a shell script at a specific time of the user’s choosing. Most often, cron is used for initiating new backups and clearing out unneeded backups and old log files to conserve disk space. It can also be used for monitoring various system processes as well by providing scheduled reports for analysis.
Cron is a powerful and flexible tool but it does have limitations. Everything piece of the process has to be developed and supported. If you are using it to perform mission critical tasks you will also need to create a reliable method to log and monitor each run to ensure the scheduled task gets completed on time.
This often results in yet another system for an over-taxed DBA to monitor an usually by the monotonous task of logging into individual servers and looking through log files. For this reason the cron logs often get ignored for weeks leaving an opening for a catastrophic system failure.
So, consider transitioning to an enterprise job scheduler and moving your cron jobs over to OEM, a system you are already monitoring. How do you move from cron to the Oracle Enterprise Job System?
Oracle Recovery Manager (RMAN)
In RMAN Recipes for Oracle Database 12c: A Problem-Solution Approach, authors Darl Kuhn, Sam Alapati, and Arup Nanda suggest there are many possibilities for using cron in conjunction with Oracle Recovery Manager (RMAN). These can be used in tandem to successfully launch tasks. One possibility is writing a shell script to call an RMAN script. As they explain:
It’s common practice to include RMAN backup scripts within an operating system shell script. Doing so allows you to schedule your backup jobs viacron to run automatically.…You can embed your RMAN scripts within shell scripts.…You can place your RMAN scripts into their own files. This approach works on non-Unix systems, such as Windows.
The next step you may wish to take is to start usingthe Oracle Enterprise Manager Job System. In fact, Oracle notes one of the most popular questions customers ask on its fora is whether they can use the Oracle Enterprise Manager Job System to replacecronjobs.
Adeesh Fulay, an Oracle employee, writes on the company’s blog:
The answer is obviously YES! I say surprisingly because the EM Job system has been in existence for around 10 years (I believe since EM 10.2.0.1), and my hope was that, by now, customers would have moved to using more enterprise class job schedulers instead of cron.
How cron Works
Before proceeding, let’s look at how cronworks. The utility often uses the native shell or other operating system tools because it does not run on the operating system. A cronexpression consists of six fields, the first five of which describe the schedule. The last field denotes the specific command or script to be run.
Within Oracle Enterprise Manager, this can be accessed using the OS Command job. A user can convert any crontab to an Oracle Enterprise Manager Job automatically using a wizard. This will walk a user seamlessly through the process. As Fulay notes, it is very important to select the correct frequency. He says “the rest of the selections are quite obvious.”
One of the selections, for example, allows users to specify the time zone to use for scheduling. In addition to having the ability to start the job in the user’s time zone, she can indicate that a job should be executed in local time. This can be used to start a job, for example, at 2 a.m. local time in every region around the world.
Backing Up Thousands of Databases
Porus Homi Havewala, senior manager, Enterprise Technology Program Office of Oracle Singapore, advocates using Oracle Recovery Manager (RMAN) for its ability to back up “thousands of databases…more easily and efficiently than the older, more time-consuming, manual method of performing Unix shell scripting and cron jobs for each database to be backed up.”
Fulay says there are instances in which you may want to stick with using a cron script.
For example, if you are taking Oracle database backups using cron, then you probably want to use the out-of-the-box job type for RMAN scripts. Just provide the RMAN script, list of databases to run this against, and the credentials required to connect to the database. Similarly, if you run SQL on numerous databases, you can leverage the SQL Script job type for this purpose.
He adds that there are now more than 50 job types available within Oracle Enterprise Manager 12c for users.
Help with cron and OEM
If you’re confused about how to seamlessly use or convert your cron scripts with Oracle Enterprise Manager, Datavail can work with you and your organization to effectively support your Oracle environment for your benefit and that of your clients and customers.
We’ve previously offered other ideas for working with Oracle, including a webinar with Chuck Ezell on the value of conducting Oracle Health Checks.
To learn more about our remote database services and how our experts can help with your ongoing Oracle operations, please contact Datavail to discuss a custom solution designed for your enterprise.
The “ORA-12154: TNS:could not resolve the connect identifier specified” Oracle error is a commonly seen message for database administrators.
This blog reviews how you can generate scripts for SQL server logins, role assignments, and server permissions for a smooth migration.
Which RAID should you use with SQL Server? Learn the differences between RAID 0, RAID 1, RAID 5, and RAID 10, along with best practices.