熱點推薦:
您现在的位置: 電腦知識網 >> 編程 >> Oracle >> 正文

關於Oracle10g跨平台傳輸表空間

2022-06-13   來源: Oracle 

  准備工作:
  查詢源數據庫平台信息
  
  SQL> col platform_name for a
  SQL> SELECT dPLATFORM_NAME ENDIAN_FORMAT
   FROM V$TRANSPORTABLE_PLATFORM tp V$DATABASE d
   WHERE tpPLATFORM_NAME = dPLATFORM_NAME;
  
  PLATFORM_NAME ENDIAN_FORMAT
  
  Solaris[tm] OE (bit) Big
  
  查詢目標數據庫平台信息
  
  SQL> col platform_name for a
  SQL> SELECT dPLATFORM_NAME ENDIAN_FORMAT
   FROM V$TRANSPORTABLE_PLATFORM tp V$DATABASE d
   WHERE tpPLATFORM_NAME = dPLATFORM_NAME;
  
  PLATFORM_NAME ENDIAN_FORMAT
  
  Microsoft Windows IA (bit) Little
  
  查詢Oracleg支持的平台轉換
  
  代碼:
  SQL> select * from v$transportable_platform;
  
  PLATFORM_ID PLATFORM_NAME              ENDIAN_FORMAT
  
        Solaris[tm] OE (bit)         Big
        Solaris[tm] OE (bit)         Big
        Microsoft Windows IA (bit)      Little
       Linux IA (bit)            Little
        AIXBased Systems (bit)        Big
        HPUX (bit)              Big
        HP Tru UNIX              Little
        HPUX IA (bit)            Big
       Linux IA (bit)            Little
       HP Open VMS               Little
        Microsoft Windows IA (bit)      Little
  
  PLATFORM_ID PLATFORM_NAME              ENDIAN_FORMAT
  
        IBM zSeries Based Linux         Big
       Linux bit for AMD           Little
       Apple Mac OS               Big
       Microsoft Windows bit for AMD     Little
  
  創建一個獨立的自包含表空間
  用於測試
  
  代碼:
  $ sqlplus / as sysdba
  
  SQL*Plus: Release Production on Tue Apr ::
  
  Copyright (c) Oracle All rights reserved
  
  Connected to:
  Oracle Database g Enterprise Edition Release bit Production
  With the Partitioning OLAP and Data Mining options
  
  SQL> select name from v$datafile;
  
  NAME
  
  /opt/oracle/oradata/eygle/systemdbf
  /opt/oracle/oradata/eygle/undotbsdbf
  /opt/oracle/oradata/eygle/sysauxdbf
  /opt/oracle/oradata/eygle/usersdbf
  /data/oradata/systemfile/eygledbf
  /opt/oracle/oradata/eygle/EYGLE/datafile/o_mf_test_xvny_dbf
  /opt/oracle/oradata/eygle/EYGLE/datafile/o_mf_itpub_xvg_dbf
  
   rows selected
  
  SQL> create tablespace trans
    datafile /data/oradata/systemfile/transdbf
    size M;
  
  Tablespace created
  
  SQL> create user trans identified by trans
    default tablespace trans;
  
  User created
  
  SQL> grant connectresource to trans;
  
  Grant succeeded
  
  SQL> connect trans/trans
  Connected
  
  SQL> create table test as select * from user_objects;
  
  Table created
  
  SQL> select count(*) from test;
  
   COUNT(*)
  
      
  
  SQL> select * from test;
  
  OBJECT_NAME
  
  SUBOBJECT_NAME         OBJECT_ID DATA_OBJECT_ID OBJECT_TYPE
  
  CREATED   LAST_DDL_TIM TIMESTAMP      STATUS T G S
  
  TEST
                          TABLE
  APR  APR  ::: VALID  N N N
  
  
  SQL> exit
  Disconnected from Oracle Database g Enterprise Edition Release bit Production
  With the Partitioning OLAP and Dat
  
  導出要傳輸的表空間
  $ pwd
  /opt/oracle
  $ cd dpdata
  $ ls
  $ expdp eygle/eygle dumpfile=transdmp directory=dpdata transport_tablespace=trans
  LRM: unknown parameter name transport_tablespace
  
  $ expdp eygle/eygle dumpfile=transdmp directory=dpdata TRANSPORT_TABLESPACES=trans
  
  Export: Release bit Production on Tuesday April :
  
  Copyright (c) Oracle All rights reserved
  
  Connected to: Oracle Database g Enterprise Edition Release bit Production
  With the Partitioning OLAP and Data Mining options
  Starting EYGLESYS_EXPORT_TRANSPORTABLE_: eygle/******** dumpfile=transdmp directory=dpdata TRANSPORT_TABLESPACES=trans
  ORA: Data Pump transportable tablespace job aborted
  ORA: tablespace TRANS is not read only
  
  Job EYGLESYS_EXPORT_TRANSPORTABLE_ stopped due to fatal error at :
  
  注意:傳輸表空間必須置為只讀狀態
  
  $ sqlplus / as sysdba
  
  SQL*Plus: Release Production on Tue Apr ::
  
  Copyright (c) Oracle All rights reserved
  
  Connected to:
  Oracle Database g Enterprise Edition Release bit Production
  With the Partitioning OLAP and Data Mining options
  
  SQL> alter tablespace trans read only;
  
  Tablespace altered
  
  SQL> exit
  Disconnected from Oracle Database g Enterprise Edition Release bit Production
  With the Partitioning OLAP and Data Mining options
  
  $ expdp eygle/eygle dumpfile=transdmp directory=dpdata TRANSPORT_TABLESPACES=trans
  
  Export: Release bit Production on Tuesday April :
  
  Copyright (c) Oracle All rights reserved
  
  Connected to: Oracle Database g Enterprise Edition Release bit Production
  With the Partitioning OLAP and Data Mining options
  Starting EYGLESYS_EXPORT_TRANSPORTABLE_: eygle/******** dumpfile=transdmp directory=dpdata TRANSPORT_TABLESPACES=trans
  Processing object type TRANSPORTABLE_EXPORT/PLUGTS_BLK
  Processing object type TRANSPORTABLE_EXPORT/TABLE
  Processing object type TRANSPORTABLE_EXPORT/TTE_POSTINST/PLUGTS_BLK
  Master table EYGLESYS_EXPORT_TRANSPORTABLE_ successfully loaded/unloaded
  ******************************************************************************
  Dump file set for EYGLESYS_EXPORT_TRANSPORTABLE_ is:
  /opt/oracle/dpdata/transdmp
  Job EYGLESYS_EXPORT_TRANSPORTABLE_ successfully completed at :
  
  使用rman轉換文件格式
  $ rman target /
  
  Recovery Manager: Release bit Production
  
  Copyright (c) Oracle All rights reserved
  
  connected to target database: EYGLE (DBID=)
  
  RMAN> convert tablespace trans
  > to platform Microsoft Windows IA (bit)
  
From:http://tw.wingwit.com/Article/program/Oracle/201311/17022.html
    Copyright © 2005-2022 電腦知識網 Computer Knowledge   All rights reserved.