【Vegas原创】使用RMAN Duplicate进行本机对本机的复制
duplicate前提条件:
1,用户名必须统一,如oracle用户
2,适用于本机对本机复制
例:将DTLBERP复制,命名为dtlerp。考虑到/u02磁盘空间不够,将原DTLBERP数据文件路径改为/u01路径。
1,建立dtlerp密码文件:
$ orapwd file=orapwdtlerp password=oracle
2,建立dtlerp init文件:
# cd /u02/app/oracle2/product/10.1.0.2.0/db_2/dbs/
# cp initdtlberp.ora initdtlerp.ora
# vi initdtlerp.ora
# cp initdtlberp.ora initdtlerp.ora
# vi initdtlerp.ora
更改initdtlerp.ora:
1),删除:*.local_listener
2),新增:
*.DB_FILE_NAME_CONVERT='/u02/app/oracle2/oradata/dtlberp','/u01/app/oracle/oradata/dtlerp'
*.LOG_FILE_NAME_CONVERT='/u02/app/oracle2/oradata/dtlberp','/u01/app/oracle/oradata/dtlerp'
*.LOG_FILE_NAME_CONVERT='/u02/app/oracle2/oradata/dtlberp','/u01/app/oracle/oradata/dtlerp'
3),更改路径:
db_name,xdump路径,Control_File路径,*.log_archive_dest_1路径
3,按initdtlerp参数新增文件夹:
$ cd admin
$ mkdir dtlerp
$ cd dtlerp
$ mkdir adump bdump cdump dpdump pfile udump
$ cd oradata
$ mkdir dtlerp
$ mkdir dtlerp
$ cd dtlerp
$ mkdir adump bdump cdump dpdump pfile udump
$ cd oradata
$ mkdir dtlerp
4,配置tnsname,Listener:
Listenner:
(SID_DESC =
(GLOBAL_NAME = dtlerp)
(ORACLE_HOME = /u02/app/oracle2/product/10.1.0.2.0/db_2)
(SID_NAME = dtlerp)
)
(GLOBAL_NAME = dtlerp)
(ORACLE_HOME = /u02/app/oracle2/product/10.1.0.2.0/db_2)
(SID_NAME = dtlerp)
)
TNS:
DTLERP =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 10.91.50.5)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = dtlerp)
)
)
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 10.91.50.5)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = dtlerp)
)
)
5,启动dtlerp实例:
$ export ORACLE_SID=dtlerp
$ sqlplus / as sysdba
SQL> create spfile from pfile='$ORACLE_HOME/dbs/initdtlerp.ora';
SQL> startup nomount;
SQL> exit
$ sqlplus / as sysdba
SQL> create spfile from pfile='$ORACLE_HOME/dbs/initdtlerp.ora';
SQL> startup nomount;
SQL> exit
6,分配辅助通道:
$ export ORACLE_SID=dtlberp
$ $ORACLE_HOME/bin/rman target / auxiliary sys/oracle@dtlerp
$ $ORACLE_HOME/bin/rman target / auxiliary sys/oracle@dtlerp
Recovery Manager: Release 10.1.0.2.0 - Production
Copyright (c) 1995, 2004, Oracle. All rights reserved.
connected to target database: DTLBERP (OPEN状态!!!)
connected to auxiliary database: dtlerp (not mounted)
7,确认拥有必备的备份:
RMAN> list backup;
8,如果dtlberp在archivelog模式,则先:
RMAN>sql 'alter system switch logfile';
9,本地复制创建:
duplicate target database to dtlerp nofilenamecheck;
........
contents of Memory Script:
{
Alter clone database open resetlogs;
}
executing Memory Script
database opened
Finished Duplicate Db at 05-JUN-09
喜欢请赞赏一下啦^_^