Operating System - HP-UX
1752678 Members
5390 Online
108789 Solutions
New Discussion юеВ

Re: Oracle Hot backup help

 
SOLVED
Go to solution

Oracle Hot backup help

Hi all,

I have requirment to take oracle hot backups in my database server. Let me clarify the situation.
I have all the database backup scripts those works fine through oracle user. However I need to provide this backup taking operation to system backup user. ( the backup user has all the root sys permission, but no shell - goes directly to the backup menu.(shell script)).

I find problem in executing the hot backup through this backup user.
In my backup script I use "su oracle" to login to oracle and in sqlplus to execute
SQL> !find /u02/....../xxx.dbf
kind of shell command.

Any one has any idea why these fails.(I think this happens because backup user doesn't have a shell to execute)

OR
Is there any other way to get it done. (without directly login to oracle, b'cause I cannot provide oracle password to operational staff)

Thnx.
To get out of a difficulty, one usually must go through it
11 REPLIES 11
Naveej.K.A
Honored Contributor

Re: Oracle Hot backup help

hi,

hope the sudo utility would eliminate all your problems

with best wishes
Naveej
practice makes a man perfect!!!
T G Manikandan
Honored Contributor

Re: Oracle Hot backup help

you should either do a

su - oracle

which would set the environment of the oracle user OR

su - oracle -c

The above would also work with the command executed with the oracle user environment.

Thanks
KapilRaj
Honored Contributor

Re: Oracle Hot backup help

Why not have a suit for taking backup

1. Put db in hotbackup mode --- run by oracle
2. Run backup on database files == run by root
3. Put db in to "END backup" mode -- oracle user

We do it this way as it is easy to manage and trouble shoot

As naveej said u may use sudo or setuid to execute things with a higher prevg (eg. root).


Regds,

Kaps
Nothing is impossible
T G Manikandan
Honored Contributor

Re: Oracle Hot backup help

The oracle user should be under the dba group.

If you are not to modify the script,then try including the backup user into the dba group.

But make sure that including the user to the dba group should make him the database owner!!

Re: Oracle Hot backup help

Why not just ask oracle where all the files are:

select name from v$datafile;
select name from v$tempfile;
select name from v$controlfile;
select member from v$logfile;


of course for a hot backup you don't care where the logfiles and tempfiles are.

HTH

Duncan

I am an HPE Employee
Accept or Kudo
Eric Antunes
Honored Contributor
Solution

Re: Oracle Hot backup help

Hi Nuwan,

Why you don't create a shell script scheduled in cron to run by oracle user?

You can create it like this (backup.sh):

ORA_ENVFILE="/discn/.../.env"
DB_NAME=""

ORACLE_SID=""
export ORACLE_SID

svrmgrl << EOT
connect as sysdba;
host 'cp...'; -- here you do your hot backup
quit
EOT

exit 0


Create the script you will schedule (oracle.tmp):

# to run every day except on monday (1)
# at 03:00 AM

00 03 * * 0 $HOME/.../backup.sh
00 03 * * 2 $HOME/.../backup.sh
00 03 * * 3 $HOME/.../backup.sh
00 03 * * 4 $HOME/.../backup.sh
00 03 * * 5 $HOME/.../backup.sh
00 03 * * 6 $HOME/.../backup.sh

And schedule it as the oracle user:

$crontab oracle.tmp



Each and every day is a good day to learn.
malay boy
Trusted Contributor

Re: Oracle Hot backup help

Adding to Anutes reply:

you need to do below command before taking the copy of datafile.

alter tablespace begin backup.

and after the copy , you need to do alter tablespace end backup.

cheers :-)

so it should be like below :

svrmgrl << EOT
connect as sysdba;
alter tablespace begin backup.
host 'cp...'; -- here you do your hot backup
alter tablespace end backup.
quit
EOT
There are three person in my team-Me ,myself and I.
Mobeen_1
Esteemed Contributor

Re: Oracle Hot backup help

Nuwan,
As suggested in the previous posts, i would advise that you use "su - oracle" as against "su oracle".

This is because, "su - oracle" will setup the user environment thats required in this case.

This should get you running

regards
Mobeen


Eric Antunes
Honored Contributor

Re: Oracle Hot backup help

That's right Malay boy: I forgotten to mention the "alter tablespace begin/end backup" instructions...
Each and every day is a good day to learn.