数据库

位置:IT落伍者 >> 数据库 >> 浏览文章

关于Oracle10g跨平台传输表空间


发布日期:2018年03月28日
 
关于Oracle10g跨平台传输表空间

准备工作:

查询源数据库平台信息

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 * fromv$transportable_platform;

PLATFORM_ID PLATFORM_NAMEENDIAN_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 UNIXLittle

HPUX IA (bit)Big

Linux IA (bit)Little

HP Open VMSLittle

Microsoft Windows IA (bit)Little

PLATFORM_ID PLATFORM_NAMEENDIAN_FORMAT

IBM zSeries Based LinuxBig

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) OracleAll 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> selectcount(*) from test;

COUNT(*)

SQL> select * from test;

OBJECT_NAME

SUBOBJECT_NAMEOBJECT_ID DATA_OBJECT_ID OBJECT_TYPE

CREATEDLAST_DDL_TIM TIMESTAMP STATUST G S

TEST

TABLE

APRAPR::: 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)

               

上一篇:通过Oracle动态性能视图采集查询调优数

下一篇:数据库手册:速查Oracle函数列表