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)
- Best DevOps is redefining the DevOps landscape - January 28, 2025
- Unlocking the Power of DevOps: How DevOps Consulting Drives Business Success - January 23, 2025
- DevOps Support: Ensuring Seamless Operations and Continuous Improvement - January 23, 2025