异构平台表空间迁移--传输表空间
源库
主机系统 Solaris Operating System (x86-64)
oracle 11.2.0.1
目标库
主机系统 redhat linux 32bit
oracle 11.2.0.1
1、源库操作
在源库将要传递的表空间设置为只读
--说明,tts_user用户的默认表空间为tts
alter tablespace tts read only;
在源库导出表空间的元数据:
expdp system/oracle DIRECTORY=DATA_PUMP_DIR DUMPFILE=tts.dmp TRANSPORT_TABLESPACES=tts
拷贝元数据和表空间对应的文件到目标库主机
tts01.dbf --数据文件
tts.dmp --表空间元数据
2、目标库操作
查询字节序
set pages 1000
COLUMN PLATFORM_NAME FORMAT A36
SSELECT * FROM V$TRANSPORTABLE_PLATFORM ORDER BY PLATFORM_NAME;
PLATFORM_ID PLATFORM_NAME ENDIAN_FORMAT
----------- ------------------------------------ --------------
6 AIX-Based Systems (64-bit) Big
16 Apple Mac OS Big
21 Apple Mac OS (x86-64) Little
19 HP IA Open VMS Little
15 HP Open VMS Little
5 HP Tru64 UNIX Little
3 HP-UX (64-bit) Big
4 HP-UX IA (64-bit) Big
18 IBM Power Based Linux Big
9 IBM zSeries Based Linux Big
10 Linux IA (32-bit) Little
11 Linux IA (64-bit) Little
13 Linux x86 64-bit Little
7 Microsoft Windows IA (32-bit) Little
8 Microsoft Windows IA (64-bit) Little
12 Microsoft Windows x86 64-bit Little
17 Solaris Operating System (x86) Little
20 Solaris Operating System (x86-64) Little
1 Solaris[tm] OE (32-bit) Big
2 Solaris[tm] OE (64-bit) Big
20 rows selected.
在目标库数据库,转化数据
export ORACLE_SID=PROD4
rman target /
CONVERT DATAFILE '/ora11g/scripts/tts01.dbf'
DB_FILE_NAME_CONVERT='/ora11g/scripts/tts01.dbf','/ora11g/OracleHomes/oradata/prod4/tts01.dbf'
FROM PLATFORM 'Solaris Operating System (x86-64)';
创建用户及授权
create user tts_user identified by tts_user;
grant connect,resource to tts_user;
导入目标库数据库
impdp system/oracle dumpfile='tts.dmp' directory=DATA_PUMP_DIR TRANSPORT_DATAFILES='/ora11g/OracleHomes/oradata/prod4/tts01.dbf'
修改表空间模式
alter tablespace TTS read write;
=========================================================================================
部分操作记录
1、在目标库新建一个用户tts_user
SQL> create user tts_user identified by tts_user;
User created.
SQL> grant connect,resource to tts_user;
Grant succeeded.
SQL>
SQL> select username,default_tablespace from dba_users;
USERNAME DEFAULT_TABLESPACE
------------------------------ ------------------------------
SYS SYSTEM
SYSTEM SYSTEM
TTS_USER USERS
OUTLN SYSTEM
APPQOSSYS SYSAUX
DBSNMP SYSAUX
WMSYS SYSAUX
DIP USERS
ORACLE_OCM USERS
9 rows selected.
2、在目标库转化数据
[ora11g@ora11g ~]$ echo $ORACLE_SID
PROD4
[ora11g@ora11g ~]$
[ora11g@ora11g ~]$ rman target /
Recovery Manager: Release 11.2.0.1.0 - Production on Sun May 10 00:52:20 2015
Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
connected to target database: PROD4 (DBID=1630404751)
RMAN> CONVERT DATAFILE '/ora11g/scripts/tts01.dbf'
2> DB_FILE_NAME_CONVERT
3> '/ora11g/scripts/tts01.dbf','/ora11g/OracleHomes/oradata/prod4/tts01.dbf'
4> FROM PLATFORM 'Solaris Operating System (x86-64)';
Starting conversion at target at 10-MAY-15
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=31 device type=DISK
channel ORA_DISK_1: starting datafile conversion
input file name=/ora11g/scripts/tts01.dbf
converted datafile=/ora11g/OracleHomes/oradata/prod4/tts01.dbf
channel ORA_DISK_1: datafile conversion complete, elapsed time: 00:00:03
Finished conversion at target at 10-MAY-15
RMAN>
RMAN> exit
Recovery Manager complete.
[ora11g@ora11g ~]$ ls -l /ora11g/OracleHomes/oradata/prod4/tts01.dbf
-rw-r----- 1 ora11g dba 20979712 May 10 00:52 /ora11g/OracleHomes/oradata/prod4/tts01.dbf
[ora11g@ora11g ~]$
3、使用impdp将数据导入目标库
SQL> set lines 200 pages 10000
SQL> select * from dba_directories;
OWNER DIRECTORY_NAME DIRECTORY_PATH
------ --------------------- ------------------------------------
SYS ORACLE_OCM_CONFIG_DIR /ora11g/OracleHomes/db11g/ccr/state
SYS DATA_PUMP_DIR /ora11g/OracleHomes/db11g/rdbms/log/
[ora11g@ora11g ~]$ export ORACLE_SID=PROD4
[ora11g@ora11g ~]$ impdp system/oracle dumpfile='tts.dmp' directory=DATA_PUMP_DIR TRANSPORT_DATAFILES='/ora11g/OracleHomes/oradata/prod4/tts01.dbf'
Import: Release 11.2.0.1.0 - Production on Sun May 10 00:56:42 2015
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 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
Master table "SYSTEM"."SYS_IMPORT_TRANSPORTABLE_01" successfully loaded/unloaded
Starting "SYSTEM"."SYS_IMPORT_TRANSPORTABLE_01": system/******** dumpfile=tts.dmp directory=DATA_PUMP_DIR TRANSPORT_DATAFILES=/ora11g/OracleHomes/oradata/prod4/tts01.dbf
Processing object type TRANSPORTABLE_EXPORT/PLUGTS_BLK
Processing object type TRANSPORTABLE_EXPORT/TABLE
Processing object type TRANSPORTABLE_EXPORT/TABLE_STATISTICS
Processing object type TRANSPORTABLE_EXPORT/POST_INSTANCE/PLUGTS_BLK
Job "SYSTEM"."SYS_IMPORT_TRANSPORTABLE_01" successfully completed at 00:56:52
[ora11g@ora11g ~]$
4、修改表空间为读写模式
SQL> set lines 120 pages 10000
SQL> select tablespace_name,status from dba_tablespaces;
TABLESPACE_NAME STATUS
------------------------------ ---------
SYSTEM ONLINE
SYSAUX ONLINE
UNDOTBS1 ONLINE
TEMP ONLINE
USERS ONLINE
TTS READ ONLY
6 rows selected.
SQL> alter tablespace TTS read write;
Tablespace altered.
SQL> select tablespace_name,status from dba_tablespaces;
TABLESPACE_NAME STATUS
------------------------------ ---------
SYSTEM ONLINE
SYSAUX ONLINE
UNDOTBS1 ONLINE
TEMP ONLINE
USERS ONLINE
TTS ONLINE
6 rows selected.
至此,异构平台表空间迁移完成。
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/24626891/viewspace-2073438/,如需转载,请注明出处,否则将追究法律责任。