我继承了一个运行Oracle 10g的旧Oracle Server,除了几个登录凭据外,我几乎没有关于系统的信息,并且我们正忙于第三方将应用程序迁移到较新的平台。
为了让他们分析当前系统,他们要求我们提供数据泵
我已经创建了一个数据泵目录并使用SQL Developer数据泵向导
以下是命令的输出:
Error starting at line : 8 in command - DECLARE
TYPE empcurtyp IS REF CURSOR;
v_emp_cursor empcurtyp; --emp_record employees%ROWTYPE;
v_stmt_str VARCHAR2(200); --v_e_job employees.job%TYPE;
ona VARCHAR2(4000 BYTE);
jn VARCHAR2(4000 BYTE);
jm VARCHAR2(4000 BYTE);
s VARCHAR2(4000 BYTE);
fnameplsql varchar2(4000 byte):= :FNAME; BEGIN -- Dynamic SQL statement with placeholder:
v_stmt_str := 'select OWNER_NAME, JOB_NAME, JOB_MODE, STATE FROM SYS.DBA_DATAPUMP_JOBS where OWNER_NAME||''.''||job_name=:fin'
;
-- Open cursor & specify bind variable in USING clause:
BEGIN
OPEN v_emp_cursor FOR v_stmt_str
USING fnameplsql;
-- Fetch rows from result set one at a time:
LOOP
FETCH v_emp_cursor INTO
ona,
jn,
jm,
s;
EXIT;
END LOOP;
-- Close cursor:
CLOSE v_emp_cursor;
EXCEPTION
WHEN OTHERS THEN
BEGIN
BEGIN
if (v_emp_cursor%isopen) then
CLOSE v_emp_cursor;
end if;
EXCEPTION
WHEN OTHERS THEN
NULL;
END;
-- Dynamic SQL statement with placeholder:
v_stmt_str := 'select user OWNER_NAME, JOB_NAME, JOB_MODE, STATE FROM user_DATAPUMP_JOBS where user||''.''||job_name=:fin'
;
-- Open cursor & specify bind variable in USING clause:
BEGIN
OPEN v_emp_cursor FOR v_stmt_str
USING fnameplsql; -- Fetch rows from result set one at a time:
LOOP
FETCH v_emp_cursor INTO
ona,
jn,
jm,
s;
EXIT;
END LOOP;
-- Close cursor:
CLOSE v_emp_cursor;
EXCEPTION
WHEN OTHERS THEN
BEGIN
BEGIN
if (v_emp_cursor%isopen) then
CLOSE v_emp_cursor;
end if;
EXCEPTION
WHEN OTHERS THEN
NULL;
END;
END;
END;
END;
END;
--owner_name and job_name could be any valid value - could have been double quoted on the way in
:OWNER_NAME:=ona;
:JOB_NAME:=jn;
:OWNER_NAMEQ:=SYS.DBMS_ASSERT.simple_sql_name(SYS.DBMS_ASSERT.ENQUOTE_NAME(ona,false));
:JOB_NAMEQ:=SYS.DBMS_ASSERT.simple_sql_name(SYS.DBMS_ASSERT.ENQUOTE_NAME(jn,false));
:STATE:=s;
/* dbms_output.put_line(ona
|| ':'
|| jn
|| ':'
|| trim(jm)
|| ':'
|| s);*/
END;
错误:
Error report -
ORA-06550: line 86, column 22:
PLS-00201: identifier 'SYS.DBMS_ASSERT' must be declared
ORA-06550: line 86, column 6:
PL/SQL: Statement ignored
ORA-06550: line 87, column 22:
PLS-00201: identifier 'SYS.DBMS_ASSERT' must be declared
ORA-06550: line 87, column 6:
PL/SQL: Statement ignored
06550. 00000 - "line %s, column %s:\n%s"
*Cause: Usually a PL/SQL compilation error.
*Action:
CHECKING MASTER TABLE
PL/SQL procedure successfully completed.
Error starting at line : 131 in command -
BEGIN
IF (:UTL_ERROR IS NOT NULL) THEN
Raise_application_error(-20001,:UTL_ERROR);
END IF;
END;
Error report -
ORA-20001: STATE IS NULL
ORA-06512: at line 3