1、数据库备份
RUN {
ALLOCATE CHANNEL ch00 DEVICE TYPE disk;
ALLOCATE CHANNEL ch01 DEVICE TYPE disk;
ALLOCATE CHANNEL ch02 DEVICE TYPE disk;
ALLOCATE CHANNEL ch03 DEVICE TYPE disk;
ALLOCATE CHANNEL ch04 DEVICE TYPE disk;
ALLOCATE CHANNEL ch05 DEVICE TYPE disk;
backup as compressed backupset database filesperset 5 format '/backup/bk_%d_%T%s_%p' ;
sql 'alter system archive log current';
backup current controlfile format '/backup/ctl_%d_%T_%s';
RELEASE CHANNEL ch00;
RELEASE CHANNEL ch01;
RELEASE CHANNEL ch02;
RELEASE CHANNEL ch03;
RELEASE CHANNEL ch04;
RELEASE CHANNEL ch05;
}
备份完成后多切换几次redo日志
2、数据库恢复
一 检验条件

二 准备工作
拷贝备份文件到目标服务器:scp -r backup/ 10.168.39.243:/backup

1 创建相关目录
两节点
mkdir -p /oracle/admin/orcl/adump
mkdir -p /oracle/admin/orcl/bdump
mkdir -p /oracle/admin/orcl/cdump
mkdir -p /oracle/admin/orcl/udump
mkdir -p /oracle/admin/orcl/pfile
mkdir -p /oracle/arch

节点1
mkdir /rac_arch1
chown -R oracle:oinstall /rac_arch1/
chmod -R 775 /rac_arch1/
节点2
mkdir /rac_arch2
chown -R oracle:oinstall /rac_arch2/
chmod -R 775 /rac_arch2/

2参数文件
使用oracle用户

vi pfile0928.ora

orcl2.__db_cache_size=1090519040
orcl1.__db_cache_size=1140850688
orcl1.__java_pool_size=16777216
orcl2.__java_pool_size=16777216
orcl1.__large_pool_size=16777216
orcl2.__large_pool_size=33554432
orcl2.__shared_pool_size=402653184
orcl1.__shared_pool_size=369098752
orcl1.__streams_pool_size=16777216
orcl2.__streams_pool_size=16777216
*.audit_file_dest='/oracle/admin/orcl/adump'
*.background_dump_dest='/oracle/admin/orcl/bdump'
*.cluster_database_instances=2
*.cluster_database=true
*.compatible='10.2.0.5.0'
*.control_files='+ORCLDATA/orcl/controlfile/current01.ctl','+ORCLDATA/orcl/controlfile/current02.ctl','+ORCLDATA/orcl/controlfile/current03.ctl'
*.core_dump_dest='/oracle/admin/orcl/cdump'
*.cursor_sharing='FORCE'
*.db_block_size=8192
*.db_create_file_dest='+ORCLDATA'
*.db_domain=''
*.db_file_multiblock_read_count=16
*.db_name='orcl'
*.db_writer_processes=2
*.dispatchers='(PROTOCOL=TCP) (SERVICE=orclXDB)'
orcl2.instance_number=2
orcl1.instance_number=1
*.job_queue_processes=10
orcl1.local_listener='(ADDRESS=(PROTOCOL=TCP)(HOST=10.168.39.242)(PORT=1521))'
orcl2.local_listener='(ADDRESS=(PROTOCOL=TCP)(HOST=10.168.39.244)(PORT=1521))'
#orcl1.log_archive_dest_1='location=/rac_arch1'
#orcl2.log_archive_dest_1='location=/rac_arch2'
*.log_archive_dest_1='location=/backup'
*.open_cursors=300
*.optimizer_index_caching=95
*.optimizer_index_cost_adj=5
*.optimizer_mode='FIRST_ROWS_10'
*.pga_aggregate_target=3359637504
*.processes=1000
orcl1.processes=1500
orcl2.processes=1500
*.remote_listener='LISTENERS_ORCL'
*.remote_login_passwordfile='exclusive'
orcl1.sessions=1655
orcl2.sessions=1655
*.sga_target=1610612736
orcl2.thread=2
orcl1.thread=1
*.undo_management='AUTO'
orcl2.undo_tablespace='UNDOTBS2'
orcl1.undo_tablespace='UNDOTBS1'
*.user_dump_dest='/oracle/admin/orcl/udump'

