• Oracle表空间传输测试


    源数据库平台:window 7 64bit Oracle 11g 64bit
    目标数据库平台:RHEL6 64bit Oracle 11g 64bit

    1.查看数据集

    select * from nls_database_parameters;
    select userenv('language') from dual;

    2.查看表空间传输平台

    SQL> column PLATFORM_NAME format a50;
    SQL> select * from v$transportable_platform;
    
    PLATFORM_ID PLATFORM_NAME                                      ENDIAN_FORMAT
    ----------- -------------------------------------------------- --------------
              1 Solaris[tm] OE (32-bit)                            Big
              2 Solaris[tm] OE (64-bit)                            Big
              7 Microsoft Windows IA (32-bit)                      Little
             10 Linux IA (32-bit)                                  Little
              6 AIX-Based Systems (64-bit)                         Big
              3 HP-UX (64-bit)                                     Big
              5 HP Tru64 UNIX                                      Little
              4 HP-UX IA (64-bit)                                  Big
             11 Linux IA (64-bit)                                  Little
             15 HP Open VMS                                        Little
              8 Microsoft Windows IA (64-bit)                      Little
              9 IBM zSeries Based Linux                            Big
             13 Linux x86 64-bit                                   Little
             16 Apple Mac OS                                       Big
             12 Microsoft Windows x86 64-bit                       Little
             17 Solaris Operating System (x86)                     Little
             18 IBM Power Based Linux                              Big
             19 HP IA Open VMS                                     Little
             20 Solaris Operating System (x86-64)                  Little
    
    已选择19行。

    3.创建测试用例

    SQL> create tablespace test_transtablespace datafile 'D:APPORADATAORCL	est_tbs.DBF'
      2  size 2G autoextend on ;
    
    表空间已创建。
    
    SQL> create user test_tbs identified by test_tbs default tablespace test_transtablespace;
    
    用户已创建。
    
    SQL> grant connect to test_tbs;
    
    授权成功。
    
    SQL> grant resource to test_tbs;
    
    授权成功。
    
    SQL> grant dba to test_tbs;
    
    授权成功。

    4.表空间自包含检查

    conn / as sysdba
    进行FULL_CHECK测试
    execute dbms_tts.transport_set_check('test_transtablespace',full_check=>true);
    
    /*
    将索引和外键同时检查。
    SQL> execute dbms_tts.transport_set_check('users,example,indx',true,true);
    */
    
    select * from transport_set_violations;

    5.将表空间置于只读状态

    alter tablespace test_transtablespace read only;

    6.导出表空间元数据

    C:UsersAdministrator>expdp "sys/oracle as sysdba" DUMPFILE=test_transtbs.dmp DIRECTORY=expdump transport_tablespaces=test_transtablespace ;
    
    Export: Release 11.1.0.7.0 - 64bit Production on 星期一, 19 5月, 2014 11:49:56
    
    Copyright (c) 2003, 2007, Oracle.  All rights reserved.
    
    连接到: Oracle Database 11g Enterprise Edition Release 11.1.0.7.0 - 64bit Production
    With the Partitioning, OLAP, Data Mining and Real Application Testing options
    启动 "SYS"."SYS_EXPORT_TRANSPORTABLE_01":  "sys/******** AS SYSDBA" DUMPFILE=test_transtbs.dmp DIRECTORY=expdump transport_tablespaces=test_transtablespace ;
    处理对象类型 TRANSPORTABLE_EXPORT/PLUGTS_BLK
    处理对象类型 TRANSPORTABLE_EXPORT/TABLE
    处理对象类型 TRANSPORTABLE_EXPORT/INDEX
    处理对象类型 TRANSPORTABLE_EXPORT/CONSTRAINT/CONSTRAINT
    处理对象类型 TRANSPORTABLE_EXPORT/POST_INSTANCE/PLUGTS_BLK
    已成功加载/卸载了主表 "SYS"."SYS_EXPORT_TRANSPORTABLE_01"
    ******************************************************************************
    SYS.SYS_EXPORT_TRANSPORTABLE_01 的转储文件集为:
      D:APPORADATAEXPDUMPTEST_TRANSTBS.DMP
    ******************************************************************************
    可传输表空间 TEST_TRANSTABLESPACE 所需的数据文件:
      D:APPORADATAORCLTEST_TBS.DBF
    作业 "SYS"."SYS_EXPORT_TRANSPORTABLE_01" 已于 11:50:20 成功完成

    7.将表空间的数据文件和导出的DMP文件,传送到目标数据库平台上。

    8.目标数据库上创建目标schema

    SQL> create user test_tbs identified by test_tbs;
    
    用户已创建。
    
    SQL> grant connect,resource,dba to test_tbs;

    9.导入表空间

    [oracle@localhost test_dump]$ impdp "sys/oracle as sysdba" dumpfile=TEST_TRANSTBS.DMP directory=test_dum transport_datafiles=/u01/app/oradata/zen/TEST_TBS.DBF remap_schema=test_tbs:test_tbs ;
    
    Import: Release 11.2.0.1.0 - Production on Sun May 18 23:46:22 2014
    
    Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.
    
    Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
    With the Partitioning, OLAP, Data Mining and Real Application Testing options
    Master table "SYS"."SYS_IMPORT_TRANSPORTABLE_01" successfully loaded/unloaded
    Starting "SYS"."SYS_IMPORT_TRANSPORTABLE_01":  "sys/******** AS SYSDBA" dumpfile=TEST_TRANSTBS.DMP directory=test_dum transport_datafiles=/u01/app/oradata/zen/TEST_TBS.DBF remap_schema=test_tbs:test_tbs
    Processing object type TRANSPORTABLE_EXPORT/PLUGTS_BLK
    Processing object type TRANSPORTABLE_EXPORT/TABLE
    Processing object type TRANSPORTABLE_EXPORT/INDEX
    Processing object type TRANSPORTABLE_EXPORT/CONSTRAINT/CONSTRAINT
    Processing object type TRANSPORTABLE_EXPORT/POST_INSTANCE/PLUGTS_BLK
    Job "SYS"."SYS_IMPORT_TRANSPORTABLE_01" successfully completed at 23:46:31

    10.查看表空间状态

    SQL> select tablespace_name,block_size,status,logging from dba_tablespaces;
    
    TABLESPACE_NAME                BLOCK_SIZE STATUS    LOGGING
    ------------------------------ ---------- --------- ---------
    SYSTEM                               8192 ONLINE    LOGGING
    SYSAUX                               8192 ONLINE    LOGGING
    UNDOTBS1                             8192 ONLINE    LOGGING
    TEMP                                 8192 ONLINE    NOLOGGING
    USERS                                8192 ONLINE    LOGGING
    TEST_TRANSTABLESPACE                 8192 READ ONLY LOGGING

    11.修改表空间状态

    alter tablespace TEST_TRANSTABLESPACE read write ;

    12.至此表空间传输完成。

    注意:
    1.元数据库和目标数据的字符集最好一致。
    2.目标数据库在导入之前不存在相同的表空间名字。
    3.windows和Linux 无需转换可以直接倒。
    4.检查表空间的对象包含。
    5.为了保证数据的一致性,导出表空间时,要将表空间置于 read ONLY 状态,不然导入的时候会报
    ORA-19722: datafile /u01/app/oradata/test_dump/TEST_TBS.DBF is an incorrect version

  • 相关阅读:
    Httpclient请求数据(post)
    实现定位(无基本地图)
    Httpclient请求数据
    带参数路径的刷新和加载
    AsyncTask异步交互和httpurlconnection结合使用
    判断网络状态
    Android数字签名
    app加固
    定位和xml解析和gson解析加上拉加载,下拉刷新
    下载app后自动安装程序
  • 原文地址:https://www.cnblogs.com/Alex-Zeng/p/3736915.html
Copyright © 2020-2023  润新知