第二步 确定在同一个主机上执行duplicate复制的数据库名为oradup
原库: al32
新库: oradup
操作系统:红帽5[@more@]
第三步 创建新库所用的dump路径
[oracle@czdb oracle]$ cd /u01/app/oracle/diag/rdbms/
[oracle@czdb rdbms]$ mkdir -p oradup/oradup/cdump
[oracle@czdb rdbms]$ mkdir -p oradup/oradup/trace
[oracle@czdb rdbms]$ mkdir -p oradup/oradup/alert
第四步 创建新库所用的password文件
cd $ORACLE_HOME/dbs
orapwd file=orapworadup password=oracle
第五步 创建新库所用的监听配置
listener.ora文件中添加
SID_LIST_LISTENER =
(SID_LIST=
(SID_DESC=
(GLOBAL_DBNAME=oradup)
(ORACLE_HOME=/u01/app/oracle/product/11.2.0/db_1)
(SID_NAME=oradup)
)
)
tnsnames.ora文件中添加
oradup =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = czdb)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SID = oradup)
)
)
lsnrctl stop
lsnrctl start
sqlplus 'sys/oracle@oradup as sysdba'
验证可以连接
第六步 创建新库所用的初始化参数文件
修改原库的为归档模式之后,复制出pfile,过程如下:
mkdir -p /u01/app/oracle/arch1 /u01/app/oracle/arch2
sqlplus 'sys/oracle@al32 as sysdba'
shutdown immediate
startup mount
alter system set log_archive_dest='location=/u01/app/oracle/arch1';
alter database archivelog ;
alter database open;
shutdown immediate
startup
archive log list
create pfile from spfile;
exit
cd $ORACLE_HOME/dbs
cp inital32.ora initoradup.ora
vi initoradup.ora
compatible='11.2.0.0.0'
control_files='/u01/app/oracle/oradata/oradup/control01.ctl'
core_dump_dest='/u01/app/oracle/diag/rdbms/oradup/oradup/cdump'
db_block_size=8192
db_name='oradup'
db_recovery_file_dest='/u01/app/oracle/flash_recovery_area'
db_recovery_file_dest_size=4977M
diagnostic_dest='/u01/app/oracle'
log_archive_dest_1='location=/u01/app/oracle/arch2'
log_buffer=12288000# log buffer update
sga_target=300M
open_cursors=300
optimizer_dynamic_sampling=2
optimizer_mode='ALL_ROWS'
plsql_warnings='DISABLE:ALL'# PL/SQL warnings at init.ora
processes=150
query_rewrite_enabled='TRUE'
remote_login_passwordfile='EXCLUSIVE'
result_cache_max_size=3136K
sec_case_sensitive_logon=TRUE
skip_unusable_indexes=TRUE
undo_tablespace='UNDOTBS1'
db_file_name_convert='al32','oradup'
log_file_name_convert='al32','oradup'
更改的地方包括:
db_name control_files
core_dump_dest
log_archive_dest_1
db_file_name_convert
log_file_name_convert
第七步 启动nomount新库
sqlplus 'sys/oracle@oradup as sysdba'
startup nomount
第八步 启动rman,同时连接原库和新库
rman target sys/oracle@al32 auxiliary sys/oracle@oradup
duplicate target database to oradup from active database;
检查新库状态
sqlplus 'sys/oracle@oradup as sysdba'
select instance_name,status from v$instance;
扫尾,删除刚才复制的数据库。
$ORACLE_HOME/bin/dbca -silent -deleteDatabase -sourceDB oradup
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/271063/viewspace-1057941/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/271063/viewspace-1057941/