.txt in sqlplus
Good evening everyone,
This might be the wrong place to post this but I am a greenhorn, any help would be greatly appreciated.
My issue:
I am having trouble finding my .txt file that has already been run in sqlplus.
Can someone point me in the right direction?
Thank you very much in advance!
Dave
ok you go to at C:\ device at then you find the file oracle into then you the version until a see the sql file either then you go to path of OS enviroment vari and copy the direction and paste in your explorer.
Similar Messages
-
Command Line sqlplus without using @filename
How can I pass sql statement directly to sqlplus on command line without using an external file ?
If the insert happens infrequently, then the cost of writing
to a temporary file may not matter overall. And if the
insert happens frequently, the cost of invoking SQL*Plus and
connecting to the DB could outweigh the time for writing to
a file.
Do you have any problem doing something like:
tail -f mylog.txt | myawkprog | sqlplus -s scott/tiger
Here I'm thinking that 'myawkprog' prints appropriate INSERT
and COMMIT statements.
For what it is worth, I have an old, old Perl 4 script for a
similar log parsing task. It keeps the SQL*Plus connection
alive forever and makes sure there is no I/O buffering. The
outline of it is below. Use at own risk.
-- CJ
#! /usr/local/bin/perl -w
# Open I/O pipes
open(LG, "tail -f /tmp/mylog.txt|") || die "Can't open input";
open(SP, "| sqlplus -s scott/tiger") || die "Can't open sqlplus";
# unbuffered I/O
select(LG); $| = 1;
select(SP); $| = 1;
while(<LG>)
chop;
print SP "insert into mytab values ('$_');\n";
print SP "commit;\n";
# Never actually get here
close(LG);
close(SP); -
When attempting to install evaluation copy of the BPA suite I get error:
Connection to Oracle Database Server FAILED
Log In to Oracle Database Server FAILED
Privileges for the Current Oracle Database Server Account FAILED
Oracle Database Server Version FAILED
Oracle Database Server Charset (AL32UTF8) FAILED
'job_queue_processes' Oracle Database Server FAILED
Provided connect string had been verified on the same computer.
It seems that installation shield dinamically creates a file testsql.txt .This script does not create any output. (The file out.txt is empty)
The content of the testsql.txt is:
"bin\tnsping" (ADDRESS=(PROTOCOL=TCP)(HOST=LOCALHOST)(PORT=1521)) >>"C:\Program Files\Oracle BPA Suite11g\out.txt"
"bin\sqlplus" -L -S SYSTEM/manager@(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=LOCALHOST)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=orcl))) @"C:\DOCUME~1\bp\LOCALS~1\Temp\1\{E3529E53-DAF8-452E-85E8-7A451B0683FD}\{511E488B-34DD-42EB-8C31-D3C8F21EEFC1}\check_login.sql" >> "C:\Program Files\Oracle BPA Suite11g\out.txt"
"bin\sqlplus" -L -S SYSTEM/manager@(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=LOCALHOST)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=orcl))) @"C:\DOCUME~1\bp\LOCALS~1\Temp\1\{E3529E53-DAF8-452E-85E8-7A451B0683FD}\{511E488B-34DD-42EB-8C31-D3C8F21EEFC1}\check_privs.sql" SYSTEM >> "C:\Program Files\Oracle BPA Suite11g\out.txt"
"bin\sqlplus" -L -S SYSTEM/manager@(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=LOCALHOST)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=orcl))) @"C:\DOCUME~1\bp\LOCALS~1\Temp\1\{E3529E53-DAF8-452E-85E8-7A451B0683FD}\{511E488B-34DD-42EB-8C31-D3C8F21EEFC1}\check_version.sql" >> "C:\Program Files\Oracle BPA Suite11g\out.txt"
"bin\sqlplus" -L -S SYSTEM/manager@(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=LOCALHOST)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=orcl))) @"C:\DOCUME~1\bp\LOCALS~1\Temp\1\{E3529E53-DAF8-452E-85E8-7A451B0683FD}\{511E488B-34DD-42EB-8C31-D3C8F21EEFC1}\check_charset.sql" >> "C:\Program Files\Oracle BPA Suite11g\out.txt"
"bin\sqlplus" -L -S SYSTEM/manager@(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=LOCALHOST)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=orcl))) @"C:\DOCUME~1\bp\LOCALS~1\Temp\1\{E3529E53-DAF8-452E-85E8-7A451B0683FD}\{511E488B-34DD-42EB-8C31-D3C8F21EEFC1}\check_jobqueueprocesses.sql" >> "C:\Program Files\Oracle BPA Suite11g\out.txt"Any solution?
-
Help with logic in shell script
I am on solaris and i have this piece of code.Im using Oracle 10gr2
Code:
echo "SQLPLUS CONNECTION"
sqlplus -s $ARBOR_USR/$ARBOR_DB_PASSWD@$ORACLE_SID<<EOF>$CUR_DIR/sql_output.txt
set feedback off
set heading off
select distinct account_no from adj WHERE ADJ_TRANS_CODE=-2401 and request_status=1 and bill_ref_no=0
order by account_no;
EOF
if [ $? -eq 0 ]
then
echo " SQLPLUS Connection Successful "
else
echo " SQLPLUS Connection Failed "
fi
##echo " The account numbers passed to BIP are "
if [ ! -s "$CUR_DIR/sql_output.txt" ]
then
echo "No account number for bad debt"
else
for i in `cat $CUR_DIR/sql_output.txt`
do
sqlplus -s $ARBOR_USR/$ARBOR_DB_PASSWD@$ORACLE_SID<<EOF1>$CUR_DIR/sql_interim.txt
insert INTO t_bill(ACCOUNT_NO,INTERIM_BILL_DATE,INCLUDE_ADJ,PAYMENT_DUE_DATE,TRACKING_ID,TRACKING_ID_SERV )
select $i,trunc(sysdate),1,trunc(sysdate),0,0 from dual;
EOF1
echo "bip $i is running"
sh $SCRIPT_DIR/bip.sh 01 0 $i > $CUR_DIR/bip_log_1.txt
sleep 200
done
fi
I want to insert the account number into t_bill.TRACKING_ID,TRACKING_ID_SERV columns are composite primary key in the table t_bill.
The logic behind this is that
Only 1 row is to be inserted into t_bill table then the bip.sh script runs for a particular account number .When the bip.sh runs the entry for that particular account number
is deleted from t_bill automatically.
How to implement this logic? Please correct my above code.Through this sql statement i will get few account numbers daily
select distinct account_no from adj WHERE ADJ_TRANS_CODE=-2401 and request_status=1 and bill_ref_no=0
order by account_no;
For eg : i get 3 account numbers(i.e) .
My main motive :-NowI need to insert 1 account number in t_bill .
TRACKING_ID,TRACKING_ID_SERV columns are composite primary key in the table t_bill.I have hard coded it 0,0
bip.sh is parametrized script taking one account as parameter.
When i execute the bip.sh the entry of that account num from t_bill is deleted automatically
Steps i need to implemet
1.get the account numbers
2.insert 1 account into t_bill
3.run the bip.sh for that account number
i need to do the same process for all account numbers -
How get os physical block size ?
man dd, it advice bs parameter be a multiple of the physical block size .
How can I get physical block size ? such as aix, hpux ,suselinux.
bs=BlockSize
Specifies both the input and output block size, superseding the ibs and obs flags. The block size values
specified with the bs flag must always be a multiple of the physical block size for the media being used.Learning new things today, thanks guys!
$ printf "a" >1bytefile.txt && echo $(( 512 * $(du 1bytefile.txt | cut -f1) )) && rm 1bytefile.txt
1024
$ sqlplus / as sysdba
SQL*Plus: Release 10.2.0.4.0 - Production on Tue Jul 24 16:15:04 2012
Copyright (c) 1982, 2007, Oracle. All Rights Reserved.
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SYS@TTST> select
2 max(l.lebsz) log_block_size
3 from
4 sys.x$kccle l
5 where
6 l.inst_id = userenv('Instance');
LOG_BLOCK_SIZE
1024
SYS@TTST> exit
Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
$ /usr/sbin/fstyp -v /dev/vg01/lvol04
/dev/vg01/lvol04: Permission denied
$ su
Password:
# /usr/sbin/fstyp -v /dev/vg01/lvol04
vxfs
version: 5
f_bsize: 8192
f_frsize: 1024
f_blocks: 786432000
f_bfree: 87190098
f_bavail: 81740717
f_files: 22035604
f_ffree: 21797524
f_favail: 21797524
f_fsid: 1073807364
f_basetype: vxfs
f_namemax: 254
f_magic: a501fcf5
f_featurebits: 0
f_flag: 16
f_fsindex: 10
f_size: 786432000
# uname -r
B.11.23
# uname
HP-UXMore info over in the hp communities. -
How to pass Unix environment variable to a SQL procedure or SQL * Plus
Can any body suggest me how to ,
How to pass Unix environment variable to a SQL procedure or SQL * Plus file..
I am trying to invoke a SQL Procedure from Unix
by passing the value of a Unix environment variable.
Is it possible..?
Thanks in advance.
Regards,
Srinivas JaltaruWithin your shell script you can use what is known as a "here document" which is basically a way of wrapping a call to Oracle. The following call to Oracle loops and writes rows to files with numerically increasing file names. Two unix shell variables are used, one in a select statement and one in a spool command :
<pre>
#!/bin/bash
export ORACLE_SID=DEV05
FILENO=1007351
while [ ${FILENO} -le 1008400 ]
do
FILENAME=farm_${FILENO}.txt
DUMMY=`sqlplus -s user20/user20 <<SQLSTOP
set lines 73
set pages 0
set head off
set termout off
set echo off
set feedback off
select rpad(searchx, 8)
from blastx@PRODUCTION
where searchx = ${FILENO} ### here's a shell variable
spool /export/home/user20/sql/psiblast/BACKUP2_D/${FILENAME} ### here's a shell variable
spool off
SQLSTOP`
FILENO=`expr ${FILENO} + 1`
done
exit 0
</pre> -
How could I export a sqlplus query to a .txt file?
Hi,
I have an Oracle 10g database running on a linux e3 server.
I have generated a SQL query using sqlplus on the server site, so the result is under the SQL>
How could I export it to a .txt?
Thanks a lot!
Any advice is highly appreciated!
QianHi, Qian,
In SQL*Plus, say "SPOOL filename", and all the output that appears on your screen will also be written to filename, until you say "SPOOL OFF".
Look up SPOOL in the SQL*Plus manual for more details. -
i'm trying to execute the file sqlplus /nolog @statistics.txt <sapuser> as per the sap note 0001020260 ihow can i find the sapuser
KANNAN VENKATACHALAM wrote:
brconnect -u / -c -f stats -t all -- what it will do exactly ?
Would you mind to read the BR*Tools documentation?
it is located on the oracle community (same place as this forum) it is quite a big document.
AFTER you have read it, if you have any problem understanding what that command does exactly you are welcome to ask again -
Passing a FILENAME from a LINUX SHELL Script to an SQLPLUS Script
I written a LINUX Shell Script to receive a FILENAME. This FILENAME is the name of the file that I want to SPOOL into.
So, below are two items.
The first item is the LINUX Shell Script that has the FILENAME
The last item is the SQLPLUS Script that is suppose to receive the name
The LINUX Shell Script:
#! /bin/sh
LOGFILE="$(date +"%Y-%m-%d %H:%M") Oracle REPORT LOG.TXT"
FILENAME="$(date +"%Y-%m-%d") PROD Unfinished Spot Bids.CSV"
echo "File Name for the spool is:" "$FILENAME"
#spool "$FILENAME"
#sqlplus /nolog @run_test_query.sql
#sqlplus -S @Unfinished_Spot_Bids_Run_V1.sql >$LOGFILE
sqlplus -S /nolog <<EOF >$LOGFILE
/* I want to pass to the SQL file below */
/* The value that is contained in the the variable $FILENAME */
/* How do you do that? */
@@Unfinished_Spot_Bids_V1.sql
spool
set echo on
EOF
RV=$?
#if {$RV -ne 0}
#exit $RV
#else
echo "The return code fronm the sqlplus was:" "$RV"
#fi
Here is the SQLPLUS Script
CONNECT glog_read/parker@OTMPROD
set linesize 32000 trimspool on pagesize 3000
set echo off
SET TERMOUT OFF
set heading off
/* I want to parameterize the name of the file below */
/* This file is executed from inside a LINUX Shell Script */
/* That LINUX SHELL script is passed a file name */
/* I want that filename used in the "SPOOL" statement below */
/* So, how do I do that? */
spool PROD_Unfinished.CSV
prompt Shipment Update Date|Shipment Number|No of Shipments|Auctions per Shipment|No. of Carriers Notified|No of Bidders|Duration of Auction|Elapse time for first bid|Elapse time for last bid|Elapse time of bidding|Lead Time of Auction to P/U|High Bid- Low Bid Diff|
set feedback off
SELECT
to_char(c.update_date, 'FMMonth, YYYY')||'|'|| b.SHIPMENT_GID
||'|'|| count (distinct (b.SHIPMENT_GID))
||'|'|| count(distinct(a.i_transaction_no))
||'|'|| count(*)
||'|'|| sum (case when a.responding_gl_user_gid is null then 0 else 1 end)
||'|'|| min (numtodsinterval((b.expected_response - b.insert_date),'day'))
||'|'|| min (numtodsinterval((a.update_date - a.transaction_time),'day'))
||'|'|| max (numtodsinterval((a.update_date - a.transaction_time),'day'))
||'|'|| numtodsinterval((max(a.update_date) - min(a.update_date)),'day')
||'|'|| numtodsinterval((max(b.shipment_time) - max(c.insert_date)),'day')
||'|'|| (max(a.bid_amount) - min(a.bid_amount))
from tender_collab_servprov a, tender_collaboration b, shipment c
where a.i_transaction_no = b.i_transaction_no
and b.shipment_gid not in (select sqa.shipment_gid from tender_collaboration sqa, tender_collab_servprov sqb where sqa.i_transaction_no = sqb.i_transaction_no and sqb.acceptance_code = 'A')
and a.i_transaction_no in (select i_transaction_no from tender_collaboration where tender_type = 'Spot Bid')
and b.shipment_gid = c.shipment_gid
AND c.update_date >= trunc(last_day(to_date((to_char(add_months(SYSDATE,-2), 'MM-DD-YYYY')),'MM-DD-YYYY')) + 1)
group by c.update_date, b.SHIPMENT_GID
order by c.update_date, b.shipment_GID;
spool offParadicePGMR wrote:
First, I was getting an error on the SPOOL ${FILENAME}. Also, my file did have spaces and I did replace it with "_". It still did not work on the SPOOL Command. So, with or without the _, I never got the SPOOL command to work!
It seems that the FILENAME value from the LINUX script was not being passed into the SQLPLUS procedure.
How do you pass LINUX variables into the SQLPLUS procedure>
Not sure if I had the right usage => ${FILENAME}above is correct syntax -
Hi all, i am trying to load a file called text1.txt using sql loader. I am using sqlplus but i dont know how to call sql loader in sql plus.
can someone provide syntax assumming data file is text1.txt and control file is txt.clt
thanksWhy on earth? Though you forgot to include version info, assuming you are not using 9i or older, you can and should use the external table facility and you don't need this unstable and resource consuming procedure.
If you would have thought even one second about solving your own problem, you would have realized sqlloader is a separate O/S utility, which requires the host command, and username/password on the commandline.
That alone is a reason not to do it.
Sybrand Bakker
Senior Oracle DBA -
How to pass a variable into sqlplus script from file
here is my problem :
I have plenty of sql scripts to run. So every time I need to run sqlplus /nolog @scriptxx.name<enter> and then type login<enter>, password<enter>, second login<enter> , second password<enter> - and when it finishes again from the beggining with next one...
I am fed up with passing these parameters every time. I would like to create a file (files?) with these logins and passwords (located f.ex. in directory where I run the script) then tells, in some way, to my scripts that answers for their questions is inside this file(s).
Is there any way to do it in such a way ?
something like: accept DataUser char %read from file user1.txt without my inerteraction%
ps.
I cannot add directly these parameters to script because I need to run them on different servers (DEVs and PRODs) and every server has different users and passwords
KP>Actually the START command would resolve the issue, in conjunction with passing parameters and DEFINEs in a sensible manner.
DEFINE dathasb = '&1'
ACCEPT dathasb char prompt 'etc...'
When dathasb already has a value, ACCEPT won't prompt.
Too many people start hacking and don't use the power of Oracle because they don't the needful : Reading the documentation.
Other than that obviously the series of scripts needs of course to be re-engineered.
Asking interactively for a password .... even 20 years back we already didn't do this anymore.
Of course that was the time when exporting anything beyond the VAX 11/750 to Eastern Europe was prohibited because of US export regulations ;)
You could store the passwords in Oracle Wallet and be done with it.
You could use OS authenticated accounts and be done with it.
But then you still didn't post a version, even not when requested.
Sybrand Bakker
Senior Oracle DBA -
Load data from File on Client side (via Sqlplus)
Server OS: RedHat, Oracle 10g rel 2.
I am trying to load data from OS .txt files to clob field.
I am able to do this successfully using:
Oracle DIRECTORY
BFILE
DBMS_LOB.loadclobfromfile packageIssue is: this only works if my files and DIR are on database server.
Is it not possible "load clob from file" from client side, files being on client and exec command via SQLPlus. Is there any other option to load data from client side.
Thanks for any help.Options:
1) Search for OraDAV
2) Learn about Application Express. -
How to use bash within sqlplus?
How to use bash within sqlplus?
meaning I am doing something like this to look for files within a particular directory with some condition.
N=0
for i in $(find . -path \*/waiting/* -type f -not -name "SS*" -mmin +120 -print) ; do
testarray[$N]="$i"
echo "$i"
let "N= $N + 1"
done
Output from above script is as follows:
/d1/d2/d3/d4/waiting/abcd.txt
/d1/d2/d31/d42/waiting/pqrs.txt
/d1/d2/d32/d43/waiting/xyz.txt
And now I want to input this data into database with help of insert.
and here is the little pl/sql block to insert the data with looping thing.
sqlplus $CONNECT <<-EOF
DECLARE
Counter integer :=1;
BEGIN
WHILE Counter <= ${no_of_files} LOOP
INSERT INTO stuck_files(COL_DATE,SER_NAME,TYPE_FILE,FILENAME,FILE_STATUS) VALUES (sysdate,'pqrs','pqrs','pqrs','pqrs');
Counter := Counter + 1;
END LOOP;
END;
commit;
exit;
EOF
Mapping is as follows:
COL_DATE,SER_NAME,TYPE_FILE,FILEFILENAME,FILE_STATUS
sysdate,d3,d4,abcd.txt,waiting
sysdate,d31,d42,pqrs.txt,waiting
sysdate,d32,d3,xyz.txt,waiting
any idea how to do that?
Edited by: user9274197 on Apr 28, 2013 5:09 PMuser9274197 wrote:
How to use bash within sqlplus?
meaning I am doing something like this to look for files within a particular directory with some condition.
N=0
for i in $(find . -path \*/waiting/* -type f -not -name "SS*" -mmin +120 -print) ; do
testarray[$N]="$i"
echo "$i"
let "N= $N + 1"
done
Output from above script is as follows:
/d1/d2/d3/d4/waiting/abcd.txt
/d1/d2/d31/d42/waiting/pqrs.txt
/d1/d2/d32/d43/waiting/xyz.txt
And now I want to input this data into database with help of insert.
and here is the little pl/sql block to insert the data with looping thing.
sqlplus $CONNECT <<-EOF
DECLARE
Counter integer :=1;
BEGIN
WHILE Counter <= ${no_of_files} LOOP
INSERT INTO stuck_files(COL_DATE,SER_NAME,TYPE_FILE,FILENAME,FILE_STATUS) VALUES (sysdate,'pqrs','pqrs','pqrs','pqrs');
Counter := Counter + 1;
END LOOP;
END;
commit;
exit;
EOF
Mapping is as follows:
COL_DATE,SER_NAME,TYPE_FILE,FILEFILENAME,FILE_STATUS
sysdate,d3,d4,abcd.txt,waiting
sysdate,d31,d42,pqrs.txt,waiting
sysdate,d32,d3,xyz.txt,waiting
any idea how to do that?
Edited by: user9274197 on Apr 28, 2013 5:09 PMhttp://asktom.oracle.com/pls/asktom/f?p=100:11:::::P11_QUESTION_ID:439619916584
Cheers, -
Hi Experts,
Do we have any way to schedule bat file to run asqlplus SQL statement?
I know we can use pl/sql procedure by dbms_schdule.
I create a bat file as
set ORACLE_SID=ORCA
set CONNECT_USER='del/del@test'
set exp_dir=spool c:exprd_
set SQLState =select *from errdbg order by seq desc
set today=%date:~-4%%date:~4,2%%date:~7,2%
set exp_end =spool off
Set PATH=%ORACLE_HOME%\bin;
%ORACLE_HOME%CONNECT_USER%exp_dir %today%.txt
SQLState
exp_end
but it can not open sqlplus
Thanks
JImYou should create sql file and call it from bat file by writing:
@sqlplus usr/pass@db @c:\your_sql_file.sql -
A question about the SPOOL command in sqlplus
Dear all,
I have a question about the SPOOL Command and I would appreciate if you could kindly give me a hand. Consider the following sql script.
SPOOL result.txt
SELECT * FROM mytable;
SPOOL OFF;This works pretty well, and the whole content of the table "mytable" is exported to the text file "result.txt". However, sqlplus prints also the number of lines
printed after each query. As a result, after running this script, at the end of the file, I have always a line like
"20541 lines returned"How can I avoid this line (the number of returned lines) in my result file?
Thanks in advance,
DariyooshPeter Gjelstrup wrote:
Hi Dariyoosh,
As you are about to find out, SQL*Plus is a really powerful tool once the wonders of it are discovered.
You really should study the reference
http://download.oracle.com/docs/cd/E11882_01/server.112/e10823/toc.htm
In your current case especially the SET command
http://download.oracle.com/docs/cd/E11882_01/server.112/e10823/ch_twelve040.htm#BACGAJIC
Regards
PeterHello there,
Thank you very much for your attention to my problem and in particular the interesting links.
Kind Regards,
Dariyoosh
Maybe you are looking for
-
How do I change my settings for Device viewing?
I am a first time user very new to everything related... How do i change the settings for what devices a published book (digital only) to be viewable on all devices?? right now it is only viewable on the iPad... please help
-
I cannot change the star rating of photos.When I try, I get "error changing rating". The rating came from my organizer that was previously in Elements 9, but is now in Elements 12. Thank you.
-
Error executing RDS Command Status Code 504
Hi, I'm new to the flex world & was trying out the testdrive application at http://www.adobe.com/devnet/flex/testdrive/articles/1_build_a_flex_app2.html I've installed Flex Flash builder 4 on top of my eclipse installation and I'm using Tomcat as the
-
Hi all, I am getting few migrated contracted into ECC. These are initially the User status is in 'LOCK' at header and item level. For this contract a WBS element is linked. The initial WBS status is "CRTD". I have created a report program to change t
-
Hi: I have CS5 and use ACR to process my RAW files. However, I rented a Nikon D750 and since camera support updates are not available, how can I process my RAW files? Thanks, Steph