• Imprimir

 

 

:

# Preparacao das variaveis.

###########################

# Atribui o ano atual a variavel ano.

ano=$(date +%Y)

# Atribui o mes atual a variavel mes.

mes=$(date +%m)

# Atribui o dia atual a variavel dia.

dia=$(date +%d)

# Atribui o hora atual a variavel hora.

hora=$(date +%H)

# Atribui o minuto atual a variavel minuto.

minuto=$(date +%M)

# Atribui o hostname atual a variavel HOST

host=$('hostname')

# copia os arquivos para o diretorio de backup.

# cp teste1.txt $host'_'$ORACLE_SID'_'$dia$mes$ano$hora$minuto

 

 

######################################### PEGO ESSES DADOS NO .bash_profile do banco 1 la no oracle

# Oracle Settings

TMP=/tmp; export TMP

TMPDIR=$TMP; export TMPDIR

 

ORACLE_HOSTNAME=<<<  HOSTNAME DO SERVIDOR >>>; export ORACLE_HOSTNAME

ORACLE_UNQNAME=<<<  BANCO 1 >>>; export ORACLE_UNQNAME

ORACLE_BASE=/u01/app/oracle; export ORACLE_BASE

ORACLE_HOME=$ORACLE_BASE/product/11.2.0.4/db_1; export ORACLE_HOME

ORACLE_SID=<<<  BANCO 1 >>>; export ORACLE_SID

ORACLE_TERM=xterm; export ORACLE_TERM

PATH=/usr/sbin:$PATH; export PATH

PATH=$ORACLE_HOME/bin:$PATH; export PATH

 

LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib; export LD_LIBRARY_PATH

CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib; export CLASSPATH

 

 

exp <<< USUSARIO BANCO 1 >>>/<<SENHA>>@<<<  BANCO 1 >>> file=/backup/$host'_'$ORACLE_SID'_'$dia$mes$ano$hora$minuto.dmp log=/backup/REPLICA$dia$mes$ano$hora$minuto.log owner=<<< USUSARIO BANCO 1 >>> grants=n statistics=none consistent=y buffer=5000000

 

 

 

######################################### PEGO ESSES DADOS NO .bash_profile do banco 2 la no oracle

# Oracle Settings

TMP=/tmp; export TMP

TMPDIR=$TMP; export TMPDIR

 

ORACLE_HOSTNAME=<<< SCRIPT BACKUP ORACLE EXPORT & RMAN >>>; export ORACLE_HOSTNAME

ORACLE_UNQNAME=<<<  BANCO 2 >>>; export ORACLE_UNQNAME

ORACLE_BASE=/u01/app/oracle; export ORACLE_BASE

ORACLE_HOME=$ORACLE_BASE/product/11.2.0.4/db_1; export ORACLE_HOME

ORACLE_SID=<<<  BANCO 2 >>>; export ORACLE_SID

ORACLE_TERM=xterm; export ORACLE_TERM

PATH=/usr/sbin:$PATH; export PATH

PATH=$ORACLE_HOME/bin:$PATH; export PATH

 

LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib; export LD_LIBRARY_PATH

CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib; export CLASSPATH

 

 

exp <<< USUARIO  BANCO 2 >>>/<<< USUARIO  BANCO 2 >>>@<<<  BANCO 2 >>> file=/backup/$host'_'$ORACLE_SID'_'$dia$mes$ano$hora$minuto.dmp log=/backup/REPLICA2$dia$mes$ano$hora$minuto.log owner=<<< USUARIO  BANCO 2 >>> grants=n statistics=none consistent=y buffer=5000000

 

 

=======================================================================================================================================================================================

 

 

# For details see man 4 crontabs

 

# Example of job definition:

# .---------------- minute (0 - 59)

# |  .------------- hour (0 - 23)

# |  |  .---------- day of month (1 - 31)

# |  |  |  .------- month (1 - 12) OR jan,feb,mar,apr ...

# |  |  |  |  .---- day of week (0 - 6) (Sunday=0 or 7) OR sun,mon,tue,wed,thu,fri,sat

# |  |  |  |  |

# *  *  *  *  * user-name command to be executed

01 06  *  *  * /home/oracle/Scripts/BACKUP_EXP.sh

01 13  *  *  * /home/oracle/Scripts/BACKUP_EXP.sh

01 19  *  *  * /home/oracle/Scripts/BACKUP_EXP.sh

01 23  *  *  * /home/oracle/Scripts/BACKUP_EXP.sh

02 03  *  *  0 oracle /home/oracle/Scripts/rman_domingo.sh

02 03  *  *  1 oracle /home/oracle/Scripts/rman_segunda.sh

02 03  *  *  2 oracle /home/oracle/Scripts/rman_terca.sh

02 03  *  *  3 oracle /home/oracle/Scripts/rman_quarta.sh

02 03  *  *  4 oracle /home/oracle/Scripts/rman_quinta.sh

02 03  *  *  5 oracle /home/oracle/Scripts/rman_sexta.sh

02 03  *  *  6 oracle /home/oracle/Scripts/rman_sabado.sh