日期:2014-05-16 浏览次数:20481 次
目的:迁移单实例数据库到oracle rac asm环境下。即迁移原系统hrdbprim数据库到oracle rac ASM环境下hrdb数据库,实现数据库的迁移,转为后的实例为hrdb3。
具体过程如下
1,配置tnsnames.ora文件,实现两个数据库的互相访问
2,设置备库pfile文件,常见备库的初始化pfile文件,根据参数建立相应的目录。1,配置tnsnames.ora文件,实现两个数据库的互相访问
vi tnsnames.ora hrdb_source = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 10.4.×.×)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = hrdbprim) ) ) hrdb = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 10.4.×.×)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = hrdb) ) )
asm使用asmcmd命令进行创建。
vi /oracle/app/oracle/admin/hrdb/inithrdb.ora *.audit_file_dest='/oracle/app/oracle/admin/hrdbb/adump' *.audit_trail='db' *.cluster_database=false *.compatible='11.2.0.0.0' *.control_files='+DATA/hrdb/controlfile/control01.ctl','+FRA/hrdb/controlfile/control02.ctl' *.db_block_size=8192 *.db_create_file_dest='+DATA' *.db_domain='' *.db_name='hrdb' *.db_recovery_file_dest='+FRA' *.db_recovery_file_dest_size=107374182400 *.diagnostic_dest='/oracle/app/oracle' hrdbb3.instance_number=3 hrdbb2.instance_number=2 hrdbb1.instance_number=1 *.log_archive_format='%t_%s_%r.dbf' *.nls_language='SIMPLIFIED CHINESE' *.nls_territory='CHINA' *.open_cursors=1000 *.pga_aggregate_target=1610612736 *.processes=500 *.remote_listener='dtydb-scan2:1521' *.remote_login_passwordfile='exclusive' *.resource_manager_plan='default_plan' *.result_cache_mode='MANUAL' *.sga_target=4399824896 hrdb3.thread=3 hrdb2.thread=2 hrdb1.thread=1 hrdb3.undo_tablespace='UNDOTBS1' hrdb1.undo_tablespace='UNDOTBS3' hrdb2.undo_tablespace='UNDOTBS2' *.standby_file_management='auto'
3,启动备库的监听,新建pfile,spfile文件
startup pfile = '/oracle/app/oracle/admin/hrdb/inithrdb.ora' nomount;
create spfile from pfile='/oracle/app/oracle/admin/hrdb/inithrdb.ora';
startup nomount 启动到mount状态
4,登录到备份数据库,开始rman备份
alter system switch log file; 多运行几次 rman target / run { allocate channel c1 type disk; allocate channel c2 type disk; backup database format '/data/backup/hrdbprim-%U' ; backup archivelog all delete all input format '/data/backup/ARC_%U'; } backup database format '/data/backup/hrdbprim-%U'; backup current controlfile format '/data/backup/%d_control_%s_%c_%p_%T.ctl'; backup archivelog all format '/data/backup/%d_arch_%s_%c_%p_%T.bak'; backup current controlfile format '/data/backup/%d_control_%s_%c_%p_%T.ctl';5,传输备份文件到备库 ,注意最好在同一个目录,要不还需要地址转换,包括备份的控制文件,备份的数据文件和密码文件等
6,备份主机运行如下命令,开始备份
rman target sys/oracle@hrdb_source auxiliary sys/oracle RUN { # The DUPLICATE command uses an automatic sbt channel. # Because the target datafiles are spread across multiple directories, # run SET NEWNAME rather than DB_FILE_NAME_CONVERT SET NEWNAME FOR DATAFILE 1 TO '+DATA/hrdb/datafile/system01.dbf'; SET NEWNAME FOR DATAFILE 2 TO '+DATA/hrdb/datafile/sysaux01.dbf'; SET NEWNAME FOR DATAFILE 3 TO '+DATA/hrdb/datafile/undotbs03.dbf'; SET NEWNAME FOR DATAFILE 4 TO '+DATA/hrdb/datafile/users01.dbf'; # Do not set a newname for datafile 7, because it is in the tools tablespace, # and you are excluding tools from the duplicate database. #SET NEWNAME FOR DATAFILE 8 TO '/oradata7/users01.dbf'; DUPLICATE TARGET DATABASE TO hrdb LOGFILE GROUP 7 ('+DATA/tyolap/onlinelog/redo31a') SIZE 50m REUSE, GROUP 8 ('+DATA/tyolap/onlinelog/redo32a') SIZE 50m REUSE; } duplicate target database to hrdb nofilenamecheck; run { allocate channel c1 device type disk; restore controlfile from '/oracle/app/oracle/product/11.2.0/db_1/dbs/c-4034584542-20120802-01'; alter database mount; }