How to Take month wise dump in oracle 10G? - oracle

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.

Related

Oracle expdp and impdp command?

I want to know the Oracle expdp and impdp command for sys user and scott/tiger user for entire database or a particular table.I will be grateful if you share me the script of expdp and impdp.I also want the script of recovery of a entire database and performance tuning.
There is no such "the" script, as in one single script that does whatever you seem to wan. If you want to know how to use expdp and impdp, then check the documentation - the Utilities manual.
And to address one point, using expdp/impdp as SYS, the manual specifically warns against it, with this quote:
Note:
Do not start Export as SYSDBA, except at the request of Oracle
technical support. SYSDBA is used internally and has specialized
functions; its behavior is not the same as for general users.
And there is no single script for " recovery of a entire database". Recovery of an entire database should actually be done with rman, using backups made by rman, not expdp.
And there is certainly no script for "performance tuning." You are looking for simplistic answers to complex issues. Whole books have been written on performance tuning. Performance tuning depends on identifying the cause of poor performance, and that can come from countless unrelated sources.
Before exporting/importing a dump of the database make sure that you have created a directory and give the permissions to read & write on this for the user that will be used to export/import.
Some basic examples for expdp & impdp:
full database export: expdp scott/tiger#orcl directory=mydir dumpfile=expdp_full_db.dmp logfile=expdp_full_db.log full=YES;
table export: expdp scott/tiger directory=mydir dumpfile=table_exp.dmp logfile=table_exp.log table=test
table import: impdp scott/tiger directory=mydir dumpfile=table_exp.dmp logfile=table_exp.log tables=test
These are just some examples. Expdp and impdp provide a lot more useful options and parameters. More details here (https://oracle-base.com/articles/10g/oracle-data-pump-10g )
But keep in mind that EdStevens is right because there is not a 'script' that can be used to solve any problem, especially performance issues.

Is there a way to automatically run select statement in SQL Developer

How or is there a way to automatically run my SELECT statement on a scheduled time? For example, I want my monitoring query to run every 1PM and 8PM. Since this will be done daily, can it be run automatically and just view the results from a csv/excel file or from the result tab? My tool is Oracle SQL Developer.
Usually, we schedule a database job. It can be done using DBMS_SCHEDULER (preferably, especially in latest database versions) or DBMS_JOB (simpler to use).
For example:
create a stored procedure which does the job and inserts the result into some table
schedule it to run at desired times
don't forget to store the timestamp!
any time you want, run select * from some_table to view the result
You can run them via SQLPlus and spool to file. Create a shell script with SQL Plus code in your operating system and use you OS scheduler to run it periodically. Then you can open files and view results.

Scheduling Oracle sql files using Unix based SAS enviornment

I have bunch of SQL queries that run against an Oracle database. Is there a way to schedule these .sql files using UNIX Based SAS, so they can execute one after another at certain time of day?
If they are .sql files, why do you want to schedule them using SAS? Are they SAS programs? If not, I would do one of three things, depending on my constraints:
1) Convert the .sql files to stored procedures and call them from DBMS_SCHEDULER within Oracle, since Oracle has a fantastic job scheduling subsystem (actually multiple variants) that protects against duplicate jobs among other issues, and you get transactional control, auditing and logging. http://docs.oracle.com/cd/B19306_01/appdev.102/b14258/d_sched.htm
2) If converting them to stored procs is too much, then call the .sql scripts directly from DBMS_SCHEDULER with DBMS_SCHEDULER.CREATE_PROGRAM() and then schedule that program with DBMS_SCHEDULER.CREATE_JOB.
3) Use cron or atrun to schedule batch / shell script wrappers that call sqlplus to run .sql files.
If the question is specifically how to do this with SAS, then DBMS_SCHEDULER can still execute external SAS programs using option (2) above.

Oracle daily db backup - without Enterprise Manager

I'm a SQL Server DBA, but we have an Oracle 10g database that I need to start performing daily backups on. We do not have Enterprise Manager. Is there a way to schedule a daily backup in Oracle like in SQL Server?
I apologize if this question is severely elementary for Oracle people, but I've had a very tough time trying to research this and coming up with an answer other than "Use EM".
Easiest in your case is to make a simple Windows Batch script that set ORACLE_HOME and PATH and uses rman to make the backup. Schedule the script in the Windows Task scheduler. Assuming your database is production and because of this runs in archive log mode your script could be something like this:
(I am not a Windows expert so subtle errors might be easy to spot for you)
rman_backup.bat:
ORACLE_SID=your_oracle_sid
ORACLE_HOME=d:/where/your/installation/is
PATH=%ORACLE_HOME%/bin;%PATH%
rman cmdfile=your_rman_actions_script.rman log=your_log_file.log
your_rman_action_script.rman looks like
connect target=/
backup DATABASE PLUS ARCHIVELOG;
For documentation look at Oracle 10g database documentation and start with 2 day dba. After that check out the backup docu found here Administration
I would (but then, my background is more on Unix, less on Windows) do the scheduling from outside the database, using the OS Scheduler to run a backup script. Assuming that no real backup system is available.
In the beginning of backup, you would run a SQL script to place the tablespaces in backup mode (ALTER TABLESPACE x BEGIN BACKUP), then back up the tablespace data files, and after that restore normal mode (ALTER TABLESPACE x END BACKUP). PL/SQL can be used here for looping over all tablespaces.
After that, you'd back up the control file (ALTER SYSTEM BACKUP CONTROLFILE ...), and finally you would rotate the redo logs enough times that all relevant log data has been archived, and back up the archive logs.
And as of doing incremental backups f.ex. throughout the working week, just do the log rotation & archive log copy part.

Can I export dmp file with Oracle jobs?

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.

Resources