It’s possibile to duplicate a database for testing purposes (it’s an example) using a standby database as source. This allows you to off-load the production environment.
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.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
#!/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 |