Operating System - HP-UX
1748177 Members
4294 Online
108758 Solutions
New Discussion юеВ

Re: Script archive log transfer to standby db

 
SOLVED
Go to solution
John Flanagan
Regular Advisor

Re: Script archive log transfer to standby db

If anybody is interested this is the script I created. Seems to work OK so far.

John.

livelogno()
{
remsh ptihp1 'ls -t /archive/oradata/PAULIVE/*.ARC | head -n 1 | cut -c 37-46'
}

stdbylogno()
{
ls -t /archive/oradata/PAULIVE/*.ARC | head -n 1 | cut -c 37-46
}

livelogcount=`livelogno`
stdbylogcount=`stdbylogno`
filestocopy=`expr $livelogcount - $stdbylogcount`
echo $livelogcount
echo $stdbylogcount
echo $filestocopy

for arcfile in `remsh ptihp1 'ls -t /archive/oradata/PAULIVE/*.ARC' | head -n $filestocopy`
do
echo $arcfile
echo `rcp ptihp1:$arcfile $arcfile`
done
Brian Crabtree
Honored Contributor
Solution

Re: Script archive log transfer to standby db

John,

Here is the script that I wrote to do what you are talking about. It assumes that you are running with OFA standards (/var/opt/oracle/arch// as a log directory). You will need to change lines 18 and 43 (if not-OFA). Otherwise, it should work. If you want, I can post the script to apply the logs to the standby database as well.

Brian
Brian Crabtree
Honored Contributor

Re: Script archive log transfer to standby db

Forgot attachment. Sorry.
John Flanagan
Regular Advisor

Re: Script archive log transfer to standby db

Brian,

Thanks for the script. My one works but it is probably not the best. I now have 3 scripts 1) to swithch logs on the current system 2) copy log files 3) import log files. All work but I have no logging or error checking so all scripts posted are useful.

As you can see my scripting knowledge is basic and I have a question on your script. Take for example the copy file line

rcp ${j} ${2}:${3}

What do the {} do?

John.
Marty Metras
Super Advisor

Re: Script archive log transfer to standby db

John,

I am doing just what you are asking.
On the Primary Server:
I force a log switch.
I copy the archive logs to a safe directory and another directory for the standby server to pickup and write a file there is only there when there are files for the Standby server to get. Then I remove the files from the Archive Log directory.

On the Standby Server:
The scripts checks to see if there are new files get. When there is it gets them from the primary server and then copies then to a save directory and to the archive log directory. Then it tells Oracle to do the "recover standby database". Then it removes the flag from the Primary server so it will get new files ready.

There are many other things that happen in these scripts. Files are compressed; the program will not run if the primary or standby processes are already running. It checks to see what the last log# was so when the standby was updated the log# should match on both servers. Much more.

I'm using rsync, ssh, sftp and gzip. And the two servers are 1000 miles apart. Oh! 1600km
Also using Oracle 8.0.5 and HP-UX 11.0

I'm in the process of rewriting the scrip to clean it up. Would like to see it?

Marty
The only thing that always remain the same are the changes.
John Flanagan
Regular Advisor

Re: Script archive log transfer to standby db

Marty,

I am allways willing to learn something so I would like to see your scripts. However I am using HP-UX 10.20 and I don't think rsync is available.

Thanks,

John.
Brian Crabtree
Honored Contributor

Re: Script archive log transfer to standby db

The "{}" (brackets) around a variable mean that only the information inside the brackets will be parsed.

ie: Run the following:

export ORACLE=temp
export ORACLE_SID=BLAH
echo ${ORACLE_SID}
echo ${ORACLE}_SID

It is a good idea to use brackets around the variable just to make sure that something doesn't get parsed that you dont want to get parsed.

I will also post the apply script.

Brian