1. Use IMP to export data
Run cmd to enter the orcle installation directory bin and enter the following command:
Exp username/password @ oracleepp file = c: \ hysjb. dmp owner = magazine_hy rows = y
2. Use IMP to generate the index. SQL File
ImP <xe_username>/<password> @ Xe file = <FILENAME. DMP> indexfile = index. SQL full = y
3. Modify the index. SQL File
Find: 'rem <space> 'Replace: <nothing>
Find: '"<source_tablespace>" 'replace:' "users "'
Find: '...' Replace: 'rem ...'
Find: 'connect 'replace: 'rem connect'
PS: query the table space statement:
Select
DF . Tablespace_name "Tablespace_name" , Totalspace "Totalspace/M" , Freespace "Freespace/M" , Round (( 1 - Freespace / Totalspace )* 100 , 2 ) "Used %"
From
( Select Tablespace_name , Round ( Sum ( Bytes )/ 1024 / 1024 ) Totalspace From Dba_data_files Group By Tablespace_name ) DF ,
( Select Tablespace_name , Round ( Sum ( Bytes )/ 1024 / 1024 ) Freespace From Dba_free_space Group By Tablespace_name ) FS
Where DF . Tablespace_name = FS . Tablespace_name ;
4. Use sqlplus to run this SQL statement to generate the table structure
Sqlplus <xe_username>/<password> @ Xe @ index. SQL
5. Enter the database diasble to drop dependencies.
Select 'AlterTable' | Table_name | 'Disable constraint' | Constraint_name | ';' From User_constraints
Where Constraint_type='R ';
Export the CSV file as imp. SQL, delete the "number, and execute.
6. import data. Run the following command in cmd:
ImP <xe_username>/<password> @ Xe file = <FILENAME. DMP> fromuser = <original_username> touser = <xe_username> ignore = y
7. Replace disable in IMP. SQL with enable for execution. Enable dependency