One of the RAC environments I'm working with is a very critical production database, there are several development, test and training clones of it, and from time to time a new clone needs to be created.
The main backup strategy we are using is based on EMC snapshots, so we can easily create clones from snapshots.
Still sometimes you get not standard requirements, or find circumstances that require creative solutions.
The special request was:
- Replicate the 64 bit prod database to a 32 bit training environment
- Production is ASM based, training will be File System based
- There is no, and cannot be communication between Prod and Train
- Open read-only a prod snapshot on a recovery server. In my case I did use a server where we automatically open read only the prod snapshots for backup verification.
- Mount NFS the data File System of the training server on the recovery server
- Generate a create controlfile script using :
alter database backup controlfile to trace; - Find the trace on user_dump_destination, rename it to CRCTL.sql and move it to the NFS mounted File System
- Backup the database using rman backup as copy. You will get files named like:data_D-PRODDB_I-2123417810_TS-UNDOTBS2_FNO-21_g5il8cge
- Once the backup finish make a list of the file names order according the FNO-# ; from FNO-1 until the last file
- Optionally you may rename the files to a more simple name, like :mv data_D-PRODDB_I-2123417810_TS-UNDOTBS2_FNO-21_g5il8cge UNDOTBS2_01.dbf
- Edit the create controlfile script, change the database name using the 'set database ' clause. Replace the datafile names on the CRCTL.sql script you generated on step 3 with the names of the datafiles you got from Rman (or you renamed on step 7) take care to order them according their File Number: FNO-1, FNO-2 etc.
- If this is the first time you clone a database in this server you will need to create the init.ora, and set the bdump, udump, cdump and archived log destinations
- Recreate the controlfile using the CRCTL.sql and open the database with resetlogs.
- Shutdown the database and open it in migrate mode:
startup migrate; - Execute utlirp.sql to change the word size from 64 to 32 bits
@?/rdbms/admin/utlirp.sql - Shutdown immediate
- Startup normal
This is the rman script:
#!/bin/ksh
echo `date` >start.backup
# Environment Variables
# ---------------------
export ORACLE_SID=proddb
export ORACLE_BASE=/u01/app01/oracle
export ORACLE_HOME=/u01/app01/oracle/product/10.2.0.3
# Path Variables
# --------------
export BASE_PATH=/u01/app01/oracle/scripts/general:/usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/X11R6/bin:/root/bin:/u01/app01/oracle/scripts
v_bdest=/NFSmnt/traindb
export PATH=${ORACLE_HOME}/bin:${BASE_PATH}
# Backup database
# ---------------
rman target / nocatalog <<EOF
run {
allocate channel backup_disk1 type disk format '$v_bdest/%U';
allocate channel backup_disk2 type disk format '$v_bdest/%U';
allocate channel backup_disk3 type disk format '$v_bdest/%U';
allocate channel backup_disk4 type disk format '$v_bdest/%U';
allocate channel backup_disk5 type disk format '$v_bdest/%U';
allocate channel backup_disk6 type disk format '$v_bdest/%U';
allocate channel backup_disk7 type disk format '$v_bdest/%U';
allocate channel backup_disk8 type disk format '$v_bdest/%U';
backup as COPY database include current controlfile;
release channel backup_disk1;
release channel backup_disk2;
release channel backup_disk3;
release channel backup_disk4;
release channel backup_disk5;
release channel backup_disk6;
release channel backup_disk7;
release channel backup_disk8;
}
exit
EOF
echo `date` >end.backup
# EOF backup_to_fs
Comments (1)
HI Alejandro,
very interesting how you solved this issue. But if it were a different platform aswell? In 10.2 there is the option of using 'convert database' with rman.
regards, Tony van Esch
Posted by Tony van Esch | August 10, 2007 1:35 AM
Posted on August 10, 2007 01:35