ITPub博客

首页 > 数据库 > Oracle > oracle从linux传输数据库到windows

oracle从linux传输数据库到windows

Oracle 作者:d_ball_apple 时间:2015-03-18 20:41:53 0 删除 编辑

1、检查是否能转换。
  SQL>select * from v$db_transportable_platform;
  
  Make sure your database is open in read-only mode, then call DBMS_TDB.CHECK_DB with appropriate parameters.
  确定数据库是在read only状态。
  
  SQL>alter database open read only;
  SQL>SET SERVEROUTPUT ON
  DECLARE
         db_ready BOOLEAN;
       BEGIN
         db_ready := DBMS_TDB.CHECK_DB('Microsoft Windows IA (32-bit)');
       END;
       /
  PL/SQL procedure successfully completed.

 

DECLARE
         db_ready BOOLEAN;
       BEGIN
         db_ready := DBMS_TDB.CHECK_DB('HP Tru64 UNIX');
       END;

HP Tru64 UNIX


  
  用于检查外部表和Bfile
  SQL>SET SERVEROUTPUT ON
  DECLARE
          external BOOLEAN;
       BEGIN
         external := DBMS_TDB.CHECK_EXTERNAL;
       END;
       /
  
  If you call DBMS_TDB.CHECK_DB and no messages are displayed indicating conditions preventing transport 
before the PL/SQL procedure successfully completed message, then your database is ready for transport.
  如果没有信息返回(在PL/SQL procedure successfully completed.之前)。说明数据库已经准备好了跨平台迁移。
  
2、在源数据库上转换数据库
  SQL> STARTUP MOUNT;
  SQL> ALTER DATABASE OPEN READ ONLY;
  SQL> select * from v$db_transportable_platform;
  PLATFORM_ID PLATFORM_NAME                                                ENDIAN_FORMAT
  ----------- ------------------------------------------------------------ --------------
            7 Microsoft Windows IA (32-bit)                                Little
           10 Linux IA (32-bit)                                            Little
            5 HP Tru64 UNIX                                                Little
           11 Linux IA (64-bit)                                            Little
           15 HP Open VMS                                                  Little
            8 Microsoft Windows IA (64-bit)                                Little
           13 Linux 64-bit for AMD                                         Little
           12 Microsoft Windows 64-bit for AMD                             Little
           17 Solaris Operating System (x86)                               Little
  9 rows selected.
  
  SQL> SET SERVEROUTPUT ON
  SQL> DECLARE
             db_ready BOOLEAN;
           BEGIN
             db_ready := DBMS_TDB.CHECK_DB('Microsoft Windows IA (32-bit)');
           END;
           /
  PL/SQL procedure successfully completed.
  
  SQL> SET SERVEROUTPUT ON
  SQL> DECLARE
              external BOOLEAN;
           BEGIN
             external := DBMS_TDB.CHECK_EXTERNAL;
           END;
           /
  The following directories exist in the database:
  SYS.DB_FILES_DIRECTORY, SYS.DATA_PUMP_DIR, SYS.WORK_DIR, SYS.ADMIN_DIR
  PL/SQL procedure successfully completed.
  
3、备份源库,并copy所有的pfile、数据文件、scrīpt到目标库
  rman >run {
          CONVERT DATABASE NEW DATABASE 'sztech'
          transport script '/home/oracle/oradata/transportscript'
          to platform 'Microsoft Windows IA (32-bit)'
          db_file_name_convert '/oracle/app/oracle/oradata/sztech1' '/home/oracle/oradata/';
   }

  copy /home/oracle/oradata/目录下的数据文件、scrīpt到目标库

  channel ORA_DISK_1: datafile conversion complete, elapsed time: 00:00:01
Run SQL script /home/oracle/oradata/transportscript on the target platform to create database
Edit init.ora file /u01/app/oracle/product/11.2.0/db_1/dbs/init_00lh4ff9_1_0.ora. 
This PFILE will be used to create the database on the target platform
To recompile all PL/SQL modules, run utlirp.sql and utlrp.sql on the target platform
To change the internal database identifier, use DBNEWID Utility
Finished backup at 25-JUN-10


