Exports hangs in stored procedures
hi i am running oracle 8.1.7 on solaris 8 when i am doing the export the export goes fine but when its reaching exporting stored procedures last after the integrity constraints the export is hanging and giving error
last terminated with unsuccessfully,what may be the reason only for the stored procdures failing in export.How to fix this
wiht regards
ramys
hi there is
no errors comming from the export logs.The export hangs and for long time and i have to cancel the export session
and giving export terminated unsuccesfully,how to fix it
with regards
ramya
Similar Messages
-
Import/export only the stored procedure from DMP
Hi all,
pls tell how to import/export only the stored procedure from a DMP file.
Best Regards,
Subirpls tell how to import/export only the stored
procedure from a DMP file.If you on 10g or above use expdp / impdp for import/export only the SP.
Overview of Oracle Data Pump
- Virag Sharma
http://virag.sharma.googlepages.com
http://viragsharma.blogspot.com/ -
Export data using stored procedure to excel
How to export and save data from SQL Server to MS Excel using stored procedure.
Thanks in advance
AbhinavYou can use multiple options
1. distributed query like OPENROWSET/OPENDATASOURCE
http://www.excel-sql-server.com/excel-import-to-sql-server-using-distributed-queries.htm
2. Using linked server /OPENQUERY
http://sqlwithmanoj.com/2010/11/12/query-excel-file-source-through-linked-server/
also see
http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=49926
Please Mark This As Answer if it solved your issue
Please Mark This As Helpful if it helps to solve your issue
Visakh
My MSDN Page
My Personal Blog
My Facebook Page -
Hi all,
Is there any better way of exporting all the stored procedures from a schema other than selecting rows from USER_SOURCE!?This might help. Or might not.
set long 100000 pagesize 0 feedback off
Select
DBMS_MetaData.Get_DDL(type,name)
From
Select Distinct
type,
name
From
user_source
Where
type != 'PACKAGE BODY' and
name Not Like 'BIN$%'
/ -
Executing batch file from Java stored procedure hang
Dears,
I'm using the following code to execute batch file from Java Stored procedure, which is working fine from Java IDE JDeveloper 10.1.3.4.
public static String runFile(String drive)
String result = "";
String content = "echo off\n" + "vol " + drive + ": | find /i \"Serial Number is\"";
try {
File directory = new File(drive + ":");
File file = File.createTempFile("bb1", ".bat", directory);
file.deleteOnExit();
FileWriter fw = new java.io.FileWriter(file);
fw.write(content);
fw.close();
// The next line is the command causing the problem
Process p = Runtime.getRuntime().exec("cmd.exe /c " + file.getPath());
BufferedReader input = new BufferedReader(new InputStreamReader(p.getInputStream()));
String line;
while ((line = input.readLine()) != null)
result += line;
input.close();
file.delete();
result = result.substring( result.lastIndexOf( ' ' )).trim();
} catch (Exception e) {
e.printStackTrace();
result = e.getClass().getName() + " : " + e.getMessage();
return result;
The above code is used in getting the volume of a drive on windows, something like "80EC-C230"
I gave the SYSTEM schema the required privilege to execute the code.
EXEC DBMS_JAVA.grant_permission('SYSTEM', 'java.io.FilePermission', '<<ALL FILES>>', 'read ,write, execute, delete');
EXEC DBMS_JAVA.grant_permission('SYSTEM', 'SYS:java.lang.RuntimePermission', 'writeFileDescriptor', '');
EXEC DBMS_JAVA.grant_permission('SYSTEM', 'SYS:java.lang.RuntimePermission', 'readFileDescriptor', '');
GRANT JAVAUSERPRIV TO SYSTEM;
I have used the following to load the class in Oracle 9ir2 DB:
loadjava -u [system/******@orcl|mailto:system/******@orcl] -v -resolve C:\Server\src\net\dev\Util.java
CREATE FUNCTION A1(drive IN VARCHAR2) RETURN VARCHAR2 AS LANGUAGE JAVA NAME 'net.dev.Util.a1(java.lang.String) return java.lang.String';
variable serial1 varchar2(1000);
call A1( 'C' ) into :serial1;
The problem that it hangs when I execute the call to the function (I have indicated the line causing the problem in a comment in the code).
I have seen similar problems on other forums, but no solution posted
[http://oracle.ittoolbox.com/groups/technical-functional/oracle-jdeveloper-l/run-an-exe-file-using-oracle-database-trigger-1567662]
I have posted this in JDeveloper forum ([t-853821]) but suggested to post for forum in DB.
Can anyne help?Dear Peter,
You are totally right, I got this as mistake copy paste. I'm just having a Java utility for running external files outside Oracle DB, this is the method runFile()
I'm passing it the content of script and names of file to be created on the fly and executed then deleted, sorry for the mistake in creating caller function.
The main point, how I claim that the line in code where creating external process is the problem. I have tried the code with commenting this line and it was working ok, I made this to make sure of the permission required that I need to give to the schema passing security permission problems.
The function script is running perfect if I'm executing vbs script outside Oracle using something like "cscript //NoLogo aaa1.vbs", but when I use the command line the call just never returns to me "cmd.exe /c bb1.bat".
where content of bb1.bat as follows:
echo off
vol C: | find /i "Serial Number is"
The above batch file just get the serial number of hard drive assigned when windows formatted HD.
Same code runs outside Oracle just fine, but inside Oracle doesn't return if I exectued the following:
variable serial1 varchar2(1000);
call A1( 'C' ) into :serial1;
Never returns
Thanks for tracing teh issue to that details ;) hope you coul help. -
Calling stored procedure from DRM export
Hi All,
I am new to drm .I have a question.Is it possible to run stored procedure automatically when drm export ran.
I Have a DRM HUb where i am actually downloading all the tables.I have a requirement to run stored procedure when drm exports ran.
Is it Possible?Hi,
I have these exports from drm.Do we have batch commands in DRM
When these DRM exports ran, Is there a way that i can trigger my stored procedure -
Arrays as out param on stored procedure causes hang
Hi,
I would like to be able to use an ARRAY to pass data back from a java stored procedure. Calling the stored procedure using jdbc, the procedure hangs. If I change the out param to a VARCHAR, the procedure works fine (although, of course, the size of the data returned is limited).
I defined a varray type:
CREATE TYPE str_array AS VARRAY(100) OF VARCHAR2(255);
I defined the stored procedure:
CREATE OR REPLACE PROCEDURE ob_snapshot(symbol VARCHAR2, start_time DATE, end_time DATE, interval NUMBER, depth NUMBER, output_result IN OUT STR_ARRAY)
AS LANGUAGE JAVA
NAME 'OBSnapshot.snapshot(java.lang.String, java.sql.Timestamp, java.sql.Timestamp, int, int, oracle.sql.ARRAY[])';
The execute on the CallableStatement never finshes. Any ideas ?
Thanks for the help,
Chris Opler
nullI recommend you declare your iterator as follows :
public class yourApp {
#sql public static iterator Temp1 (...);
null -
Could I export and import my oracle database via Stored Procedure???
Hi all,
I need to export my database using stored procedure, the stored procedure will be called by java application and it works well
Now I still get the "BIG QUESTION", could I export and import database using stored procedure???
Really thanks for the response.
Regards,
KahlilHi,
I think you can use DBMS_DATAPUMP (10.1+), see [DBMS_DATAPUMP|http://download.oracle.com/docs/cd/B28359_01/appdev.111/b28419/d_datpmp.htm#i1007277], for examples see [http://www.psoug.org/reference/dbms_datapump.html]
Regards, -
Debugger gets hanged on call to stored procedure
We are using Forms 6i Patch 12.
The Forms Debugger is getting hanged whenever it encounters a line making a call to stored procedure.
In earlier versions, we debugger used to "Step Over" instead of allowing a "Step into" on such statements.
Any Solutions will be appreciated!We are working like that.
Even on new stored procedures, the debugger is getting hanged whether we do any stepping around that line or not.
There appears to be something wrong with debugger or its settings. It is ok for us if it does not allow "Step Into" in a stored procedure as we can put it as local program unit if any step into is required.
However, for already tested stored procedures, we can have a step over.
We do not want to copy all the stored procedures being used in a form as local program units just because the debugger gets hanged whenever it sees a call to stored procedure irrespective of a "Step over", "Step Into" or "Go".
The problem is how to prevent the debugger from getting hanged.
Regards,
Sanjiv -
Import/Export a schema in Stored Procedure
Can I execute an import or export a schema from within a stored procedure?
One last question.
I'm now testing doing an import and when I run my procedure I'm getting an error from within the DBMS_DATAPUMP procedure. Here it is:
Error report:
ORA-39001: invalid argument value
ORA-06512: at "SYS.DBMS_SYS_ERROR", line 79
ORA-06512: at "SYS.DBMS_DATAPUMP", line 2953
ORA-06512: at "SYS.DBMS_DATAPUMP", line 4132
ORA-06512: at line 47
39001. 00000 - "invalid argument value"
*Cause: The user specified API parameters were of the wrong type or
value range. Subsequent messages supplied by
DBMS_DATAPUMP.GET_STATUS will further describe the error.
*Action: Correct the bad argument and retry the API.
Here is the procedure I'm running:
DECLARE
v_dp_job_handle NUMBER ; -- Data Pump job handle
v_count NUMBER ; -- Loop index
v_percent_done NUMBER ; -- Percentage of job complete
v_job_state VARCHAR2(30) ; -- To keep track of job state
v_message KU$_LOGENTRY ; -- For WIP and error messages
v_job_status KU$_JOBSTATUS ; -- The job status from get_status
v_status KU$_STATUS ; -- The status object returned by get_status
v_logfile NUMBER ;
v_date VARCHAR2(13) ;
BEGIN
v_project := 'TEST' ;
v_date := '03272009_1048' ;
/* IMPORT */
/* OPEN THE DATAPUMP PROCEDURE */
v_dp_job_handle := DBMS_DATAPUMP.OPEN(
OPERATION => 'IMPORT',
JOB_MODE => 'SCHEMA',
--REMOTE_LINK => v_desitination_server_name,
JOB_NAME => v_project||'_IMP_'||v_date,
VERSION => 'LATEST') ;
/* ADD THE NAME OF THE DUMP FILE TO THE DATAPUMP PROCEDURE */
DBMS_DATAPUMP.ADD_FILE(
HANDLE => v_dp_job_handle,
FILENAME => v_project||'_EXP_'||v_date||'.DMP',
DIRECTORY => 'DATAPUMP') ;
/* ADD THE NAME OF THE IMPORT LOG FILE TO THE DATAPUMP PROCEDURE */
DBMS_DATAPUMP.ADD_FILE(
HANDLE => v_dp_job_handle,
FILENAME => v_project||'_IMP_'||v_date||'.LOG',
DIRECTORY => 'DATAPUMP',
FILETYPE => DBMS_DATAPUMP.KU$_FILE_TYPE_LOG_FILE) ;
/* ADD THE NAME OF THE SCHEMA TO IMPORT TO THE DATAPUMP PROCEDURE */
DBMS_DATAPUMP.METADATA_FILTER(
HANDLE => v_dp_job_handle,
NAME => 'SCHEMA_EXPR',
VALUE => 'TEST2' ) ;
/* START THE IMPORT */
DBMS_DATAPUMP.START_JOB(v_dp_job_handle) ;
/* END THE DATAPUMP PROCEDURE */
DBMS_DATAPUMP.DETACH(v_dp_job_handle) ;
END ;
My guess is the parameter that it doesn't like is the VALUE parameter in the METADATA_FILTER section. What I want to do is export the TEST schema and then import it back into the same database into a new TEST2 schema. How can I do that?
Thanks for your help! -
Export Java-based external stored procedure
I've got a properly deployed external Java-based stored procedure deployed properly. I can see it by querying user_objects as well as user_java_classes. Is there any way I can export it so that I can deploy it in a different database? Please note that I mean a different way than performing a complete export, I just want to selectively export this external procedure.
Thanks, TomI would think that the following would work:
expdp user/password directory=my_dir dumpfile=java.dmp include=java_source
This would export the java source for the user performing the export. If you need to export java_source for another user, you would have to add
schemas=other_schema
Adding the other schema would only work if the user running the job was privileged.
Dean -
Stored procedure to export result to excel header not displayed
Hi,
I am using below stored procedure to export data to excel with header. but it is not displaying the header . i believe this is because the max length of query can be 8000. but I have more than 250 columns so probably the length of query is breaking
the code.
can someone please help here.
Thanks in advance.
ALTER procedure [dbo].[proc_generate_excel_with_columns]
@table_name varchar(100),
@file_name varchar(100)
as
--Generate column names as a recordset
declare @columns varchar(8000), @sql varchar(8000), @data_file varchar(100)
select
@columns=coalesce(@columns+',','')+column_name+' as '+column_name
from
information_schema.columns
where
table_name=@table_name
select @columns=''''+replace(replace(@columns,' as ',''' as '),',',',''')
--Create a dummy file to have actual data
select @data_file=substring(@file_name,1,len(@file_name)-charindex('\',reverse(@file_name)))+'\data_file.csv'
--Generate column names in the passed EXCEL file
set @sql='bcp "select * from (select ' + @columns + ') as header" queryout E:\test.csv -c -t, -T -S ' + @@servername
exec master..xp_cmdshell @sql
--Generate data in the dummy file
set @sql='bcp "select * from CustomerTable where ReservationDate>''1/1/2013''" queryout E:\data_file.csv -c -t, -T -S' + @@servername
exec master..xp_cmdshell @sql
--Copy dummy file to passed EXCEL file
set @sql= 'exec master..xp_cmdshell ''type '+@data_file+' >> "'+@file_name+'"'''
exec(@sql)
----Delete dummy file
set @sql= 'exec master..xp_cmdshell ''del '+@data_file+''''
exec(@sql)
--EXEC proc_generate_excel_with_columns 'CustomerTable','E:\test.csv'Can you try to print the @columns?
In the same procedure can you change size of @columns to varchar(max) and try executing the procedure?
ALTER procedure [dbo].[proc_generate_excel_with_columns]
@table_name varchar(100),
@file_name varchar(100)
as
--Generate column names as a recordset
declare @columns varchar(max), @sql varchar(max), @data_file varchar(100)
select
@columns=coalesce(@columns+',','')+column_name+' as '+column_name
from
information_schema.columns
where
table_name=@table_name
select @columns=''''+replace(replace(@columns,' as ',''' as '),',',',''')
print @Columns
--Create a dummy file to have actual data
select @data_file=substring(@file_name,1,len(@file_name)-charindex('\',reverse(@file_name)))+'\data_file.csv'
--Generate column names in the passed EXCEL file
set @sql='bcp "select * from (select ' + @columns + ') as header" queryout E:\test.csv -c -t, -T -S ' + @@servername
exec master..xp_cmdshell @sql
--Generate data in the dummy file
set @sql='bcp "select * from CustomerTable where ReservationDate>''1/1/2013''" queryout E:\data_file.csv -c -t, -T -S' + @@servername
exec master..xp_cmdshell @sql
--Copy dummy file to passed EXCEL file
set @sql= 'exec master..xp_cmdshell ''type '+@data_file+' >> "'+@file_name+'"'''
exec(@sql)
----Delete dummy file
set @sql= 'exec master..xp_cmdshell ''del '+@data_file+''''
exec(@sql)
--EXEC proc_generate_excel_with_columns 'CustomerTable','E:\test.csv'
--Prashanth -
Export stored procedure using sql dev
Hi,
I would like to export stored procedure.
I notice there is a menu in sql dev ('Database Export').
It will saves the export in .sql file.
What is this .sql file will contain?
What is the difference between this .sql file and .dmp file in expdp?
What are the advantages and disadvantages in using these methods?
Thanks.
Edited by: 859102 on Jul 26, 2011 1:34 AM
Edited by: 859102 on Jul 26, 2011 1:35 AMAny sqldev export is in normal readable format, with CREATEs, INSERTs and such.
EXP/EXPDP in contrast stores binary data only readable with IMP/IMPDP.
IMO, the sqldev method is better for small exports (of few objects and/or data), and EXPDP is better for full schema or DB exports as it's a lot faster.
Have fun,
K. -
Okay, I've got all the code for the stored procedure working. The procedure looks like this
PROCEDURE scp_wide_aftmkt_limit_sum
(p_temp_date IN date,
p_merchant_id IN number,
p_exch_contract_pub_ids IN
exch_contract_pub_id_array,
p_merchant_exchanges IN OUT
limit_count_status_array)
The two arrays look like this -
exch_contract_pub_id_array VARRAY(20) OF NUMBER(10)
limit_count_status_array VARRAY(20) OF limit_count_status_rec
The struct above looks like this -
limit_count_status_rec contains
summed_amt IS NUMBER(38)
trading_limit IS NUMBER(38)
status_text IS VARCHAR2(100)
The code I'm using to setup the procedure call (the jdbcConnection was already setup) -
// Create the array descriptor
ArrayDescriptor ad =
ArrayDescriptor.createDescriptor("EXCH_CONTRACT_PUB_ID_ARRAY", jdbcConn);
// Create an array using the ids
ARRAY array = new ARRAY(ad, jdbcConn, ids);
//put in stored procedure call here
s = jdbcConn.prepareCall("BEGIN scp_wide_aftmkt_limit_sum(?,?,?,?); END;");
s.setDate(1, new Date(System.currentTimeMillis()));
s.setDouble(2, merchantId.doubleValue());
s.setArray(3, array);
s.registerOutParameter(4, Types.ARRAY, "LIMIT_COUNT_STATUS_ARRAY");
// Call the proc
s.executeUpdate();
// Get the stuff out of the array
Array outArray = s.getArray(4);
ResultSet sumRS = outArray.getResultSet();
The code is hanging on the s.executeUpdate() line forever. I can't figure out if I'm setting up the IN/OUT parameter incorrectly, or if it has to do with the thin drivers I'm using (even though the FAQ says it should work with the thin drivers), or anything else. Any help would be great and if more info is needed, post and I'll get back ASAP. Thanks
Brian Pontarelli
Java Programmer
XOR Inc.
[email protected]
303-448-4865
nullMore specifically, use NOT EXISTS instead of NOT IN.
Craig... -
Stored Procedure Does Not Run Properly When Called From Portlet
We have a simple Java portlet that calls a PL/SQL stored procedure which we wrote. The stored procedure sends a large number of emails to users in our corporation using the "utl_smtp" package. The stored procedure returns a count of the emails back to the Java portlet when it's finished. This number is displayed in the portlet.
Our problem:
The stored procedure functions as expected when run from a PL/SQL block in SQL*Plus, and the Java portlet calls the procedure properly when sending out a smaller number of emails (Less than 200 usually). When we get into a higher number of emails the procedure hangs when called from the portlet, but it STILL functions properly from SQL*Plus. It does not return the number of emails sent
and the Java portlet is unable to return a SQLException. Also, we have noticed that emails are sent at a much slower pace from the stored procedure when it's called from the portlet.Any Ideas?
Maybe you are looking for
-
Need to create alv report to show pan card number.
Hi, I need to create alv report to show employee and vendor name , number , Pan card number .This is for hr module. could any one tell me table and fields for this and how I can relate them with foriegn and primary key. Regards, Moderator Message:
-
Hi, Can anyone tell how to refresh a JTree(javax.swing.Jtree) used for displaying file system(both local and remote). I'm getting a problem if a file/directoy is added to the file system, after my Applet is loaded. Actually, i have used DefaultTreeMo
-
Hi SAP Gurus, My client is implementing SAP SRM 7.0 (Classic Scenario) with ECC 6.0 as backend. Appreciate if I can get some help on the below requirement: 1. When invoice is entered in ECC, system will check whether the GRN has been done for this in
-
Bypass Proxy for Local Addresses
All- With the new 2.0 software, I am now able to connect my 3G iPhone to the WiFi network at work. The network uses an authenticated proxy to get external access. I can access external sites just fine now, but I can't see internal sites. The proxy se
-
Autorization object for veiwing log of process chain
Hi, I am looking out for an authorization object or role which will give only access to view the log generated on a day due to the execution of process chain. Thanks in advance. Regards, Naveen