将表空间从A机搬移至B机,在这里我们可以使用传统工具exp/imp来实现。
1,首先确认A,B机的系统默认blocksize是否相同,如果不同,则需要在B机上设置相应的db_nk_cache,并建立与A机需要搬移表空间相同blocksize的表空间。
2,检查A,B机的语言环境,NLS_CHARACTERSET,NLS_NCHAR_CHARACTERSET,确保字符集一致。
select * from nls_database_parameters
where parameter='NLS_CHARACTERSET' or parameter='NLS_NCHAR_CHARACTERSET';
3,在A机上检查搬移表空间的自包含:
以sys用户执行dbms_tts.transport_set_check('tbs',true)
然后检查sys.transport_set_violations表里面的结果,如果没有记录,则说明表空间自包含,如果有记录,则进行相应的操作,
例如删除索引等,然后再进行自包含检查。
4,在B机建立lsh用户,分配权限并分配足够的的空间使用配额。
5,将表空间改为read only
alter tablespace tbs read only;
6,将表空间从A机导出
host exp /'sys/passwd@sid as sysdba/' transport_tablespace=y tablespaces=tbs file=/export/home/oracle/ora10g/tbs.dmp
7,将dmp存储文件和tbs包含的datefile(tbs01.dbf)以bin格式传送至B机相应目录
8,在B机执行imp
host imp /'sys/passwd@sid as sysdba/' transport_tablespace=y file=F:/oracle10g/product/10.2.0/oradata/tbs.dmp datafiles=F:/oracle10g/product/10.2.0/oradata/tbs01.dbf
9,在A机和B机上将搬移表空间tbs改为read write
alter tablespace tbs read write;
1,首先确认A,B机的系统默认blocksize是否相同,如果不同,则需要在B机上设置相应的db_nk_cache,并建立与A机需要搬移表空间相同blocksize的表空间。
2,检查A,B机的语言环境,NLS_CHARACTERSET,NLS_NCHAR_CHARACTERSET,确保字符集一致。
select * from nls_database_parameters
where parameter='NLS_CHARACTERSET' or parameter='NLS_NCHAR_CHARACTERSET';
3,在A机上检查搬移表空间的自包含:
以sys用户执行dbms_tts.transport_set_check('tbs',true)
然后检查sys.transport_set_violations表里面的结果,如果没有记录,则说明表空间自包含,如果有记录,则进行相应的操作,
例如删除索引等,然后再进行自包含检查。
4,在B机建立lsh用户,分配权限并分配足够的的空间使用配额。
5,将表空间改为read only
alter tablespace tbs read only;
6,将表空间从A机导出
host exp /'sys/passwd@sid as sysdba/' transport_tablespace=y tablespaces=tbs file=/export/home/oracle/ora10g/tbs.dmp
7,将dmp存储文件和tbs包含的datefile(tbs01.dbf)以bin格式传送至B机相应目录
8,在B机执行imp
host imp /'sys/passwd@sid as sysdba/' transport_tablespace=y file=F:/oracle10g/product/10.2.0/oradata/tbs.dmp datafiles=F:/oracle10g/product/10.2.0/oradata/tbs01.dbf
9,在A机和B机上将搬移表空间tbs改为read write
alter tablespace tbs read write;