当前位置:文档之家› 数据库迁移方案

数据库迁移方案

数据库迁移方案客户名称XXXX 系统名称XXXX 数据库名工程师XXXX 用户确认XXXXX公司XXXX年XX月文档控制此文档仅供最终用户审阅,不得向与此无关的个人或机构传阅或复制。

修改记录日期作者版本修改记录XXXX-XX-XX XXXX 1.0 创建分发者姓名职位审阅记录姓名职位1.概述年前完成XXXXX系统的数据库迁移工作,同时对源库进行小版本升级,有11.2.0.3升级到11.2.0.4版本。

2.迁移前准备工作步骤内容完成情况1 目标库操作系统安装完成2 目标库操作系统优化完成3 目标库RAC安装完成4 目标库配置完成3.源库备份rman target / msglog /u01/bak/rman.log append <<EOFrun {allocate channel c1 device type disk maxpiecesize=30G;allocate channel c2 device type disk maxpiecesize=30G;allocate channel c3 device type disk maxpiecesize=30G;allocate channel c4 device type disk maxpiecesize=30G;backup format '/u01/bak/orcl_%U_%T' skip inaccessible filesperset 5database tag orcl_hot_db_bk;sql 'alter system archive log current';backup current controlfile tag='bak_ctlfile' format='/u01/bak/ctl_file_%U_%T';backup spfile tag='spfile' format='/u01/bak/spfile_%U_%T';release channel c1;release channel c2;release channel c3;release channel c4;}EOF4.目标库恢复4.1.传输备份文件从源端拷贝备份文件到目标端指定目录4.2.还原spfile到pfileRMAN>startup nomount --rman自启动一个实例RMAN>restore spfile to pfile ‘/u01/initdba.ora’ from ‘/u01/bakup/xxx’;注意:修改磁盘组名称,归档路径、控制文件路径,日志路径,trace文件路径、remote_listener4.3.还原控制文件在其中一个节点上执行。

