准備工作: 查詢源數據庫平台信息
SQL> col platform_name for a
SQL> SELECT d
PLATFORM_NAME
ENDIAN_FORMAT
FROM V$TRANSPORTABLE_PLATFORM tp
V$DATABASE d
WHERE tp
PLATFORM_NAME = d
PLATFORM_NAME;
PLATFORM_NAME ENDIAN_FORMAT
Solaris[tm] OE (
bit) Big
查詢目標數據庫平台信息
SQL> col platform_name for a
SQL> SELECT d
PLATFORM_NAME
ENDIAN_FORMAT
FROM V$TRANSPORTABLE_PLATFORM tp
V$DATABASE d
WHERE tp
PLATFORM_NAME = d
PLATFORM_NAME;
PLATFORM_NAME ENDIAN_FORMAT
Microsoft Windows IA (
bit) Little
查詢Oracle
g支持的平台轉換
代碼:
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
AIX
Based Systems (
bit) Big
HP
UX (
bit) Big
HP Tru
UNIX Little
HP
UX 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/system
dbf
/opt/oracle/oradata/eygle/undotbs
dbf
/opt/oracle/oradata/eygle/sysaux
dbf
/opt/oracle/oradata/eygle/users
dbf
/data
/oradata/systemfile/eygle
dbf
/opt/oracle/oradata/eygle/EYGLE/datafile/o
_mf_test_
xv
ny_
dbf
/opt/oracle/oradata/eygle/EYGLE/datafile/o
_mf_itpub_
xv
g
_
dbf
rows selected
SQL> create tablespace trans
datafile
/data
/oradata/systemfile/trans
dbf
size
M;
Tablespace created
SQL> create user trans identified by trans
default tablespace trans;
User created
SQL> grant connect
resource 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=trans
dmp directory=dpdata transport_tablespace=trans
LRM
: unknown parameter name
transport_tablespace
$ expdp eygle/eygle dumpfile=trans
dmp 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
EYGLE
SYS_EXPORT_TRANSPORTABLE_
: eygle/******** dumpfile=trans
dmp directory=dpdata TRANSPORT_TABLESPACES=trans
ORA
: Data Pump transportable tablespace job aborted
ORA
: tablespace
TRANS
is not read only
Job
EYGLE
SYS_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=trans
dmp 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
EYGLE
SYS_EXPORT_TRANSPORTABLE_
: eygle/******** dumpfile=trans
dmp 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
EYGLE
SYS_EXPORT_TRANSPORTABLE_
successfully loaded/unloaded
******************************************************************************
Dump file set for EYGLE
SYS_EXPORT_TRANSPORTABLE_
is:
/opt/oracle/dpdata/trans
dmp
Job
EYGLE
SYS_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