三 启动实例

$ export ORACLE_SID=orcl1
sqlplus / as sysdba
startup nomount pfile='/oracle/pfile0928.ora'

四 恢复控制文件

rman target /

set dbid=1340406187

restore controlfile from '/backup/ctl_ORCL_20150928_7830';

六 恢复数据库

alter database mount;

run {
ALLOCATE CHANNEL ch00 DEVICE TYPE disk;
ALLOCATE CHANNEL ch01 DEVICE TYPE disk;
ALLOCATE CHANNEL ch02 DEVICE TYPE disk;
ALLOCATE CHANNEL ch03 DEVICE TYPE disk;
restore database;
RELEASE CHANNEL ch00;
RELEASE CHANNEL ch01;
RELEASE CHANNEL ch02;
RELEASE CHANNEL ch03;
}

注册归档日志:
catalog archivelog '/backup_243/1_24712_812625454.dbf';
catalog archivelog '/backup_243/1_24713_812625454.dbf';
catalog archivelog '/backup_243/1_24714_812625454.dbf';
catalog archivelog '/backup_243/1_24715_812625454.dbf';
catalog archivelog '/backup_243/1_24716_812625454.dbf';
catalog archivelog '/backup_243/2_22519_812625454.dbf';
catalog archivelog '/backup_243/2_22520_812625454.dbf';
catalog archivelog '/backup_243/2_22521_812625454.dbf';
catalog archivelog '/backup_243/2_22522_812625454.dbf';
catalog archivelog '/backup_243/2_22523_812625454.dbf';

run {
ALLOCATE CHANNEL ch00 DEVICE TYPE disk;
ALLOCATE CHANNEL ch01 DEVICE TYPE disk;
ALLOCATE CHANNEL ch02 DEVICE TYPE disk;
ALLOCATE CHANNEL ch03 DEVICE TYPE disk;
recover database;
RELEASE CHANNEL ch00;
RELEASE CHANNEL ch01;
RELEASE CHANNEL ch02;
RELEASE CHANNEL ch03;
}

六 打开数据库

SQL> alter database open resetlogs;

七 数据库整理
修改spfile启动 shutdown immediate
create spfile='+ORCLDATA/orcl/SPFILE/spfileorcl.ora' from pfile='/oracle/product/10.2.0/db_1/dbs/initorcl1.ora';
echo "SPFILE='+ORCLDATA/orcl/SPFILE/spfileorcl.ora'" > /oracle/product/10.2.0/db_1/dbs/initorcl1.ora
startup
show parameter spfile
八、启用集群特性:
select * from v$option where parameter = 'Real Application Clusters';
show parameter cluster
alter system set cluster_database=true scope=spfile;
alter system set cluster_database_instances=2 scope=spfile;
alter system set instance_number=1 scope=spfile sid='orcl1';
alter system set instance_number=2 scope=spfile sid='orcl2';
alter system set thread=1 scope=spfile sid='orcl1';
alter system set thread=2 scope=spfile sid='orcl2';
新建一组UNDO 表空间和线程2 使用的两组REDO 文件:这里已经创建。
alter database enable thread 2;
修改归档路径为两个节点:
alter system set log_archive_dest_1='location=/arch1' scope=spfile  sid='orcl1';
alter system set log_archive_dest_1='location=/arch2' scope=spfile sid='orcl2';