4.3.1.用pfile启动到nomount状态RMAN>startup nomunt pfile=’/u01/app/xx/initdba.ora’;4.3.2.rman执行对控制文件的恢复RMAN> restore controlfile from '/HS5220/c-2006462633-20170123-03';Starting restore at 2017-02-04 12:16:56using channel ORA_DISK_1channel ORA_DISK_1: restoring control fileRMAN-00571: ===========================================================RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============RMAN-00571: ===========================================================RMAN-03002: failure of restore command at 02/04/2017 12:16:57ORA-19870: error while restoring backup piece /HS5220/c-2006462633-20170123-03ORA-19504: failed to create file "+DG_DATA"ORA-17502: ksfdcre:4 Failed to create file +DG_DATAORA-15001: diskgroup "DG_DATA" does not exist or is not mountedORA-15040: diskgroup is incompleteORA-15040: diskgroup is incompleteORA-15040: diskgroup is incompleteORA-15040: diskgroup is incompleteORA-15040: diskgroup is incompleteORA-15040: diskgroup is incomplete[oracle@ora8db1 ~]$ ls -l $ORACLE_HOME/bin/oracle-rwsr-s--x 1 oracle oinstall 239840968 3月15 12:32 /u01/app/oracle/product/11.2.0/db_1/bin/oracle[oracle@ora8db1 ~]$ exitlogout[root@ora8db1 ~]# su - grid[grid@ora8db1 ~]$ cd $ORACLE_HOME/bin/[grid@ora8db1 bin]$ setasmgidsetasmgid setasmgid0 setasmgidwrap[grid@ora8db1 bin]$ setasmgidwrap -o /u01/app/oracle/product/11.2.0/db_1/bin/oracle[grid@ora8db1 bin]$ exitlogout[root@ora8db1 ~]# su - oracle[oracle@ora8db1 ~]$ ls -l $ORACLE_HOME/bin/oracle-rwsr-s--x 1 oracle asmadmin 239840968 3月15 12:32 /u01/app/oracle/product/11.2.0/db_1/bin/oracle [oracle@ora8db1 ~]$ export ORACLE_SID=jsglrac1[oracle@ora8db1 ~]$ rman target /Recovery Manager: Release 11.2.0.4.0 - Production on Thu Mar 16 09:23:19 2017Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.RMAN-00571: =========================================================== RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS =============== RMAN-00571: =========================================================== RMAN-00554: initialization of internal recovery manager package failedRMAN-04005: error from target database:ORA-27140: attach to post/wait facility failedORA-27300: OS system dependent operation:invalid_egid failed with status: 1ORA-27301: OS failure message: Operation not permittedORA-27302: failure occurred at: skgpwinit6ORA-27303: additional information: startup egid = 1001 (oinstall), current egid = 1004 (asmadmin) [oracle@ora8db1 ~]$ ps -ef|grep ora_pmonoracle 155625 1 0 08:59 ? 00:00:00 ora_pmon_jsglrac1oracle 173687 173043 0 09:24 pts/0 00:00:00 grep ora_pmon[oracle@ora8db1 ~]$ kill -9 155625[oracle@ora8db1 ~]$ sqlplus / as sysdbaSQL*Plus: Release 11.2.0.4.0 Production on Thu Mar 16 09:25:18 2017Copyright (c) 1982, 2013, Oracle. All rights reserved.Connected to an idle instance.SYS@jsglrac1>startup nomountORACLE instance started.Total System Global Area 3206836224 bytesFixed Size 2257520 bytesVariable Size 1174408592 bytesDatabase Buffers 1979711488 bytesRedo Buffers 50458624 bytesSYS@jsglrac1>exitDisconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit ProductionWith the Partitioning, Real Application Clusters, OLAP, Data Miningand Real Application Testing options[oracle@ora8db1 ~]$ rman target /Recovery Manager: Release 11.2.0.4.0 - Production on Thu Mar 16 09:25:37 2017Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.connected to target database: JSGLRAC (not mounted)RMAN> restore controlfile from '/backup/full_backup/jsglrac/ctl_file_0grv777r_1_1_20170315'; Starting restore at 2017-03-16 09:25:57using target database control file instead of recovery catalogallocated channel: ORA_DISK_1channel ORA_DISK_1: SID=1057 instance=jsglrac1 device type=DISKchannel ORA_DISK_1: restoring control filechannel ORA_DISK_1: restore complete, elapsed time: 00:00:02output file name=+DG_DATA/jsglrac/controlfile/current.267.938769959Finished restore at 2017-03-16 09:25:59RMAN>RMAN>restore controlfile from ‘/u01/backup/xxx’;修改参数文件中控制文件的名字4.4.生成spfile,放在共享设备上[oracle@ora8db1 ~]$ sqlplus / as sysdbaSQL*Plus: Release 11.2.0.4.0 Production on Thu Mar 16 09:29:11 2017Copyright (c) 1982, 2013, Oracle. All rights reserved.Connected to:Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit ProductionWith the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,Data Mining and Real Application Testing optionsSYS@jsglrac1>create spfile='+DG_DATA' from pfile;File created.[root@ora8db1 ~]# su - grid[grid@ora8db1 ~]$ asmcmdASMCMD> lsDG_DATA/DG_GI/ASMCMD> cd DG_DATAASMCMD> lsJSGLRAC/ASMCMD> cd JSGLRACASMCMD> lsCONTROLFILE/PARAMETERFILE/ASMCMD> cd PARAMETERFILEASMCMD> lsspfile.256.938770171ASMCMD> ls -lType Redund Striped Time Sys NamePARAMETERFILE UNPROT COARSE MAR 16 09:00:00 Y spfile.256.938770171修改所有节点的pfile内容,指向spfileSPFILE=’+DATA/XX/spfiledba.ora’4.5.创建口令文件$orapwd file=?/dbs/orapwdba password=oracle在所有节点上创建口令文件。

相关主题