sqlplus

How come sqlplus not connecting?

£可爱£侵袭症+ 提交于 2019-11-28 08:45:11
My goal is to connect to an Oracle 9i instance from my OS X machine. I've followed the setup instructions here and got through them with no errors (eventually). However, I'm finding that sqlplus is unable to connect: [ ethan@gir ~ ]$ sqlplus xxx/yyy@zzz SQL*Plus: Release 10.2.0.4.0 - Production on Fri Apr 17 10:13:08 2009 Copyright (c) 1982, 2007, Oracle. All Rights Reserved. Looooong wait... ERROR: ORA-12170: TNS:Connect timeout occurred Enter user-name: xxx Enter password: ERROR: ORA-12162: TNS:net service name is incorrectly specified Enter user-name: My tnsnames.ora file... zzz =

Remove Column Header into the Output Text file

妖精的绣舞 提交于 2019-11-28 06:56:41
问题 I want to create a flat file (text file) of my query from Oracle SQL Developer. I have successfully created the text file using SPOOL, thru a script text file, but i want to remove the header of each column into my output. I am getting this output: Header000001 Header000002 ------------ ------------ Adetail1 Bdetail1 Adetail2 Bdetail2 Adetail3 Bdetail3 But, I want to get this output: Adetail1Bdetail1 Adetail2Bdetail2 Adetail3Bdetail3 I already tried the command "set heading off", but a

Formatting output of queries in SQLPlus

寵の児 提交于 2019-11-28 04:07:11
问题 I'm working with SQLPlus at the moment and whenever I query the Database, the result is in a complete mess. In other words, it is hard to read. I wonder if anyone knows how to format the output of queries ( columns, tables.. etc) in SQLPlus that is running on Unix server. But, I am accessing the server from my windows. And, Could anyone tell me where I can get SQLPlus for Ubuntu from? Cheers, 回答1: Okay, start with this in SQL Plus: SET LINESIZE 20000 TRIM ON TRIMSPOOL ON SPOOL output.txt --

SQLPLUS command line with Windows batch file

别等时光非礼了梦想. 提交于 2019-11-28 03:43:10
问题 I want to create a batch file which will open the SQLPLUS [CLI] and will execute some stored sql file and will also store the output to text file. So I've created this batch file [which does not work]. These SQL file contains SQL which returns the max number from a table. sqlplus scott/tiger@DB @sql1.sql>data1.txt @sql2.sql>data2.txt The problem is it does not executes the SQL files after opening the SQLPLUS Windows XP Oracle 9i 回答1: What about native Sql*plus spooling? run.bat: sqlplus hr/hr

Oracle Create Table if it does not exist

落爺英雄遲暮 提交于 2019-11-28 03:17:22
问题 Can anyone point me to the right syntax to use in order to create a table only if it does not currently exist in the database? I'm currently programming a Java GUI in order to connect to Oracle and execute statements on my database and I'm wondering if I would implement this as a Java constraint or a SQLPlus constraint. 回答1: Normally, it doesn't make a lot of sense to check whether a table exists or not because objects shouldn't be created at runtime and the application should know what

Why does SQL*Plus commit on exit?

落爺英雄遲暮 提交于 2019-11-28 00:47:50
Surely this should be the same as a termination of a session and cause a rollback? It seems to me to be the most un-Oracle thing possible. I was actually shocked when I found out that it did this More importantly - would anyone object if Oracle changed it to rollback on exit? Funnily enough, with the 11gR2 release this week (2009-09-03), SQL*Plus now has an option to COMMIT or ROLLBACK on EXIT. Doc here I'd guess in the next few weeks/months, there'll be an 11gR2 Instant Client which you can use against your current database and get your desired behaviour A caution to be aware of. If you

oracle ORA-39700: database must be opened with UPGRADE option

空扰寡人 提交于 2019-11-27 23:24:19
ORA-01092: ORACLE instance terminated. Disconnection forced ORA-00704: bootstrap process failure ORA-39700: database must be opened with UPGRADE option 进程 ID: 3650 会话 ID: 292 序列号: 5 问题原因:进行数据库报错的时候才突然想起犯了一个错误原数据库的版本是11.2.0.1,但是目标数据库的版本是11.2.0.3,所以在打开的时候就提示了0RA-39700。 解决方法:通过upgrade的方式打开数据库,如下 [oracle@ekptest001 ~]$ sqlplus / as sysdba SQL*Plus: Release 11.2.0.3.0 Production on 星期三 12月 24 15:31:16 2014 Copyright (c) 1982, 2011, Oracle. All rights reserved. 已连接到空闲例程。 SQL> startup mount; ORACLE 例程已经启动。 Total System Global Area 6797832192 bytes Fixed Size 2241264 bytes Variable Size 3523218704

Return value from sql script to shell script

走远了吗. 提交于 2019-11-27 23:13:34
I have shell script that calls the following sql script: INSERT INTO SEMANTIC.COUNT_STATISTICS (...); UPDATE SEMANTIC.COUNT_STATISTICS SET PRNCT_CHANGE = 1.1; --want to store result of this bellow select statement in model_count variable select PRNCT_CHANGE FROM SEMANTIC.COUNT_STATISTICS WHERE model = '&MY_MODEL' AND NEW_DATE = ( select max(NEW_DATE) from SEMANTIC.COUNT_STATISTICS where MODEL = '&MY_MODEL' ); Now, how do I return this PERCENTAGE_NUMBER variable back to my shell script? My shell script is as follows: #!/bin/bash # # setup oracle, java, and d2rq environment . /etc/profile.d

TNSPING OK but sqlplus gives ORA-12154?

假如想象 提交于 2019-11-27 22:11:48
问题 I have Oracle 11 running on a Windows server and I'm logged onto the same server trying to use SQL Plus. When I try to connect I get a ORA-12154 even though TNSPING and various other diagnostics look OK. Can anyone suggest why ? Loads of detail below. I can use sqlplus if I use EZCONNECT like this .. sqlplus EST/EST@192.168.10.15/ORCL ... but if I try to connect using TNSNAMES like this ... sqlplus EST/EST@ORCL ... I get ... ORA-12154: TNS:could not resolve the connect identifier specified

How to View Oracle Stored Procedure using SQLPlus?

我们两清 提交于 2019-11-27 21:14:57
How can I view the code of a stored procedure using sqlplus for Oracle 10g? When I type in: desc daily_update; it shows me the parameter, but when I try to do the following: select * from all_source where name = 'daily_update'; I get no rows selected What am I doing wrong? check your casing, the name is typically stored in upper case SELECT * FROM all_source WHERE name = 'DAILY_UPDATE' ORDER BY TYPE, LINE; 来源: https://stackoverflow.com/questions/7000224/how-to-view-oracle-stored-procedure-using-sqlplus