创建基础环境

  首先创建相关目录:

  mkdir d:\oracle\product\11.2.0\admin\sztech\adump
  mkdir d:\oracle\product\11.2.0\admin\sztech\bdump
  mkdir d:\oracle\product\11.2.0\admin\sztech\cdump
  mkdir d:\oracle\product\11.2.0\admin\sztech\dpdump
  mkdir d:\oracle\product\11.2.0\admin\sztech\pfile
  mkdir d:\oracle\product\11.2.0\admin\sztech\udump

  创建Windows数据库服务:

  d:\oracle\>oradim -new -sid sztech
  实例已创建。

 

  
4、在目标库上恢复数据库、并升级数据库  
  在目标库上运行脚本transportscrīpt (需要根据需要修改该脚本文件,如controlfile的路径)
  SQL>@transportscrīpt
  该脚本包含步骤如下:
  
  恢复pfile,修改pfile中相应的路径位置。启动数据库
 
STARTUP NOMOUNT PFILE='D:\oracle\product\11.2.0\db_1\database\initsztech.ora'
CREATE CONTROLFILE REUSE SET DATABASE "sztech" RESETLOGS  ARCHIVELOG
    MAXLOGFILES 16
    MAXLOGMEMBERS 3
    MAXDATAFILES 100
    MAXINSTANCES 8
    MAXLOGHISTORY 292
LOGFILE
  GROUP 1 SIZE 50M,
  GROUP 2 SIZE 50M,
  GROUP 3 SIZE 50M
DATAFILE
  'D:\oracle\product\11.2.0\oradata\sztech\system01.dbf',
  'D:\oracle\product\11.2.0\oradata\sztech\undotbs01.dbf',
  'D:\oracle\product\11.2.0\oradata\sztech\sysaux01.dbf',
  'D:\oracle\product\11.2.0\oradata\sztech\users01.dbf',
  'D:\oracle\product\11.2.0\oradata\sztech\example01.dbf',
  'D:\oracle\product\11.2.0\oradata\sztech\tbsaddm.dbf',
  'D:\oracle\product\11.2.0\oradata\sztech\tbsaddm2.dbf',
  'D:\oracle\product\11.2.0\oradata\sztech\tsp_ts.dbf'
CHARACTER SET ZHS16GBK

  ;
  
  alter database open resetlogs;   ---不需要升级就可以直接resetlog打开数据库
  
  ALTER TABLESPACE TEMP ADD TEMPFILE 'D:\oracle\product\11.2.0\oradata\sztech\temp01.dbf'
     SIZE 26214400  AUTOEXTEND ON NEXT 5242880  MAXSIZE 104857600 ;
     
 

附:
  D:\oracle\product\11.2.0\db_1\database\initsztech.ora 内容:
  
  # Please change the values of the following parameters:
  control_files            = "D:\oracle\product\11.2.0\oradata\sztech/control01_ctl"
  db_recovery_file_dest    = "D:\oracle\product\11.2.0\flash_recovery_area"
  db_recovery_file_dest_size= 4244635648
  background_dump_dest     = "D:\oracle\product\11.2.0\admin\sztech\bdump"
  user_dump_dest           = "D:\oracle\product\11.2.0\admin\sztech\udump"
  core_dump_dest           = "D:\oracle\product\11.2.0\admin\sztech\cdump"
  audit_file_dest          = "D:\oracle\product\11.2.0\admin\sztech\adump"
  db_name                  = "sztech"

 

# Please review the values of the following parameters:
  __shared_pool_size       = 104857600
  __large_pool_size        = 4194304
  __java_pool_size         = 4194304
  __streams_pool_size      = 0
  __db_cache_size          = 197132288
  remote_login_passwordfile= "EXCLUSIVE"
  db_domain                = ""
  dispatchers              = "(PROTOCOL=TCP) (SERVICE=orclXDB)"

# The values of the following parameters are from source database:
  processes                = 150
  shared_pool_size         = 104857600
  sga_target               = 314572800
  db_block_size            = 8192
  compatible               = "11.2.0.1.0"
  db_file_multiblock_read_count= 16
  undo_management          = "AUTO"
  undo_tablespace          = "UNDOTBS1"
  job_queue_processes      = 10
  open_cursors             = 300
  pga_aggregate_target     = 10485760


0

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/28889722/viewspace-1465130/ ,如需转载,请注明出处,否则将追究法律责任。

上一篇: 10g dg 搭建
请登录后发表评论 登录
全部评论

注册时间:2013-05-15

  • 博文量
    39
  • 访问量
    84862