主要遵从以下步骤:
Transportable Tablespaces Steps:
· Determine the source and target database oracle version( Source database version can not be more than target database version).
· Verification of endian compatibilities of source and target and if there is any conversions required .
· Check Database Character set and national Character set for compatibility between source and target.
· Determine if there are external objects (external tables ,directory structures) need to moved separately to target database.
· Determine the tablespaces needs to be transported.
· Check for any violations.
· Put the tablespaces in read only mode.
· Export the meta data information for the tablespaces.
· Determine the size on each file system for these tablespace datafiles.
· Generate the ftp or copy commands for the files to moved to target.
· FTP or copy the source files to target location.
· Make Tablespaces to Read Write mode on the source.
· Generate the import par file with new location of the files on the target.
· Create the user on the target if required.
· Import into the target Database using export file and Par file generated from source database.
· Recompile all the procedures and packages.
· Put tablepsaces on target to read write mode.
细节:
1.平台的检查。
SELECT PLATFORM_ID, PLATFORM_NAME, ENDIAN_FORMAT FROM V$TRANSPORTABLE_PLATFORM ;
2.在源数据库,(aix)创建一个表空间:
以sys登陆
sql>create tablespace ttstest datafile '/u01/oradata/wuk/ttstest01.dbf' size 20M;
sql>create user ttstest identified by ttstest default tablespace ttstest temporary tablespace temp;
sql>grant connect,resource to ttstest;
sql>create table test (name varchar2(10));
sql>insert into test value('kenny');
sql>commit;
sql>alter tablespace ttstest read only;
$cd /u01/oradata/wuk
$mkdir tmp_tts
--以上这一步是为文件进行平台转换准备。这个目录将要存放经过转换的数据文件。也就是说,在进行表空间传输时,需要准备双倍的空间。
在源数据库,(aix)利用rman的convert tablespace命令进行文件转换:
rman>connect target
rman>run {
allocate channel d1 device type disk;
CONVERT tablespace 'TTSTEST'
TO PLATFORM 'Linux 64-bit for AMD'
DB_FILE_NAME_CONVERT=
'/u01/oradata/wuk','/u01/oradata/wuk/tmp_tts';
release channel d1
}
--就是把路径下/u01/oradata/wuk的TTSTEST表空间下的数据文件转换到/u01/oradata/wuk/tmp_tts目录下。
转换完毕后,把数据文件传到linux的server的指定目录中。如'/u01/oradata/kenny'
在源数据库,做export,把metadata导出。
$exp "'/ as sysdba '" triggers=y constraints=y grants=y file=/u01/oradata/wuk/tmp_tts/ttstest_dmp.dmp transport_tablespace=y tablespaces=TTSTEST statistics=NONE
把dump文件传到目的数据库相应路径下
在目的数据库:
以管理员账号登陆,我用sys
sql>create user ttstest identified by ttstest;
注意,由于源数据库的TTSTEST表空间尚未导进来,因此,只能先把用户创建在其他表空间中。
sql>grant connect,resource to ttstest;--权限设置成与用户在源数据库的一样。
$imp "'/ as sysdba'" datafiles='/u01/oradata/kenny/ttstest01.dbf' file=/u01/oradata/kenny/ttstest_dmp.dmp transport_tablespace=Y fromuser=ttstest touser=ttstest
sql>alter tablespace ttsteset read write;
sql>alter user ttstest default tablespace ttstest;
最后:
检查权限,external objects以及;
Recompile all the objects.
Compare source schema and target schema.
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/3345/viewspace-1023015/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/3345/viewspace-1023015/