Can I export dmp file with Oracle jobs? - oracle

Now I'm too keen to know how can I export dmp file with Oracle jobs? It's because of I'm very new to Oracle and don't know how to backup Oracle with jobs like MsSQL bachup with schedule. That's why I want to know what I asked.

You can fairly easy setup a backup scheduled by the database. Best approach for this is to install the Oracle Scheduler Remote Job Agent - local to the database - and configure that agent in the database that holds your backup schedule. This can be the database itself, it can also be a central backup schedule database, all a matter of taste.
Oracle Scheduler is very powerful and can execute tasks in the local database, in remote database[s], on the local server and on remote servers. If using OS type of jobs, best is to use the 11g Remote Scheduler Agent. Don't use the old fashioned 10g style External Jobs. Use remote jobs with defined credentials.
For help look at my blog where you also find pointers to docu.
After you installed and configured the job agent to be a valid target for the database that performs the scheduling, easiest is to use dbconsole to define the jobs. If you configure the dbconsole, it also gives an option to generate auto backup jobs. Maybe this is already enough. You asked for export and there expdp with the Oracle Scheduler does a wonderful job.

You can run an OS process from Oracle Job using Java Stored Procedure or a C program.
See this blog entry,

Instead of exporting dump using the old imp/exp utilities to generate dmp files, look at Oracle Datapump, especially since from the tags I infer you're using Oracle 11g.
Data pump supports table-level, tablespace-level, schema-level & full export modes and is kown to be consdirably faster than the previous imp/emp tools.
Further reading:
Export/import with Oracle Data pump
Oracle Documentation on Data pump
know how can I export dmp file with Oracle jobs?
That's not possible. The emp tools runs outside the database, while jobs run within. if you want scheduled exports perhaps you could use a cronjob/scheduled task.

Related

How to Take month wise dump in oracle 10G?

I have database. I need to take back up of table month wise. so how to take backup in month wise in oracle 10G?
You don't mean "backup". Backup implies recovery, and a monthly dump is no good for recovery purposes. That's why Nature gave us RMAN.
The Oracle export and import tool is called Data Pump. We can run this as an external command or with a PL/SQL API. Find out more.
Running a monthly export requires a scheduling tool. Use an OS command such as cron to run a shell script invoking the command line expdp or the built-in DBMS_SCHEDULER to run a stored proc using DBMS_DATAPUMP.

Run commandline command at remote Oracle server using SQL*Plus

I have a machine running Oracle 10g server in windows server 2008. I want to take backup of the database. I also want to take backup of some files saved on hard disk by oracle server that users have uploaded using my website.
I can connect to the Oracle server using sql developer and sqlplus. I can run sql queries on the server.
In order to take backup of database I have to run the command "exp" (this is the only way of taking backup of databases that I know). There might be some other way but there is another problem because of which I must run dos command. That problem is to take backup of files. These files are stored in c:\mydir. The folder mydir is not accessible anyway through web and is not a shared folder.
I have tried running "host " in sqlplus after connecting to oracle server, that is at "sql>" prompt. The command ran successfuly but at local machine, not at oracle server.
Edit: The "host" command is provided by sqlplus and is not an oracle command, means cannot be used in a query. Sqlplus even when connected to remote machine run the "host" command at local machine.
The target is to either make sqlplus run the "host" command at remote machine, Or run the dos command from inside a pl/sql query (independent of sqlplus).
In addition to what Justin has written:
If you want to take a logical snapshot of the database the new DataPump tool is preferred over the old (and deprecated) exp tool.
DataPump is a commandline tool (expdp) but also has a SQL API through Oracle packages and procedures.
The Data Pump API (including examples)
DBMS_DATAPUMP (reference)
But if you want a "real" backup you should look into RMAN
It is possible to create a Java stored procedure on the database server that executes an operating system command on the Oracle server. But it would be extremely unusual to use the export utility to backup a database-- that only creates a logical backup not a more appropriate physical backup. And it would be extremely unusual to run a backup by connecting to the database via SQL*Plus and spawning a job on the server operating system. It would make much more sense to create a job using the Windows scheduler on the database server that ran whatever export commands you want to run.

Selective tables/objects Oracle Backup

I need to automate a selective table / user object backup I currently am doing via PL / SQL Developer.
The way I currently do it is via Tools/Export Tables and Tools/Export User Objects, manually select tables / objects, then set the options, choose destination and export. I do this from a windows laptop and the database is located in a suse linux server, both are in the same LAN. DB is running 24/7 and can not be shutdown. Also currently my oracle programming skills are very basic as I only do maintenance to this solution. I would like to keep doing the backup process in the windows laptop, but I would consider a server side script solution also and then retrieving the .sql files from server.
Thanks in advance
I wouldn't really call it a backup, but look at exp/imp and expdp/impdp (data pump) in the Utilities manual
As Gary implies exp/imp really isn't a backup solution. If this database is important to you or others, figure out how to use RMAN , which is usually configured to run in a mode that doesn't require the database to be shut down. Although it executes on the database host and for non-tape destinations must write its files to a filesystem attached to the host, it can be launched remotely.
RMAN is aimed at restoring/recovering the entire database, so if what you're looking for is only the ability to recover isolated objects it may not be for you.

How can I replicate an Oracle 11g database(data+structure) on my local machine for development?

I am working on a test server with an Oracle 11g installed. I was wondering if there is anyway I can replicate the database(environment + data) on my local Linux machine. I am using a CentOS 5.3 on Windows XP with SUN Virtual Box. On Windows I am using sqldeveloper client to connect to the 11g database.
There are a number of ways to move the data over:
Restore an RMAN backup on your test server
Export and import the data using exp/expdp/imp/impdp
Export and import using a transportable tablespace (Further Info)
Use database links to duplicate the data using SQL
You can use the Database Configuration Assistant to generate a template from your production database. This will give you all the parameters and tablespaces, among other things. You will need to tweak the configuration somewhat; for instance the file paths may be wrong, and some parameters may need downsizing. You can then feed that template into DBCA to clone the database on you Linux machine.
To get the schemas and data you should use Data Pump (rather than the older Import / Export utlities). This can be run off the command line or from PL/SQL.
Bear in mind that using production data in a development or test environment can cause you to run foul of data protection laws and other compliance issues. It depends on what your application does and what jurisdiction you operate under. But if your production system contains citizens' personal data you need to be very careful. There are products out there which will apply masking as part of a data import process (Oracle sells one) but they tend to be expensive. Rolling your own masking product can be tricky: if this applies to your situation be sure to get your compliance staff (legal team) involved early.
I would suggest you install Oracle XE which is free to use on your local if your development is not something that is related to core database features. You can then use the methods given above to pump data into Oracle XE and compile your code on it, though for development I don't think you would need data as much as that in production.

Running RMAN Scripts with the job scheduler (Oracle)

Here's a good one for any Oracle gurus out there. I'm working on a web page that dynamically configures Oracle DB backup settings in a closed environment. Right now, I have everything set up to generate scheduled jobs that run pre-determined RMAN scripts that already exist on the Database server's disk. This works, but I want to go a step further.
Is there any way to create jobs with the scheduler that will run RMAN scripts which haven't first been written to disk? For example, is it possible to fire off an RMAN backup script directly from the scheduler by using a pipe of some sort? I've found some vague information on the RMAN Pipe Interface, but I can't see how I could create a private pipe, pack it with RMAN commands, and then feed it to RMAN all in one job run... Any thoughts would be very much appreciated.
In anything related to backup/restore of the database, I advise you to prefer OS's means to execute scheduled jobs (cron/at on unix, Scheduled tasks on Windows). The advantage is that they are independent from oracle instance and you can better handle cases when oracle instance is down or malfunctioning. The "RMAN pipe interface" is meant to be used together with operating system's shell, as well.
However, executing scripts directly from database is also possible: AskTom
If you want to use DBMS_SCHEDULER then the script has to reside on the database server.
But if you install an Oracle client on the web server you can run RMAN from there and connect to the TARGET database. E.g.:
rman 'usr/pwd#conn_str AS SYSDBA' CMDFILE /home/www/db/backup-full.rman
In this case the script can reside on the web server.
Hope this helps.

Resources