zoukankan      html  css  js  c++  java
  • 跨平台迁移数据库windows-Linux

    10.10.1.127服务器的数据库ORCL(WINDOWS)迁移到VM 10.10.10.168LINUX平台

    操作系统:Windows server 2008r2 64bit

               CentOS  Linux  6.5  64bit

    ORACLE软件:11.2.0.3.0

    目录:

    1. 1.     在源数据库(Windows数据库orcl准备迁移)

    2. RMAN 生成迁移文件
    3.
    修改对应的转换文件
    4.
    修改对应的 INIT 文件
    5.
    在目标 LINUXlinux 数据库 orcl)在用 DBCA 创建数据库
    6.
    删除文件,复制文件
    7.
    升级

    1.在源数据库(Windows数据库orcl准备迁移)

    1,检查源库的控制文件,数据文件,日志文件,临时文件,参数文件等!

     

     

     

    查看可以转换的平台

     

    在目标端执行,捕获目标库平台

     

    运行检查包

     

    查看归档模式

     

    关闭数据库,将数据库启动到只读模式!

     

    2. RMAN 生成迁移文件

    对源数据文件进行转换,并生成升级脚本

     

    查看生成的数据文件和升级脚本

     

    3. 修改对应的转换文件

    更改TRANS.SQL的路劲,对应LINUX平台的路劲

    Linux路劲:

    ORACLE_BASE=/u01/app/oracle

    ORACLE_HOME=/u01/app/oracle/product/11.2.0/db_1

    -- The following commands will create a new control file and use it

    -- to open the database.

    -- Data used by Recovery Manager will be lost.

    -- The contents of online logs will be lost and all backups will

    -- be invalidated. Use this only if online logs are damaged.

    -- After mounting the created controlfile, the following SQL

    -- statement will place the database in the appropriate

    -- protection mode:

    --  ALTER DATABASE SET STANDBY DATABASE TO MAXIMIZE PERFORMANCE

    STARTUP NOMOUNT PFILE='C:ORACLEPRODUCT11.2.0DBHOME_1DATABASEINIT_00RGP615_1_0.ORA'

    CREATE CONTROLFILE REUSE SET DATABASE "ORCL" RESETLOGS  ARCHIVELOG

        MAXLOGFILES 16

        MAXLOGMEMBERS 3

        MAXDATAFILES 100

        MAXINSTANCES 8

        MAXLOGHISTORY 292

    LOGFILE

      GROUP 1 'C:ORACLEPRODUCT11.2.0DBHOME_1DATABASEARCH_D-ORCL_ID-1451024903_S-10_T-1_A-923244170_03RGP615'  SIZE 50M BLOCKSIZE 512,

      GROUP 2 'C:ORACLEPRODUCT11.2.0DBHOME_1DATABASEARCH_D-ORCL_ID-1451024903_S-11_T-1_A-923244170_04RGP615'  SIZE 50M BLOCKSIZE 512,

      GROUP 3 'C:ORACLEPRODUCT11.2.0DBHOME_1DATABASEARCH_D-ORCL_ID-1451024903_S-12_T-1_A-923244170_05RGP615'  SIZE 50M BLOCKSIZE 512

    DATAFILE

      'D:TRANSFERSYSTEM01.DBF',

      'D:TRANSFERSYSAUX01.DBF',

      'D:TRANSFERUNDOTBS01.DBF',

      'D:TRANSFERUSERS01.DBF',

      'D:TRANSFERSEINEEBSDATA.DBF',

      'D:TRANSFERTBSTEST01.DBF',

      'D:TRANSFERTBSTEST02.DBF'

    CHARACTER SET AL32UTF8

    ;

    -- Database can now be opened zeroing the online logs.

    ALTER DATABASE OPEN RESETLOGS;

    -- Commands to add tempfiles to temporary tablespaces.

    -- Online tempfiles have complete space information.

    -- Other tempfiles may require adjustment.

    ALTER TABLESPACE TEMP ADD TEMPFILE 'C:ORACLEPRODUCT11.2.0DBHOME_1DATABASEDATA_D-ORCL_I-1451024903_TS-TEMP_FNO-1_06RGP615'

         SIZE 30408704  AUTOEXTEND ON NEXT 655360  MAXSIZE 32767M;

    -- End of tempfile additions.

    --

    set echo off

    prompt ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    prompt * Your database has been created successfully!

    prompt * There are many things to think about for the new database. Here

    prompt * is a checklist to help you stay on track:

    prompt * 1. You may want to redefine the location of the directory objects.

    prompt * 2. You may want to change the internal database identifier (DBID)

    prompt *    or the global database name for this database. Use the

    prompt *    NEWDBID Utility (nid).

    prompt ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    SHUTDOWN IMMEDIATE

    STARTUP UPGRADE PFILE='C:ORACLEPRODUCT11.2.0DBHOME_1DATABASEINIT_00RGP615_1_0.ORA'

    @@ ?/rdbms/admin/utlirp.sql

    SHUTDOWN IMMEDIATE

    STARTUP PFILE='C:ORACLEPRODUCT11.2.0DBHOME_1DATABASEINIT_00RGP615_1_0.ORA'

    -- The following step will recompile all PL/SQL modules.

    -- It may take serveral hours to complete.

    @@ ?/rdbms/admin/utlrp.sql

    set feedback 6;

    ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

    修改之后的TRANS.SQL文件:

    - The following commands will create a new control file and use it

    -- to open the database.

    -- Data used by Recovery Manager will be lost.

    -- The contents of online logs will be lost and all backups will

    -- be invalidated. Use this only if online logs are damaged.

    -- After mounting the created controlfile, the following SQL

    -- statement will place the database in the appropriate

    -- protection mode:

    --  ALTER DATABASE SET STANDBY DATABASE TO MAXIMIZE PERFORMANCE

    STARTUP NOMOUNT PFILE='/u01/app/oracle/product/11.2.0/db_1/dbs/initorcl.ora'

    CREATE CONTROLFILE REUSE SET DATABASE "ORCL" RESETLOGS  ARCHIVELOG

        MAXLOGFILES 16

        MAXLOGMEMBERS 3

        MAXDATAFILES 100

        MAXINSTANCES 8

        MAXLOGHISTORY 292

    LOGFILE

      GROUP 1 '/u01/app/oracle/oradata/orcl/redo01.log'  SIZE 50M BLOCKSIZE 512,

      GROUP 2 '/u01/app/oracle/oradata/orcl/redo02.log '  SIZE 50M BLOCKSIZE 512,

      GROUP 3 '/u01/app/oracle/oradata/orcl/redo03.log '  SIZE 50M BLOCKSIZE 512

    DATAFILE

      '/u01/app/oracle/oradata/orcl/SYSTEM01.DBF',

      '/u01/app/oracle/oradata/orcl/SYSAUX01.DBF',

      '/u01/app/oracle/oradata/orcl/UNDOTBS01.DBF',

      '/u01/app/oracle/oradata/orcl/USERS01.DBF',

      '/u01/app/oracle/oradata/orcl/SEINEEBSDATA.DBF',

      '/u01/app/oracle/oradata/orcl/TBSTEST01.DBF',

      '/u01/app/oracle/oradata/orcl/TBSTEST02.DBF'

    CHARACTER SET AL32UTF8

    ;

    -- Database can now be opened zeroing the online logs.

    ALTER DATABASE OPEN RESETLOGS;

    -- Commands to add tempfiles to temporary tablespaces.

    -- Online tempfiles have complete space information.

    -- Other tempfiles may require adjustment.

    ALTER TABLESPACE TEMP ADD TEMPFILE '/u01/app/oracle/oradata/orcl/temp01.dbf'

         SIZE 30408704  AUTOEXTEND ON NEXT 655360  MAXSIZE 32767M;

    -- End of tempfile additions.

    --

    set echo off

    prompt ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    prompt * Your database has been created successfully!

    prompt * There are many things to think about for the new database. Here

    prompt * is a checklist to help you stay on track:

    prompt * 1. You may want to redefine the location of the directory objects.

    prompt * 2. You may want to change the internal database identifier (DBID)

    prompt *    or the global database name for this database. Use the

    prompt *    NEWDBID Utility (nid).

    prompt ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    SHUTDOWN IMMEDIATE

    STARTUP UPGRADE PFILE='/u01/app/oracle/product/11.2.0/db_1/dbs/initorcl.ora '

    @@ ?/rdbms/admin/utlirp.sql

    SHUTDOWN IMMEDIATE

    STARTUP PFILE='/u01/app/oracle/product/11.2.0/db_1/dbs/initorcl.ora '

    -- The following step will recompile all PL/SQL modules.

    -- It may take serveral hours to complete.

    @@ ?/rdbms/admin/utlrp.sql

    set feedback 6;

    4. 修改对应的 INIT 文件

     

    更改参数文件的相关参数路劲

     

     

    5. 在目标 LINUXlinux 数据库 orcl)在用 DBCA 创建数据库

     

    用DBCA创建ORCL数据库,并将数据文件,参数文件,日志文件和控制文件删除,再把转换好的相应文件复制到linux相应的路劲

     

    6. 删除文件,复制文件

    删除复制后文件后,执行TRANS.SQL脚本

     

    7,升级

    执行升级脚本

     

     

    遇到错误,提示将数据库启动到升级模式,再执行UTLIRP.SQL脚本

     

     

    跑完脚本,提示正常关闭和启动数据库,脚本已经执行,可以不用执行

     

    检查数据库的状态和文件

     

     

    验证数据的有效性

     

     

     

     

     

     

     

     

  • 相关阅读:
    DevExpress中的gridControl选择问题
    使用IL DASM来查看接口内的自动属性
    多态的使用 虚方法、抽象类、接口
    匿名类的使用及原理
    JAVA小问题解决办法
    数据库02
    数据库01(验证连接是否成功)
    Java 类库知识总结
    Java多线程知识总结(补充)
    java Thread和Runable的深刻理解
  • 原文地址:https://www.cnblogs.com/guipeng/p/8310977.html
Copyright © 2011-2022 走看看