设为首页 加入收藏

TOP

DataPump的导入和导出数据(ORA-31684)(七)
2014-11-24 02:33:05 来源: 作者: 【 】 浏览:6
Tags:DataPump 导入 导出 数据 ORA-31684
BLE

SQL> select table_name,tablespace_name from user_tables;

TABLE_NAME TABLESPACE_NAME
------------------------------ ------------------------------
DEPT USERS
EMP USERS
BONUS USERS
SALGRADE USERS

使用DBMS_DATAPUMP导出指定SCHEMA:
SQL> conn scott/oracle
Connected.
SQL> set serveroutput on

declare
 hand number;
 ind number;
 job_state varchar(20);
 le ku$_LogEntry;
 sts ku$_Status;
begin
 --create export task
 hand:=Dbms_DataPump.Open(Operation => 'EXPORT',
			  job_mode  => 'SCHEMA',
			  job_name  => 'SCHEMA_SCOTT_EXPJOB');
 --add log file
 Dbms_DataPump.Add_File(handle    => hand,
			filename  => 'SCOTT_expdp.log',
			directory => 'DUMP_FILE_DIR',
			filetype  => 3);
 --add dump file
 Dbms_DataPump.Add_File(handle    => hand,
                        filename  => 'SCOTT_expdp.dmp',
                        directory => 'DUMP_FILE_DIR',
                        filetype  => 1);
 --start task
 Dbms_DataPump.Start_Job(hand);
 --Executing State
 job_state:='UNDEFINED';
 while(job_state!='COMPLETED') and (job_state!='STOPPED') loop
 dbms_datapump.get_status(hand,
			  dbms_datapump.ku$_status_job_error + 
			  dbms_datapump.ku$_status_job_status +
			  dbms_datapump.ku$_status_wip,
			  -1,
			  job_state,
			  sts);
 --print error
if(bitand(sts.mask,dbms_datapump.ku$_status_wip)!=0) then
 le := sts.wip;
 else
  if(bitand(sts.mask,dbms_datapump.ku$_status_job_error)!=0) then
 le := sts.error;
 else
 le :=null;
 end if;
end if;
if le is not null then
 ind := le.FIRST;
 while ind is not null loop
 dbms_output.put_line(le(ind).LogText);
 ind := le.NEXT(ind);
  end loop;
 end if;
end loop;
--print completed!
dbms_output.put_line('Job has completed!');
dbms_output.put_line('Final job state='||job_state);
dbms_datapump.detach(hand);
end;
/


Starting "SCOTT"."SCHEMA_SCOTT_EXPJOB":
Estimate in progress using BLOCKS method...
Processing object type SCHEMA_EXPORT/TABLE/TABLE_DATA
Total estimation using BLOCKS method: 192 KB
Processing object type SCHEMA_EXPORT/USER
Processing object type SCHEMA_EXPORT/SYSTEM_GRANT
Processing object type SCHEMA_EXPORT/ROLE_GRANT
Processing object type SCHEMA_EXPORT/DEFAULT_ROLE
Processing object type SCHEMA_EXPORT/PRE_SCHEMA/PROCACT_SCHEMA
Processing object type SCHEMA_EXPORT/TABLE/TABLE
Processing object type SCHEMA_EXPORT/TABLE/INDEX/INDEX
Processing object type SCHEMA_EXPORT/TABLE/CONSTRAINT/CONSTRAINT
Processing object type SCHEMA_EXPORT/TABLE/INDEX/STATISTICS/INDEX_STATISTICS
Processing object type SCHEMA_EXPORT/TABLE/COMMENT
Processing object type SCHEMA_EXPORT/TABLE/CONSTRAINT/REF_CONSTRAINT
Processing object type SCHEMA_EXPORT/TABLE/STATISTICS/TABLE_STATISTICS
. . exported "SCOTT"."DEPT" 5.656 KB 4 rows
. . exported "SCOTT"."EMP" 7.820 KB 14 rows
. . exported "SCOTT"."SALGRADE" 5.585 KB 5 rows
. . exported "SCOTT"."BONUS" 0 KB 0 rows
Master table "SCOTT"."SCHEMA_SCOTT_EXPJOB" successfully loaded/unloaded
******************************************************************************
Dump file set for SCOTT.SCHEMA_SCOTT_EXPJOB is:
/u01/imp_exp/dmp/SCOTT_expdp.dmp
Job "SCOTT"."SCHEMA_SCOTT_EXPJOB" successfully completed at 20:24:39
Job has completed!
Final job state=COMPLETED

PL/SQL procedure successfully completed.
[oracle@linux5 dmp]$ ls
dept_10.dmp dept_exp_20.dmp scott.dmp SCOTT_expdp.log
dept_exp_20_2.log dept_exp_20.log SCOTT_expdp.dmp scott.log
使用DBMS_DATAPUMP导出指定对象:

如果名字不大写:
ORA-390

首页 上一页 4 5 6 7 下一页 尾页 7/7/7
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
分享到: 
上一篇Bug10121589ORA-600[kjbmprlst:sh.. 下一篇Oracle学习笔记5--多表查询

评论

帐  号: 密码: (新用户注册)
验 证 码:
表  情:
内  容: