Rman compressed backup provides an efficient way to save space and transfer time over the network when cloning databases.
Here I'm including 2 scripts: Single Instance Backup with Rman and Duplicate Database.
The single instance script is a simplified version of the Rman RAC Backup Script, it includes the backup type as a variable:
v_backt='as compressed backupset'
And then it builds the backup command using this variable:
- Setup a pfile on the destination server
- Setup SQLNet to provide connectivity for the clone on the Source and Target servers
- Create all required directories on the destination server: bdump, udump, cdump, adump, archive log destination, db_create_file_dest
- Copy the Rman backup files, including relevant archived logs, to the destination server into the SAME PATH as in the source server.
If you don't have the same directory structure on the destination server, then you can create a symbolic link to provide the correct path. - Startup nomount the clone database
- Execute the Duplicate Command
- Make a new backup of the source database
- FTP/scp the backup files to the destination server, remember, to the AME PATH as in the source server.
- Use the Drop Database command on the clone to remove all datafiles, controlfiles and redologs:
- shutdown abort;
- startup mount exclusive restrict;
- drop database; - Startup nomount the clone
- Execute the Duplicate Database command