节点2
export ORACLE_SID=orcl2
echo "SPFILE='+ORCLDATA/orcl/SPFILE/spfileorcl.ora'" > /oracle/product/10.2.0/db_1/dbs/initorcl2.ora
sqlplus / as sysdba
startup
set line 150 pages 1000
show parameter cluster;
select instance_number,instance_name,host_name from v$instance;
select instance_number,instance_name,host_name from gv$instance;
注册到OCR
srvctl add database -d orcl -o $ORACLE_HOME -p +ORCLDATA/orcl/SPFILE/spfileorcl.ora
srvctl add instance -d orcl -i orcl1 -n hostname1
srvctl add instance -d orcl -i orcl2 -n hostname2
srvctl start database -d orcl

监听 、tnsnames.ora
alter system set local_listener='(ADDRESS = (PROTOCOL = TCP)(HOST =10.168.34.243)(PORT = 1521))' scope=both sid='orcl1';
alter system set local_listener='(ADDRESS = (PROTOCOL = TCP)(HOST =10.168.34.245)(PORT = 1521))' scope=both sid='orcl2';

tnsnames.ora
LISTENERS_ORCL =
  (ADDRESS_LIST =
    (ADDRESS = (PROTOCOL = TCP)(HOST = hostname1-vip)(PORT = 1521))
    (ADDRESS = (PROTOCOL = TCP)(HOST = hostname2-vip)(PORT = 1521))
  )

ORCL2 =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = hostname2-vip)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = orcl)
      (INSTANCE_NAME = orcl2)
    )
  )

ORCL1 =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = hostname1-vip)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = orcl)
      (INSTANCE_NAME = orcl1)
    )
  )

ORCL =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = hostname1-vip)(PORT = 1521))
    (ADDRESS = (PROTOCOL = TCP)(HOST = hostname2-vip)(PORT = 1521))
    (LOAD_BALANCE = yes)
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = orcl)
    )
  )

EXTPROC_CONNECTION_DATA =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC0))
    )
    (CONNECT_DATA =
      (SID = PLSExtProc)
      (PRESENTATION = RO)
    )
  )

修改SGA PGA 以sys用户登录系统
  alter system set sga_max_size=30000m scope=spfile sid='*';
  alter system set sga_target=30000m scope=spfile sid='*';
  alter system set pga_aggregate_target=8000m scope=spfile sid='*';

重启数据库
  show parameter 查看

sqlplus / as sysdba
  alter system set sga_max_size=3500m scope=spfile
  alter system set sga_target=3000m scope=spfile
  alter system set pga_aggregate_target=1500m scope=spfile;

shutdown immediate
  startup
  show parameter sga
  show parameter pga
拷贝生产环境密码文件到两个节点:
八、验证
select open_mode from v$database;
select instance_name,status from gv$instance;
select name,status from v$datafile;
select name ,status from v$controlfile;
select count(*) from dba_objects;
select count(*) from dba_segments;

至此RAC数据库迁移至RAC完毕。

ORACLE10gRAC数据库迁移至10gRAC的更多相关文章

  1. EF Code First Migrations数据库迁移

    1.EF Code First创建数据库 新建控制台应用程序Portal,通过程序包管理器控制台添加EntityFramework. 在程序包管理器控制台中执行以下语句,安装EntityFramewo ...

  2. 2.EF中 Code-First 方式的数据库迁移

    原文链接:http://www.c-sharpcorner.com/UploadFile/3d39b4/code-first-migrations-with-entity-framework/ 系列目 ...

  3. laravel数据库迁移(三)

    laravel号称世界上最好的框架,数据库迁移算上一个,在这里先简单入个门: laravel很强大,它把表中的操作写成了migrations迁移文件,然后可以直接通过迁移文件来操作表.所以 , 数据迁 ...

  4. Code First开发系列之数据库迁移

    返回<8天掌握EF的Code First开发>总目录 本篇目录 开启并运行迁移 使用迁移API 应用迁移 给已存在的数据库添加迁移 EF的其他功能 本章小结 自我测试 本系列的源码本人已托 ...

  5. ABP Migration(数据库迁移)

    今天准备说说EntityFramework 6.0+,它与我之前所学的4.0有所区别,自从4.1发布以来,code first 被许多人所钟爱,Dbcontext API也由此时而生.早在学校的时候就 ...

  6. sqlserver 2008R2数据库迁移oracle

    x项目需要,将以前的sqlserver数据库迁移的oracle数据库中,由于以前对oracle只是在DML语句的步骤,所以总结一下这次遇到的问题以及具体步骤 1,oracle新建数据库 新建Oracl ...

  7. 【强烈推荐】数据库迁移利器:Migrator.Net

    简介 很郁闷,写了一天的遇到LiveWriter错误,可恶啊 几年前在做项目中第一次接触到了Migrator.Net,就深深被吸引住了,至此以后在新的大项目中,我都会使用Migrator.Net来创建 ...

  8. ubuntu系统lamp环境搭建、数据库迁移、设置数据库外部访问

    sudo passwd root设置两次密码su输入设置的密码exit (退出root帐号) 1.sudo apt-get update 2.sudo apt-get install apache2 ...

  9. Laravel学习笔记(三)数据库 数据库迁移

    该章节内容翻译自<Database Migration using Laravel>,一切版权为原作者. 原作者:Stable Host, LLC 翻译作者:Bowen Huang 正文: ...

