日期:2014-05-16 浏览次数:20449 次
RAC迁移到单节点
从RAC迁移到单节点可以用备份导出导入的方法,也可以用RMAN,下面实验下RMAN的做法
实验数据库RAC无闪回区,10.2.0版本,迁移到rac2所在主机的orcl实例
1.备份数据库,备份归档
run{
sql 'alter system archive log current';
backup database format '+backup/full_%T_%s_%p'
include current controlfile;
}
run{
allocate channel t1 type disk connect 'sys/fishcat@rac1';
allocate channel t2 type disk connect 'sys/fishcat@rac2';
BACKUP
FORMAT '+backup/arch_%T_%s_%p'
SKIP INACCESSIBLE
ARCHIVELOG ALL DELETE INPUT;
release channel t1;
release channel t2;
}
2.复制dump目录
[oracle@node2 admin]$ cp -r rac orcl
3.修改pfile文件
在源数据库上
SQL> create pfile='/tmp/pfile.ora' from spfile;
File created.
内容如下:
[oracle@node1 tmp]$ cat pfile.ora.bak
rac2.__db_cache_size=83886080
rac1.__db_cache_size=71303168
rac2.__java_pool_size=4194304
rac1.__java_pool_size=4194304
rac2.__large_pool_size=4194304
rac1.__large_pool_size=4194304
rac2.__shared_pool_size=71303168
rac1.__shared_pool_size=83886080
rac2.__streams_pool_size=0
rac1.__streams_pool_size=0
*.audit_file_dest='/home/oracle/admin/rac/adump'
*.background_dump_dest='/home/oracle/admin/rac/bdump'
*.cluster_database_instances=2
*.cluster_database=true
*.compatible='10.2.0.1.0'
*.control_files='+G1/rac/controlfile/current.256.804551605'
*.core_dump_dest='/home/oracle/admin/rac/cdump'
*.db_block_size=8192
*.db_create_file_dest='+G1'
*.db_domain=''
*.db_file_multiblock_read_count=16
*.db_name='rac'
*.dispatchers='(PROTOCOL=TCP) (SERVICE=racXDB)'
rac1.instance_number=1
rac2.instance_number=2
*.job_queue_processes=10
rac2.log_archive_dest_1='location=/archive/rac2'
rac1.log_archive_dest_1='location=/archive/rac1'
*.open_cursors=300
*.pga_aggregate_target=16777216
*.processes=150
*.remote_listener='LISTENERS_RAC'
*.remote_login_passwordfile='exclusive'
*.sga_target=167772160
rac2.thread=2
rac1.thread=1
*.undo_management='AUTO'
rac1.undo_tablespace='UNDOTBS1'
rac2.undo_tablespace='UNDOTBS2'
*.user_dump_dest='/home/oracle/admin/rac/udump'
修改后如下:
*.audit_file_dest='/home/oracle/admin/orcl/adump'
*.background_dump_dest='/home/oracle/admin/orcl/bdump'
*.cluster_database=false
*.compatible='10.2.0.1.0'
*.control_files='/home/oracle/oradata/orcl/control01.ctl',/home/oracle/oradata/orcl/control02.ctl',/home/oracle/oradata/orcl/control03.ctl'
*.core_dump_dest='/home/oracle/admin/orcl/cdump'
*.db_block_size=8192
*.db_create_file_dest='/home/oracle/oradata/orcl'
*.db_domain=''
*.db_file_multiblock_read_count=16
*.db_name='orcl'
*.job_queue_processes=10
*.log_archive_dest_1='location=/archive2'
*.open_cursors=300
*.pga_aggregate_target=16777216
*.processes=150
*.remote_login_passwordfile='exclusive'
*.sga_target=167772160
*.undo_management='AUTO'
*.undo_tablespace='UNDOTBS1'
*.user_dump_dest='/home/oracle/admin/orcl/udump'
*.log_file_name_convert=('+G1/rac/onlinelog','/home/oracle/oradata/orcl')
*.db_file_name_convert=('+G1/rac/datafile','/home/oracle/oradata/orcl')
*.db_file_name_convert=('+G1/rac/tempfile','/home/oracle/oradata/orcl')
------------------------
*.log_file_name_convert=('+G1/rac/onlinelog','/home/oracle/oradata/orcl')
*.db_file_name_convert=('+G1/rac/datafile','/home/oracle/oradata/orcl')
*.db_file_name_convert=('+G1/rac/tempfile','/home/oracle/oradata/orcl')
上面这三行是转换logfile,dbfile,tempfile路径,如果一样则不必修改
4.制作RMAN脚本
根据语句
select 'set newname for datafile '||file_id||' to "/home/oracle/oradata/orcl/'||substr(file_name,18)||'";' fro