Oracle数据库的功能兼容性由COMPATIBLE初始化参数进行控制,此参数启用或禁用数据库中的某些功能。创建可移动表空间集合时,Oracle将确定目标数据库的最低兼容性级别,并将相应值存储在可移动数据集的元数据中。从Oracle Database 11g开始,不管对于哪种目标平台,始终可以将表空间移动到拥有相同或更高兼容性级别的另一个数据库中。
另外,两个数据库必须使用相同的字符集。
2.1.2 确定字节序要求
--查询可移动表空间的所有支持平台及其ENDIAN_FORMAT:
SQL> select platform_id, platform_name, endian_format from v$transportable_platform order by 3,1;
PLATFORM_ID PLATFORM_NAME
ENDIAN_FORMAT
----------- ---------------------------------------- ------------------------------
1 Solaris[tm] OE
(32-bit)
Big
2 Solaris[tm] OE
(64-bit)
Big
3 HP-UX
(64-bit)
Big
4 HP-UX IA
(64-bit)
Big
6 AIX-Based Systems
(64-bit)
Big
9 IBM zSeries Based Linux
Big
16 Apple Mac OS
Big
18 IBM Power Based Linux
Big
5 HP Tru64 UNIX
Little
7 Microsoft Windows IA
(32-bit)
Little
8 Microsoft Windows IA
(64-bit)
Little
10 Linux IA
(32-bit)
Little
11 Linux IA
(64-bit)
Little
12 Microsoft Windows x86 64-bit
Little
13 Linux x86 64-bit
Little
15 HP Open VMS
Little
17 Solaris Operating System
(x86)
Little
19 HP IA Open VMS
Little
20 Solaris Operating System
(x86-64)
Little
21 Apple Mac OS
(x86-64)
Little
20 rows selected.
--查询当前平台的字节序格式
select PLATFORM_NAME my_platform, ENDIAN_FORMAT my_endian_format from v$transportable_platform join v$database using
(platform_name);
SQL> select PLATFORM_NAME my_platform, ENDIAN_FORMAT my_endian_format
2 from v$transportable_platform
3 join v$database using
(platform_name);
MY_PLATFORM
MY_ENDIAN_FORMAT
------------------------------ ------------------------------------------
Linux x86 64-bit
Little
2.2 传输表空间
传输表空间核心步骤:
1)源数据库上的表空间设为只读模式;
2)源数据库上提取表空间元数据;
3)如果源和目的的字节序格式不同,转换表空间内容;
4)拷贝表空间数据文件以及表空间元数据到目的数据库��
5)目的数据库导入表空间元数据;
6)源数据库和目的数据库的表空间设置为读写模式。
--用户的默认表空间和默认临时表空间
select username, DEFAULT_TABLESPACE, TEMPORARY_TABLESPACE
from user_users;
--用户用到的表空间
select tablespace_name
from user_tables
union
select tablespace_name
from user_tab_partitions
union
select tablespace_name
from user_indexes
union
select tablespace_name
from user_ind_partitions;
2.2.1 使用EM传输表空间
web图形化界面操作,
1.点击数据移动 -> 传输表空间 -> 生成可传输的表空间集,然后按提示一步步生成;
2.在目的地数据库 点击数据移动 -> 传输表空间 -> 集成现有可传输表空间集,然后按提示一步步集成在目的数据库中。
我这里实验在生成可传输的表空间集时报错:ORA-02097,ORA-19529。
--根据MOS文档:Received ORA-19529 Attempting To Do A Transportable Tablespace Export Through OEM (文档 ID 2073402.1)
ORA-02097: parameter cannot be modified because specified value is invalid
ORA-19529: Pattern /home/kqualls/transport/epsdev/o1_mf_ekb_cons_b6qc1hbm_.dbf in initialization parameter db_file_name_convert has an Oracle Managed Files file name.
--原因:
EM Cloud Control 12c does not support conversion of OMF files. Currently only user managed files are supported using the EM feature. There is an enhancement logged, Bug 21233808 - Cloud Control TTS generates invalid db_file_name_convert command ORA-02097
--解决:
Create RMAN Job
in EM Cloud Control Job
system, enter command line script commands there.
Using the RMAN Job
in the EM Job
system will
allow the process
to use the
database parameters to convert the
datafiles rather
than using the EM perl scripts that don
't support OMF files.
PS:即使没有问题,一般生产环境传输表空间也不采用EM,因为很多生产环境都没有安装EM,或者复杂的网络环境因素导致不方便使用EM。还是手动使用SQL传输表空间更加靠谱。
2.2.2 使用SQL传输表空间
参考:
3.Oracle段收缩功能
参考:
4.Oracle数据库资源管理
参考: