前端之家收集整理的这篇文章主要介绍了
Oracle数据移动-不同用户不同表空间之间的数据移动,
前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
不同
用户不同表空间之间的数据移动: 将nezha
用户下的数据移动到zhubajie
用户下。 表空间为:poineer_data、PIONEER_INDX 到lianxi 1、查看两个
用户的信息及数据:
sql> conn nezha/nezha; Connected to Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 Connected as nezha
sql> select TABLE_NAME,TABLESPACE_NAME from user_tables; TABLE_NAME TABLESPACE_NAME ------------------------------ ------------------------------ SALES PIONEER_DATA CUSTOMERS PIONEER_DATA
sql> conn zhubajie/zhubajie; Connected to Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 Connected as zhubajie
sql> select TABLE_NAME,TABLESPACE_NAME from user_tables; TABLE_NAME TABLESPACE_NAME ------------------------------ ------------------------------ ZHUTTABLE LIANXI 2、查看nezha
用户的所有信息:
sql> select object_name,object_type,status from user_objects; OBJECT_NAME OBJECT_TYPE STATUS -------------------------------------------------------------------------------- ------------------- ------- SALES TABLE VALID CUSTOMERS TABLE VALID SALES_PROD_ID INDEX VALID SALES_CUST_ID INDEX VALID SALES_CHANNEL_ID INDEX VALID CUSTOMERS_GENDER_IDX INDEX VALID CUSTOMERS_CITY_IDX INDEX VALID 7 rows selected 3、查看索引所在的表空间:
sql> select index_name,tablespace_name from user_indexes; INDEX_NAME TABLESPACE_NAME ------------------------------ ------------------------------ CUSTOMERS_GENDER_IDX PIONEER_INDX CUSTOMERS_CITY_IDX PIONEER_INDX SALES_PROD_ID PIONEER_INDX SALES_CUST_ID PIONEER_INDX SALES_CHANNEL_ID PIONEER_INDX 4、导数据参数: DIRECTORY=DATA_PUMP_DIR SCHEMAS=nezha DUMPFILE=schema_nezha.dat EXCLUDE=PACKAGE EXCLUDE=VIEW 保存txt
文件。eg。22.txt 5、导出数据: C:\>expdp system/ttt parfile=c:\orcl1122\22.txt; 6、导入数据参数: DIRECTORY=DATA_PUMP_DIR DUMPFILE=schema_nezha.dat REMAP_SCHEMA=NEZHA:ZHUBAJIE REMAP_TABLESPACE=USERS:PIONEER_DATA 保存txt
文件 eg:44.txt 7、导入数据: impdp system/ttt parfile=c:\orcl1122\44.txt;