How to set backup automatically? [message #682731] |
Thu, 12 November 2020 19:28 ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
![](http://www.gravatar.com/avatar/dbab49313fcda3b058d482aa67dab9ec?s=64&d=mm&r=g) |
solution
Messages: 13 Registered: November 2020
|
Junior Member |
|
|
I have just .sh file. Now How can I set backup automatically?
export ORACLE_SID=mydborcl
export ORACLE_HOME=/u01/app/oracle/product/12.1.0/db_1
export PATH=$ORACLE_HOME/bin:$PATH
export NLS_LANG='AMERICAN_AMERICA.AL32UTF8'
expdp adminuser/Mypassword@mydborcl schemas=adminuser directory=my_db1 dumpfile=adminuser_`date +%Y%m%d`.dmp logfile=adminuser_`date +%Y%m%d`.log
|
|
|
|
|
|
Re: How to set backup automatically? [message #682739 is a reply to message #682737] |
Fri, 13 November 2020 04:37 ![Go to previous message Go to previous message](/forum/theme/orafaq/images/up.png) ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
John Watson
Messages: 8944 Registered: January 2010 Location: Global Village
|
Senior Member |
|
|
solution wrote on Fri, 13 November 2020 07:28Is it right?
How to set it every week? That will never work. You have concatenated the three fields for day-of-month, month-of-year, and day-of-week into one. And you are trying to run a script in the root directory, which is somewhat unlikely. The script you have is not reliable either: at the very least you need a #! at the beginning to specify a shell.
|
|
|
|
Re: How to set backup automatically? [message #682741 is a reply to message #682740] |
Fri, 13 November 2020 08:09 ![Go to previous message Go to previous message](/forum/theme/orafaq/images/up.png) ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
![](http://www.gravatar.com/avatar/d29f577f753cb4b873212fd5ed0da4cd?s=64&d=mm&r=g) |
EdStevens
Messages: 1376 Registered: September 2013
|
Senior Member |
|
|
solution wrote on Fri, 13 November 2020 06:24Could you solve this it?
I am very new on linux.
I have to run the script every 02 am or every week.
They've given you all the clues.
First, you don't want to do ANYTHING as the root user, unless you ABSOLUTELY need that elevated level of privilege. You should have an OS user that owns the oracle installation. This user is usually named 'oracle'. Connect as 'oracle' and create your crontab from there.
Your crontab that you show indicates that your script is located in the root directory. Not a good place for it. You should have a directory owned by 'oracle' where you keep your oracle scripts. At the very least, /home/oracle/.
Your script should begin with a directive to indicate which shell (sh, ksh, bash, etc) you want to process your script. I usually use 'sh', so the directive is '#!/bin/sh'.
You said "I have to run the script every 02 am or every week." I *think* you meant "run the script at 02 am on every week." (I'll chalk that up to English not being your first language.) So, what day of the week? I could spoon feed you on that, but you'd learn far more by going back to a good reference on 'cron' and figuring it out. Present your best effort and we'll comment on it to nudge you to self-discovery.
BTW, you mentiond in the title that this is a 'backup' job. But your script is running expdp. I do hope that you are not relying strictly on exports as your only backup strategy. You really need to be using rman for your primary backup mechanism.
|
|
|
|
Re: How to set backup automatically? [message #682749 is a reply to message #682748] |
Sat, 14 November 2020 03:04 ![Go to previous message Go to previous message](/forum/theme/orafaq/images/up.png) ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
![](http://www.orafaq.com/forum/images/custom_avatars/102589.gif) |
Michel Cadot
Messages: 68675 Registered: March 2007 Location: Nanterre, France, http://...
|
Senior Member Account Moderator |
|
|
Quote:I thought "expdp" is full backup of database.
No it is a data and schema backup not a database level backup.
Quote:Should I use 'rman' to do backup full db on everyday?
Yes, no, it depends on your restore and recover requirements but it is sure you should use RMAN to backup.
First read Database Backup and Recovery User's Guide, chapter 1 Introduction to Backup and Recovery.
First of all, are you in ARCHIVELOG mode?
[Updated on: Sat, 14 November 2020 03:21] Report message to a moderator
|
|
|
|
|
|
Re: How to set backup automatically? [message #682759 is a reply to message #682757] |
Mon, 16 November 2020 19:36 ![Go to previous message Go to previous message](/forum/theme/orafaq/images/up.png) ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
![](http://www.gravatar.com/avatar/dbab49313fcda3b058d482aa67dab9ec?s=64&d=mm&r=g) |
solution
Messages: 13 Registered: November 2020
|
Junior Member |
|
|
Since I read I have to us RMAN backup job.
The set of BACKUP commands executed within a single RMAN session. For example, assume that you start the RMAN client, execute BACKUP DATABASE, BACKUP ARCHIVELOG, and RECOVER COPY, and then exit the RMAN client. The RMAN backup job consists of the database backup and the archived redo log backup.
Am I right?
[Updated on: Mon, 16 November 2020 19:37] Report message to a moderator
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Re: How to set backup automatically? [message #683396 is a reply to message #683386] |
Thu, 07 January 2021 10:48 ![Go to previous message Go to previous message](/forum/theme/orafaq/images/up.png) |
![](http://www.gravatar.com/avatar/d29f577f753cb4b873212fd5ed0da4cd?s=64&d=mm&r=g) |
EdStevens
Messages: 1376 Registered: September 2013
|
Senior Member |
|
|
solution wrote on Wed, 06 January 2021 20:53I found no luck until now.
@gazzag
Quote:The 5th parameter is day of the week with 0 = Sunday and 5 = Friday.
HTH
-g
Can you write the full script of it?
EdStevens wrote on Mon, 30 November 2020 09:06
SHOULD you use that script. Probably not. It appears you are ignoring the link that Michael has posted multiple times. Then you jump into the deep end of some rather special purpose uses of rman.
.
Please provide me right section I need.
See the previously cited document. See section 9.3.1 Backing Up a Whole Database with RMAN
Be sure to back up the archivelogs as well.
Be sure to include the option to delete the archivelogs after they have been backed up. BTW, you previously asserted that you are in archivelog mode. What are you currently doing to prevent the archivlog destination from filling up?
Be sure to include command to delete obsolete backups.
In addition to the previously cited RMAN User Guide, you should also be reading the Database Backup and Recovery Reference.
|
|
|