I've a Oracle dump file that I'm trying to import to AWS RDS Oracle 12.1.0.2.v17
database.
The dump file looks like this:
$ strings EXPDP.dmp | head -n 6
_|lM
"PACOPROD"."SYS_EXPORT_SCHEMA_01"
IBMPC/WIN_NT64-9.1.0
unicode
AL32UTF8
12.01.00.00.00
The commands I'm running is:
DECLARE
hdnl NUMBER;
BEGIN
hdnl := DBMS_DATAPUMP.OPEN( operation => 'IMPORT', job_mode => 'SCHEMA', job_name=>null, version=>'COMPATIBLE');
DBMS_DATAPUMP.ADD_FILE( handle => hdnl, filename => 'EXPDP.dmp', directory => 'DATA_PUMP_DIR', filetype => dbms_datapump.ku$_file_type_dump_file);
DBMS_DATAPUMP.METADATA_FILTER(hdnl,'SCHEMA_EXPR','IN (''PACOPROD'')');
DBMS_DATAPUMP.START_JOB(hdnl);
END;
/
The response is:
Error report -
ORA-39002: invalid operation
ORA-06512: at "SYS.DBMS_DATAPUMP", line 6224
ORA-06512: at line 7
The closes similar issue I've found is this, even though it's not exactly the same error message and in my case both source and target db is running 12.1.
I think the issue is one of the following:
A) The DMP file is corrupt.
B) I'm doing something wrong.
I've no clue how to get further though. Where shall I dig or what should I try to go forward?
Try to add a log file to the operation. It some times contain more information:
DBMS_DATAPUMP.ADD_FILE( handle => hdnl, filename => 'EXPDP.log', directory => 'DATA_PUMP_DIR', filetype => dbms_datapump.KU$_FILE_TYPE_LOG_FILE);
Related
I know absolutely nothing about Oracle until attempting this restore. I have a .DMP file that I must restore. After many failed attempts I have issued the command:
alter system set DB_CREATE_FILE_DEST='E:\app\****\oradata\orcl';
because the data pump job keeps trying to put files on a D:\ that I cannot write to (it's a DVD drive). This DMP was created in Oracle 11g so that is what I've installed.
The error I get (many, many times) is like so:
O/S-Error: (OS 3) The system cannot find the path specified.
Failing sql is:
CREATE TABLESPACE "E:\APP\******\ORADATA\ORCL" DATAFILE 'D:\ORACLE\DATA\RRAEMR\LOGICIAN.DB' SIZE 251658240 AUTOEXTEND ON NEXT 5242880 MAXSIZE 2097152000,'D:\ORACLE\DATA\RRAEMR\LOGICIAN_DATA_0002.DB' SIZE 10
ORA-39083: Object type TABLESPACE failed to create with error:
ORA-01119: error in creating database file 'D:\ORACLE\DATA\RRAEMR\LOGIC_IX.DB'
ORA-27040: file create error, unable to create file
OSD-04002: unable to open file
O/S-Error: (OS 3) The system cannot find the path specified.
When I look at ALL_DIRECTORIES there is no directory pointed at D:\, all point to E:\ or C:\ or X:.
I should add that during the data pump import wizard I have tried remapping the tablespace files to where I want them and I do see some files landing there. I do not understand if this can be done for datafiles too. It looks like it should, but when adding a row and clicking it no datafile name is supplied like it was for tablespaces.
How can I restore this dump on a different drive?
EDIT:
Ok I am firing off another data pump import job without doing any remapping and within the first few seconds the log file already has errors like:
Failing sql is:
CREATE UNDO TABLESPACE "UNDOTBS" DATAFILE 'D:\ORACLE\DATA\RRAEMR\UNDOTBS01.DB' SIZE 20971520 AUTOEXTEND ON NEXT 5242880 MAXSIZE 2097152000,'D:\ORACLE\DATA\RRAEMR\UNDOTBS02.DB' SIZE 10485760 AUTOEXTEND ON NEX
ORA-39083: Object type TABLESPACE failed to create with error:
ORA-01119: error in creating database file 'D:\ORACLE\DATA\RRAEMR\TEMP_0003.DB'
ORA-27040: file create error, unable to create file
OSD-04002: unable to open file
O/S-Error: (OS 3) The system cannot find the path specified.
So it's still wanting to put on the D:. I captured the SQL for the job and here it is:
set scan off
set serveroutput on
set escape off
whenever sqlerror exit
DECLARE
s varchar2(1000);
h1 number;
errorvarchar varchar2(100):= 'ERROR';
tryGetStatus number := 0;
begin
h1 := dbms_datapump.open (operation => 'IMPORT', job_mode => 'FULL', job_name => 'IMP_SD_44-09_53_59', version => 'COMPATIBLE');
tryGetStatus := 1;
dbms_datapump.set_parallel(handle => h1, degree => 1);
dbms_datapump.add_file(handle => h1, filename => 'IMPORT-'||to_char(sysdate,'hh24_mi_ss')||'.LOG', directory => 'DMPDIR', filetype=>DBMS_DATAPUMP.KU$_FILE_TYPE_LOG_FILE);
dbms_datapump.set_parameter(handle => h1, name => 'KEEP_MASTER', value => 1);
dbms_datapump.add_file(handle => h1, filename => 'RRA.DMP', directory => 'DMPDIR', filetype => 1);
dbms_datapump.set_parameter(handle => h1, name => 'INCLUDE_METADATA', value => 1);
dbms_datapump.set_parameter(handle => h1, name => 'DATA_ACCESS_METHOD', value => 'AUTOMATIC');
dbms_datapump.set_parameter(handle => h1, name => 'REUSE_DATAFILES', value => 0);
dbms_datapump.set_parameter(handle => h1, name => 'TABLE_EXISTS_ACTION', value => 'REPLACE');
dbms_datapump.set_parameter(handle => h1, name => 'SKIP_UNUSABLE_INDEXES', value => 0);
dbms_datapump.start_job(handle => h1, skip_current => 0, abort_step => 0);
dbms_datapump.detach(handle => h1);
errorvarchar := 'NO_ERROR';
EXCEPTION
WHEN OTHERS THEN
BEGIN
IF ((errorvarchar = 'ERROR')AND(tryGetStatus=1)) THEN
DBMS_DATAPUMP.DETACH(h1);
END IF;
EXCEPTION
WHEN OTHERS THEN
NULL;
END;
RAISE;
END;
/
I'm trying to get a file from a Windows Server to our Oracle Application Server directory named EXT_TAB_DATA.
I have followed the sample of a similar SO post (PL/SQL FTP API binary vs ascii mode), using Tim Hall's FTP Package.
Code Block
set serveroutput on
DECLARE
l_conn UTL_TCP.connection;
BEGIN
L_CONN := FTP.login (p_host => 'sample.corp.server' -- this is a sample, not the real IP address
p_user => 'corporate/user1', -- this is a sample, not the real User
p_port => '21',
p_pass => 'pwd');
ftp.binary(p_conn => l_conn);
ftp.get (p_conn => l_conn,
p_from_file => '101_Test.csv',
p_to_dir => 'EXT_TAB_DATA',
p_to_file => '101_Test_Trans.csv');
ftp.logout(l_conn);
END;
/
However, the file i'm trying to transfer is located in a subfolder named "Payroll_Folder" in "sample.corp.server.
Seems FTP.login only checks the main directory of the host, and not inside subfolders.
How can I get the the file '101_Test.csv' from the Server/Directory "sample.corp.server/Payroll_Folder"?
Change
p_from_file => '101_Test.csv'
to
p_from_file => 'Payroll_Folder/101_Test.csv'
DECLARE
attachments shr_pkg_send_mail.array_attachments:=shr_pkg_send_mail.array_attachments();
b_input_file BFILE:= BFILENAME('mount_dir', 'test02.txt');
c_output_file CLOB;
BEGIN
--DBMS_OUTPUT.PUT_LINE(c_output_file);
dbms_lob.open(b_input_file, DBMS_LOB.LOB_READONLY);
-- DBMS_OUTPUT.PUT_LINE('1');
dbms_lob.createtemporary(lob_loc => c_output_file, cache => false);
--DBMS_OUTPUT.PUT_LINE('2');
dbms_lob.open(c_output_file, DBMS_LOB.LOB_READWRITE);
--DBMS_OUTPUT.PUT_LINE('3');
dbms_lob.loadfromfile(c_output_file, b_input_file, DBMS_LOB.LOBMAXSIZE);
--DBMS_OUTPUT.PUT_LINE('4');
dbms_lob.close(b_input_file);
--DBMS_OUTPUT.PUT_LINE('5');
attachments.extend(1);
attachments(1).attach_name := 'test02.txt';
attachments(1).data_type := 'text/plain';
attachments(1).attach_content := c_output_file; SHR_PKG_SEND_MAIL.SEND_MAIL('EthicsandComplianceITSupport_ORG#dl.mgd.novartis.com','mansi.kekre#novartis.com','test','test',attachments => attachments);
dbms_lob.close(c_output_file);
END ;
ERROR
ORA-22285: non-existent directory or file for FILEOPEN operation
ORA-06512: at "SYS.DBMS_LOB", line 1014
ORA-06512: at line 8
Get the directory path
select directory_path from all_directories where directory_name='MOUNT_DIR'
Check if this path exists on database server and oracle has read access to it.
Check if the file 'test02.txt' exits in this path and is accessible.
Give grants to this directory
GRANT READ, WRITE ON DIRECTORY MOUNT_DIR TO <some_user>;
And here is something interesting, how to see files in directory with select, but you should have access to the SYS user.
I am trying to insert the answer to a user's security question, for use in the pin reset feature.
Ellucian banner v8+ provides an API for running this and I very new to their API and from the looks of the error message below, I am far from running this correctly. Any help is appreciated.
I tried running this in Oracle SQL Developer:
execute gb_pin_answer.p_create(
P_PIDM => 12345,
P_NUM => 1,
p_gobqstn_id => 1,
p_qstn_desc => '',
p_ansr_desc => 'David',
p_ansr_salt => 'A123B456',
p_user_id => 'W:H12345678',
p_data_origin => 'WWW_USER',
p_rowid_out OUT gb_common.internal_record_id_type
);
This is a shot in the dark, but I thought I'd give it a shot, error message that displays when trying to execute that package's p_create function:
Error starting at line 15 in command: execute gb_pin_answer.p_create(
Error report: ORA-06550: line 1, column 30: PLS-00103: Encountered the
symbol ";" when expecting one of the following:
( ) - + case mod new not null table continue avg count
current exists max min prior sql stddev sum variance execute
multiset the both leading trailing forall merge year month day hour
minute second timezone_hour timezone_minute timezone_region
timezone_abbr time timestamp interval date
06550. 00000 - "line %s, column %s:\n%s"
*Cause: Usually a PL/SQL compilation error.
*Action:
Error starting at line 16 in command: P_PIDM => 12345, Error
report: Unknown Command
Error starting at line 17 in command: P_NUM => 1, Error report:
Unknown Command
Error starting at line 18 in command: p_gobqstn_id => 1, Error report:
Unknown Command
Error starting at line 19 in command: p_qstn_desc => '', Error
report: Unknown Command
Error starting at line 20 in command: p_ansr_desc => 'David', Error
report: Unknown Command
Error starting at line 21 in command: p_ansr_salt => 'A123B456',
Error report: Unknown Command
Error starting at line 22 in command: p_user_id => 'W:H12345678',
Error report: Unknown Command
Error starting at line 23 in command: p_data_origin => 'WWW_USER',
Error report: Unknown Command
Error starting at line 24 in command: p_rowid_out OUT
gb_common.internal_record_id_type Error report: Unknown Command
Error starting at line 25 in command: ) Error report: Unknown Command
This is where I read up on using this function, p_create: http://inb1.banner.ecu.edu:9090/api_erd_index_guide/api/general/gb_pin_answer.html#p_create
UPDATE: code that is erroring out:
SET SERVEROUTPUT ON
declare
l_rowid_out gb_common.internal_record_id_type;
BEGIN
gb_pin_answer.p_create(P_PIDM => 36706, P_NUM => 1, P_GOBQSTN_ID => 1, P_QSTN_DESC => '', P_ANSR_DESC => 'David', P_ANSR_SALT => 'HB123456', P_USER_ID => 'H00036657', P_DATA_ORIGIN => 'WWW_USER', P_ROWID_OUT => 1_rowid_out);
dbms_output.put_line('rowid: ' || l_rowid_out);
END;
Error msg:
Error report: ORA-06550: line 4, column 199: PLS-00363: expression '1'
cannot be used as an assignment target ORA-06550: line 4, column 3:
PL/SQL: Statement ignored
06550. 00000 - "line %s, column %s:\n%s"
*Cause: Usually a PL/SQL compilation error.
*Action:
The problem is the execute. That's actually shorthand for a short anonymous PL/SQL block, and cannot be split across lines. (Except maybe with a continuation character, but I can't remember off-hand if I've ever got that to work). Only the first line is translated, so it's effectively trying to run:
begin execute gb_pin_answer.p_create(; end;
/
... and it quite reasonably then doesn't like the command ending as p_create(;. The rest of the procedure call is then treated as 10 separate commands, which generate the other errors you get, and they are also reasonable in that context.
The solution is to either put the entire procedure call on one line, which will make it harder to read; or simply to use your own block, rather than relying on execute:
begin
gb_pin_answer.p_create(
...
);
end;
/
The last parameter isn't right though; the bit from OUT ... needs to be replaced with => some_value, like you've done with the others. But it is an out parameter, so you need something to put the value in. Without seeing what else is in the script you're running I can't tell if you've already taken care of it, but with this pattern you can probably just add a variable to the anonymous block:
set serveroutput on
declare
l_rowid_out gb_common.internal_record_id_type;
begin
gb_pin_answer.p_create(
...
p_rowid_out => l_rowid_out
);
-- optional
dbms_output.put_line('rowid: ' || l_rowid_out);
end;
/
From the last edit, I see that you misstaken 1 for l...
1_rowid_out instead of l_rowid_out.
You cannot start a variable with a number like you tried to.
We got this error when mixing Dapper and native Oracle MDA constructs. Specifically trying to use the WithConnection construct with native Oracle driver. It didn't like that and returned a very similar and nonsensical error message "ORA-06550: line 1, column 259: PLS-00103: Encountered the symbol...blah blah blah"
The code is this:
Originally:(http://www.oracle-base.com/articles/misc/FTPFromPLSQL.php)
The approach uses a combination of the UTL_TCP and UTL_FILE packages to create a simple FTP API (ftp.pks, ftp.pkb). Once the API is loaded into the appropriate schema simple FTP commands can be initiated as follows:
CREATE OR REPLACE DIRECTORY my_docs AS '/u01/app/oracle/';
SET SERVEROUTPUT ON SIZE 1000000
#c:\ftp.pks
#c:\ftp.pkb
-- Send an ASCII file to a remote FTP server.
DECLARE
l_conn UTL_TCP.connection;
BEGIN
l_conn := ftp.login('ftp.company.com', '21', 'ftpuser', 'ftppassword');
ftp.ascii(p_conn => l_conn);
ftp.put(p_conn => l_conn,
p_from_dir => 'MY_DOCS',
p_from_file => 'test_get.txt',
p_to_file => '/u01/app/oracle/test_put.txt');
ftp.logout(l_conn);
END;
/
The problem is that when I try to create the directory object I get an error saying that Create symbol wasnt expected.
where this line should be created?
Is there anything preceding the create statement line in your script? It looks like there might be something you left off the post.