When we are using Exp/imp for cross-platform migrations, due to changes in tablespace paths, it is necessary to manually create a table space and data file on the target side that is consistent with the source, and the following is the script to create the generated statement.
one. Execute the following command on the source-side database to generate the Create script
Select ' Create Tablespace ' | | B.name | | ' DataFile ' | | Chr (39) | | A.name | | Chr (39) | | ' SIZE ' | | a.bytes/1024/1024 | | ' m; ' From V$datafile A, v$tablespace bwhere a.ts# = b.ts# and b.included_in_database_backup= ' YES ' Union allselect ' Create Tempor ary Tablespace ' | | B.name | | ' Tempfile ' | | Chr (39) | | A.name | | Chr (39) | | ' SIZE ' | | a.bytes/1024/1024 | | ' m; ' From V$tempfile A, v$tablespace bwhere a.ts# = b.ts# and b.included_in_database_backup= ' NO ' Union allselect ' Alter DAT Abase DataFile ' | | Chr (39) | | A.name | | Chr | | ' autoextend on; ' From V$datafile A, v$tablespace bwhere a.ts# = b.ts# and b.included_in_database_backup= ' YES ' Union allselect ' ALTER DATABASE Tempfile ' | | Chr (39) | | A.name | | Chr | | ' autoextend on; ' From V$tempfile A, v$tablespace bwhere a.ts# = b.ts# and b.included_in_database_backup= ' NO '
Two. The resulting results are similar to the following:Cases:
Create tablespace system datafile '/oradata/orcl/system01.dbf ' size (m);
Create tablespace undotbs1 datafile '/oradata/orcl/undotbs01.dbf ' size 1630 m;
Create tablespace sysaux datafile '/oradata/orcl/sysaux01.dbf ' size + m;
Create tablespace users datafile '/oradata/orcl/users01.dbf ' size 5 m;
......
Create tablespace zl9indexdev datafile '/oradata/orcl/zl9indexdev.dbf ' size m;
Create tablespace zl9humanbase datafile '/oradata/orcl/zl9humanbase.dbf ' size m;
Create tablespace zl9humaninfo datafile '/oradata/orcl/zl9humaninfo.dbf ' size m;
.......
ALTER DATABASE datafile '/ORADATA/ORCL/SYSTEM01.DBF ' autoextend on;
ALTER DATABASE datafile '/ORADATA/ORCL/UNDOTBS01.DBF ' autoextend on;
ALTER DATABASE datafile '/ORADATA/ORCL/SYSAUX01.DBF ' autoextend on;
ALTER DATABASE datafile '/ORADATA/ORCL/USERS01.DBF ' autoextend on;
......
ALTER DATABASE Tempfile '/ORADATA/ORCL/ZLTOOLSTMP.DBF ' autoextend on;
Modify the data file path of the generated statement by replacing it, execute the command on the target side, generate the tablespace and data file, and finally import the data
IMP Cross-platform Migration database SQL Generate SQL mode tablespace creation script