随机推荐

  1. 解决UC浏览器或微信浏览器上flex兼容问题

    在UC浏览器上使用display:flex;时会不起作用,要加上兼容性写法,如下 display: -webkit-box; /* OLD - iOS 6-, Safari 3.1-6 */ disp ...

  2. VBS实现定时发送邮件

    原理:建立CDO.Message对象,设置好参数后直接Send就可以了 代码如下: NameSpace = "http://schemas.microsoft.com/cdo/configu ...

  3. 扩展欧几里得算法(extgcd)

    相信大家对欧几里得算法,即辗转相除法不陌生吧. 代码如下: int gcd(int a, int b){ return !b ? gcd(b, a % b) : a; } 而扩展欧几里得算法,顾名思义 ...

  4. 【转】AngularJS 取消对 HTML 片段的转义

    今天尝试用 Rails 做后端提供 JSON 格式的数据, AngularJS 做前端处理 JSON 数据,其中碰到 AngularJS 获取的是一段 HTML 文本,如果直接使用 data-ng-b ...

  5. javascript系列之this

    原文:javascript系列之this 引言 在这篇文章里我们将会讨论与执行上下文直接相关的更多细节.讨论的主题就是this关键字.实践证明,这个主题是足够难的并且在不同的执行上下文中判定this的 ...

  6. 非参数估计:核密度估计KDE

    http://blog.csdn.net/pipisorry/article/details/53635895 核密度估计Kernel Density Estimation(KDE)概述 密度估计的问 ...

  7. 解决C#调用执行js报检索 COM 类工厂中 CLSID 为 {0E59F1D5-1FBE-11D0-8FF2-00A0D10038BC} 组件失败

    最近做了一个模拟请求的网站简化原网站的繁琐数据,提出有用的数据简单展示并完成post.由于原网站数据有js加密,所以我抓出原网站的js解密方法,由C#调用js得到解密后的数据. 整个抓包的框架是用的苏 ...

  8. C++中的抽象类

    一.抽象类学习笔记 1.virtual修饰函数(虚函数)后面加=0就称为一个纯虚函数,一个类中只要有纯虚函数那么它就是一个抽象类.抽象类不能用来实例化对象,是用来给他的派生类定义好这些框架的,给使用这 ...

  9. InfluxDB 1.6文档

    警告!此页面记录了不再积极开发的InfluxDB的早期版本.InfluxDB v1.7是InfluxDB的最新稳定版本. InfluxDB是一个时间序列数据库,旨在处理高写入和查询负载.它是TICK堆 ...

  10. php实现同一时间内一个账户只允许在一个终端登陆

    在账户表的基础上,我新建了一个账户account_session表,用来记录登录账户的account_id和最新一次登录成功用户的session_id,然后首先要修改登录方法:每次登录成功后,要将登录 ...