实例环境:
NOCATALOG模式下远程站点不同路径结构完整复制目标数据库ORCL至副本数据库TEST
创建副本数据库实例
C:\Users\DUP>oradim -new -sid test
创建副本数据库实例的密码文件
C:\Users\DUP>orapwd file=D:\oracle\product\10.2.0\db_1\database\PWDtest.ora password=test entries=5 force=y
(Note:D:\oracle\product\10.2.0\db_1为副本数据库ORACLE_HOME)
创建初始化参数文件(inittest.ora)
(如何你没有初始化参数文件模板,可以从目标数据库获取一个,在目标数据库服务器上E:\oracle\product\10.2.0\db_1\database文件夹中(Note:E:\oracle\product\10.2.0\db_1为目标数据库ORACLE_HOME)复制initorcl.ora到副本服务器,如果没有initorcl.ora可以通过一下命令生成:
目标数据库服务器上
C:\Users\TAR>sqlplus / as sysdba
2.修改各个路径,确保能访问,如何没有文件夹,需要手动创建
3.注释control_files参数
#*.control_files='D:\ORACLE\PRODUCT\10.2.0\ORADATA\test\CONTROLFILE\O1_MF_7JX6MZWB_.CTL','D:\ORACLE\PRODUCT\10.2.0\FLASH_RECOVERY_AREA\test\CONTROLFILE\O1_MF_7JX6N000_.CTL'
4.增加数据文件,日志文件复制路径转换参数:
*.DB_FILE_NAME_CONVERT=('E:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\','D:\ORACLE\PRODUCT\10.2.0\ORADATA\test\')
*.LOG_FILE_NAME_CONVERT=('E:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\','D:\ORACLE\PRODUCT\10.2.0\ORADATA\test\')
修改完成后,将该文件重命名为inittest.ora,并复制到D:\oracle\product\10.2.0\db_1\database
用spfile启动数据库到nomount状态
C:\Users\DUP>sqlplus / as sysdba
SQL>startup nomount;
SQL>create spfile from pfile;
SQL>shutdown immediate;
SQL>startup nomount;
2.配置监听和网络服务名
目标服务器配置为静态静态:
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = PLSExtProc)
(ORACLE_HOME = D:\oracle\product\10.2.0\db_1)
(PROGRAM = extproc)
)
(SID_DESC =
(GLOBAL_DBNAME = test)
(ORACLE_HOME = D:\oracle\product\10.2.0\db_1)
(SID_NAME = test)
)
)
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 172.5.19.12)(PORT = 1521))
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC0))
)
)
网络服务名
ORCL =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 172.5.19.91)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = orcl)
)
)
副本数据库配置网络服务名
TEST =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 172.5.19.12)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = test)
)
)
3.备份目标数据库
在副本主机上执行:
C:\Users\DUP>rman target sys/test@orcl auxiliary sys/test
RMAN>configure controlfile autobackup on;
RMAN>configure controlfile autobackup format for device type disk to 'E:\backup\control_%F.bak';
RMAN>run{
allocate channel d1 type disk;
allocate channel d2 type disk;
allocate channel d3 type disk;
backup full database format 'E:\backup\%T_full_%s_%p.bak' plus archivelog format 'E:\backup\%T_archive_%s_%p.bak' delete all input;
release channel d3;
release channel d2;
release channel d1;
}
RMAN>list backup;
4.复制目标数据库至副本数据库
需要确保副本数据库能访问目标数据库的E:\backup路径,如果不可以就需要复制目标数据库E:\backup文件夹中的备份文件到副本数据库的E:\backup路径下
复制完成后执行
执行结束后Duplicate复制数据库就成功
NOCATALOG模式下远程站点不同路径结构完整复制目标数据库ORCL至副本数据库TEST
目标数据库 | 副本数据库 | |
操作系统 | Windows Server 2003 32bit | Windows Server 2003 32bit |
Oracle版本 | Oracle 10g R2 | Oracle 10g R2 |
Oracld_sid | ORCL | TEST |
ORACLE_HOME | E:\oracle\product\10.2.0\db_1 | D:\oracle\product\10.2.0\db_1 |
创建副本数据库实例
C:\Users\DUP>oradim -new -sid test
创建副本数据库实例的密码文件
C:\Users\DUP>orapwd file=D:\oracle\product\10.2.0\db_1\database\PWDtest.ora password=test entries=5 force=y
(Note:D:\oracle\product\10.2.0\db_1为副本数据库ORACLE_HOME)
创建初始化参数文件(inittest.ora)
(如何你没有初始化参数文件模板,可以从目标数据库获取一个,在目标数据库服务器上E:\oracle\product\10.2.0\db_1\database文件夹中(Note:E:\oracle\product\10.2.0\db_1为目标数据库ORACLE_HOME)复制initorcl.ora到副本服务器,如果没有initorcl.ora可以通过一下命令生成:
目标数据库服务器上
C:\Users\TAR>sqlplus / as sysdba
SQL>create pfile from spfile;)
获取到initorcl.ora后,需要修改initorcl.ora的参数:
1.用“test”替换所有的“orcl”2.修改各个路径,确保能访问,如何没有文件夹,需要手动创建
3.注释control_files参数
#*.control_files='D:\ORACLE\PRODUCT\10.2.0\ORADATA\test\CONTROLFILE\O1_MF_7JX6MZWB_.CTL','D:\ORACLE\PRODUCT\10.2.0\FLASH_RECOVERY_AREA\test\CONTROLFILE\O1_MF_7JX6N000_.CTL'
4.增加数据文件,日志文件复制路径转换参数:
*.DB_FILE_NAME_CONVERT=('E:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\','D:\ORACLE\PRODUCT\10.2.0\ORADATA\test\')
*.LOG_FILE_NAME_CONVERT=('E:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\','D:\ORACLE\PRODUCT\10.2.0\ORADATA\test\')
修改完成后,将该文件重命名为inittest.ora,并复制到D:\oracle\product\10.2.0\db_1\database
用spfile启动数据库到nomount状态
C:\Users\DUP>sqlplus / as sysdba
SQL>startup nomount;
SQL>create spfile from pfile;
SQL>shutdown immediate;
SQL>startup nomount;
2.配置监听和网络服务名
目标服务器配置为静态静态:
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = PLSExtProc)
(ORACLE_HOME = D:\oracle\product\10.2.0\db_1)
(PROGRAM = extproc)
)
(SID_DESC =
(GLOBAL_DBNAME = test)
(ORACLE_HOME = D:\oracle\product\10.2.0\db_1)
(SID_NAME = test)
)
)
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 172.5.19.12)(PORT = 1521))
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC0))
)
)
网络服务名
ORCL =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 172.5.19.91)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = orcl)
)
)
副本数据库配置网络服务名
TEST =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 172.5.19.12)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = test)
)
)
3.备份目标数据库
在副本主机上执行:
C:\Users\DUP>rman target sys/test@orcl auxiliary sys/test
RMAN>configure controlfile autobackup on;
RMAN>configure controlfile autobackup format for device type disk to 'E:\backup\control_%F.bak';
RMAN>run{
allocate channel d1 type disk;
allocate channel d2 type disk;
allocate channel d3 type disk;
backup full database format 'E:\backup\%T_full_%s_%p.bak' plus archivelog format 'E:\backup\%T_archive_%s_%p.bak' delete all input;
release channel d3;
release channel d2;
release channel d1;
}
RMAN>list backup;
4.复制目标数据库至副本数据库
需要确保副本数据库能访问目标数据库的E:\backup路径,如果不可以就需要复制目标数据库E:\backup文件夹中的备份文件到副本数据库的E:\backup路径下
复制完成后执行
RMAN>duplicate target database to "test" nofilenamecheck;
若要忽略某个表空间,可以加 skip tablespace ××× 参数(多个表空间可以用“,”隔开)。
执行结束后Duplicate复制数据库就成功