Hi All,
This is neto from Brazil
How are you?
Rodrigo found an easier way to do it…
I was talking with my good friend Leighton Nelson (https://twitter.com/@leight0nn) about how to create scripts to automate the auto recovery using pipes.
Captain Nascimento (https://twitter.com/@logwriter) and neto from Brazil (https:// twitter.com/@netofrombrazil) have developed some sample scripts to demonstrate how to use it.
Just to remember… AUTO for Oracle RAC database recovery does not work well, and we will need to execute some queries to find out the exactly change for the recovery.
select name, thread#, sequence#, first_change#, next_change# from v$archived_log where thread#=1 and 7728330471997 between first_change# and next_change#;
With the exactly change number, we will pass it as the STDIN for the sqlplus process (dynamically).
Procedure:
Please execute in the following order:
1) pipev2.sh: As Oracle user run: ./pipev2.sh &
#!/bin/bash
# pipev2.sh — Creating pipes for Oracle sqlplus (easy way) #
# version 2.0
# by neto from Brazil – @netofrombrazil
# Rodrigo Nascimento – @logwriter
rm -f /home/oracle/output
rm -f /home/oracle/sql
mkfifo /home/oracle/sql
cat > /home/oracle/sql <(sqlplus / as sysdba < /home/oracle/sql > /home/oracle/output)
NOTE: sql is the pipe for STDIN and output is for STDOUT
Terminal 2: As Oracle user run:
echo “select * from v\$instance;” > /home/oracle/sql
You can check the output doing: tail –f /home/oracle/output
NOTE: Sending “select * from v$instance” to pipe sql – where it will be redirected to STDIN for sqlplus process
Now, it will be easier to execute queries to find out the change number (check STDOUT) and create dynamic queries to send to sqlplus process (STDIN).
echo “recover database using backup controlfile until cancel;” > /home/oracle/sql
echo “+DG_ARCH/prod/archivelog/2014_01_06/thread_1_seq_27236.1832.836139501” > / home/oracle/sql
Thank you very much for reading.
Thanks my brother Rodrigo.
All the best,
neto
NetApp – I love this company!