Crear una copia de base de datos oracle en otro servidor
Assumed database names:
Primary Database SID: PROD
Duplicate Database SID: AUX
RMAN Catalog SID: RMAN
====================================================================================
Steps
1. Backup the primary database.
2. Determine how much disk space will be required.
3. Ensuring you haveenough space on your target server.
4. Making the backup available for the duplicate process.
5. Creating the init.ora & administration directories for the duplicate database.
6. Ensuring SQL*NET connections to primary database and RMAN catalog are working.
7. Prepare RMAN duplicate script.
8. Execute the RMAN script.=====================================================================================
1. Backup of the primary database.
Host A (Target)
Prior to creating a duplicate database you must have a backup of the target database. In this example we assume the backup media is disk. Find appropriate disk space on host A and take a full backup including archive logs and current controlfile (Figure 1a). If you are planning to duplicate a subset of the databaserefer to (Figure 1b) this illustrates the RMAN command to backing up certain tablespaces.
[oracle@linux] export ORACLE_SID=PROD
[oracle@linux] rman target=/ catalog=rman/rman@RMAN
RMAN> run {
allocate channel d1 type disk;
backup format '/backups/PROD/df_t%t_s%s_p%p' database;
sql 'alter system archive log current';
backup format '/backups/PROD/al_t%t_s%s_p%p' archivelog all;release channel d1;
}
Figure 1a - This command will perform a full database backup including archivelogs and the current controlfile.
[oracle@linux] export ORACLE_SID=PROD
[oracle@linux] rman target=/ catalog=rman/rman@RMAN
RMAN> run {
allocate channel d1 type disk;
backup format '/backups/PROD/df_t%t_s%s_p%p' tablespace SYSTEM, SYSAUX, UNDO, USERS;
sql 'alter system archive logcurrent';
backup format '/backups/PROD/al_t%t_s%s_p%p' archivelog all;
release channel d1;
}
Figure 1b- This command will perform a tablespace backup ( SYSTEM, SYSAUX, UNDO & USERS) including archive logs and the current controlfile.
2. Determine how much disk space will be required.
Host A(Target) -
After deciding what you will be duplicating, calculate the entire space this willrequire on the new host. The full database calculation (Figure 2a) will calculate the entire space required whereas (figure 2b) allows you to enter the tablespace names in order to calculate the space required. Figure 2c provides a sample output.
Note: sql valid for version 10g only.
SQL> select DF.TOTAL/1048576 "DataFile Size Mb",
LOG.TOTAL/1048576 "Redo Log Size Mb",
CONTROL.TOTAL/1048576"Control File Size Mb",
(DF.TOTAL + LOG.TOTAL + CONTROL.TOTAL)/1048576 "Total Size Mb" from dual,
(select sum(a.bytes) TOTAL from dba_data_files a) DF,
(select sum(b.bytes) TOTAL from v$log b) LOG,
(select sum((cffsz+1)*cfbsz) TOTAL from x$kcccf c) CONTROL; Figure 2a - Calculate total space for all datafiles within database.
SQL> select DF.TOTAL/1048576 "DataFile Size Mb",LOG.TOTAL/1048576 "Redo Log Size Mb",
CONTROL.TOTAL/1048576 "Control File Size Mb",
(DF.TOTAL + LOG.TOTAL + CONTROL.TOTAL)/1048576 "Total Size Mb" from dual,
(select sum(a.bytes) TOTAL from dba_data_files a where tablespace_name in ('SYSTEM','UNDOTBS1', 'SYSAUX', 'USERS')) DF,
(select sum(b.bytes) TOTAL from v$log b) LOG,
(select sum((cffsz+1)*cfbsz) TOTAL from x$kcccf c) CONTROL; Figure 2b -Calculate space for list of tablespaces within primary database.
DataFile Size Mb Redo Log Size Mb Control File Size Mb Total Size Mb
---------------- ---------------- -------------------- -------------
900 150 20.34375 1070.34375
Figure 2c - Sample output of space calculation.
3. Ensuring you have enough space on your target server.
Host B...
Regístrate para leer el documento completo.