This is a simple script that makes use of ASM and classic duplicate, although I guess it’s possible to use the standby DB for a duplicate from active database.
You can launch it everyday to align your test env at a point in time.
#!/bin/bash
if [ $USER != 'oracle' ] ; then
echo "need to be oracle"
exit 0
fi
. $HOME/set11
export ORACLE_SID=test1
srvctl stop database -d test -o immediate
## this is supposed to be a script that erase your ASM from your old test dbfiles:
## it's as simple as running with the CORRECT ENV:
## asmcmd rm -rf \
## +DATA/TEST/ONLINELOG
## +DATA/TEST/DATAFILE
## +DATA/TEST/CONTROLFILE
## +DATA/TEST/TEMPFILE
## +FRA/TEST/ONLINELOG
## +FRA/TEST/CONTROLFILE
ssh grid@testsrv /shared/refresh_test/remove_test_files.sh
sqlplus / as sysdba < <EOF
set echo on
startup nomount
alter system set cluster_database=false scope=spfile;
shutdown immediate
startup nomount
EOF
rman <<EOF
connect target sys/mystrongpassword@stdby
connect auxiliary /
duplicate database to 'test' until time "trunc(sysdate)+6/24";
EOF
sqlplus / as sysdba <<EOF
set echo on
alter system set cluster_database=true scope=spfile;
shutdown immediate
startup mount
alter database noarchivelog;
shutdown immediate
EOF
srvctl start database -d test
https://www.ludovicocaldara.net/dba/tag/standby/
Latest posts by rajeshkumar (see all)
- Ansible ERROR! ‘import’ is not a valid attribute for a Play - August 8, 2023
- Ansible Error: module whether to use the yum (yum3) or dnf (yum4) backend}) - August 7, 2023
- Kubernetes Gateway selection for Istio in Knative - August 7, 2023