sqlplus

sqlplus remote connection giving ORA-21561

只谈情不闲聊 提交于 2019-11-27 20:53:47
问题 I have installed sqlplus based on instruction given here sqlplus 'username/password@(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.0.100)(PORT=1521))(CONNECT_DATA=(SID=ORCL)))' This is giving me error SQL*Plus: Release 11.2.0.4.0 Production on Fri Jul 10 16:10:38 2015 Copyright (c) 1982, 2013, Oracle. All rights reserved. ERROR: ORA-21561: OID generation failed Enter user-name: What is the solution for this problem? PS: I have already added hostname and hosts have already have value. 回答1:

How do I pass arguments to a PL/SQL script on command line with SQLPLUS?

筅森魡賤 提交于 2019-11-27 20:29:19
问题 How do I pass arguments to a PL/SQL script on command line with SQLPLUS? I can call my PL/SQL script like so, but the script requires arguments in order for it to succeed. How can I run sqlplus.exe so that I can pass arguments to the script? @ECHO off // where HOST030 is a tnsnames alias to a machine, port, and instance sqlplus.exe MYUSER/mypassword@HOST030 < refreshDataOnOracle.sql pause I tried to search for the answer but couldn't find an "argument example" anywhere for SQLPLUS. I suspect

When or Why to use a “SET DEFINE OFF” in Oracle Database

*爱你&永不变心* 提交于 2019-11-27 20:21:24
I'm watching a Script in Oracle and I see something I don't recognize REM INSERTING into database1."Users" SET DEFINE OFF; Insert into database1."Users" ("id","right") values ('1','R'); I'm looking for documentation about "set define off" and it's literally writing "disable the parsing of commands to replace substitution variable with their values" I don't really understand what they want to say. Can anyone help me? By default, SQL Plus treats '&' as a special character that begins a substitution string. This can cause problems when running scripts that happen to include '&' for other reasons:

How to insert a string which contains an “&”

谁说我不能喝 提交于 2019-11-27 18:30:19
How can I write an insert statement which includes the & character? For example, if I wanted to insert "J&J Construction" into a column in the database. I'm not sure if it makes a difference, but I'm using Oracle 9i. I keep on forgetting this and coming back to it again! I think the best answer is a combination of the responses provided so far. Firstly, & is the variable prefix in sqlplus/sqldeveloper, hence the problem - when it appears, it is expected to be part of a variable name. SET DEFINE OFF will stop sqlplus interpreting & this way. But what if you need to use sqlplus variables and

sqlplus statement from command line

…衆ロ難τιáo~ 提交于 2019-11-27 17:30:30
Is it possible to do something like this? $ sqlplus -s user/pass "select 1 from dual" or $ echo "select 1 from dual" | sqlplus -s user/pass I know I can put select 1 from dual in a file and do this: $ sqlplus -s user/pass @myFile.sql but I'm wondering if it's actually necessary to create a file just to satisfy sqlplus Just be aware that on Unix/Linux your username/password can be seen by anyone that can run "ps -ef" command if you place it directly on the command line . Could be a big security issue (or turn into a big security issue). I usually recommend creating a file or using here document

How to run a SQL Plus script in PowerShell

淺唱寂寞╮ 提交于 2019-11-27 14:06:23
问题 I am trying to log in to the the Oracle DB using PowerShell and run a script called "C:\Users\Administrator\Desktop\oracle\OracleCleanTest.sql", When I execute the PS nothing happens. Here is what I have. $adminLogon = "sys as sysdba/manager@ORCL" $logon = "sqlplus\sql/manager@ORCL" $mydata = Invoke-SqlPlus -inputfile "@C:\Users\Administrator\Desktop\oracle\OracleCleanTest.sql" $logon I've also tried this. $database = "ORCL"; $user = "sys as sysdba"; $pw = "manager"; sqlplus.exe -d $database

How can I see the SQL execution plan in Oracle?

一世执手 提交于 2019-11-27 13:10:14
问题 I'm learning about database indexes right now, and I'm trying to understand the efficiency of using them. I'd like to see whether a specific query uses an index. I want to actually see the difference between executing the query using an index and without using the index (so I want to see the execution plan for my query). I am using sql+ . How do I see the execution plan and where can I found in it the information telling me whether my index was used or not? 回答1: Try using this code to first

CLEAR SCREEN - Oracle SQL Developer shortcut?

坚强是说给别人听的谎言 提交于 2019-11-27 13:04:41
问题 With the aim of reducing mouse activity I was wondering if there was such a command shortcut (eg cls or Ctrl + L ) to provide the SQL * Plus (?) "CLEAR SCREEN" command functionality found by clicking the rubber-on-end- of-pencil icon in Oracle SQL Developer to clear the lower " Results " sub-tab ( ... incorrect terminology I'm sure ). 回答1: To clear the SQL window you can use: clear screen; which can also be shortened to cl scr; 回答2: If you're using sqlplus in a shell, like bash you can run

Connect to sqlplus in a shell script and run SQL scripts

家住魔仙堡 提交于 2019-11-27 11:47:30
I have a .sql file, which is a bunch of oracle pl/sql commands and I want to create a shell script to run these commands. Suppose that user/pass@server is my credentials. What will be the shell script to do such a task? For example: sqlplus -s admin/password << EOF whenever sqlerror exit sql.sqlcode; set echo off set heading off @pl_script_1.sql @pl_script_2.sql exit; EOF Wouldn't something akin to this be better, security-wise?: sqlplus -s /nolog << EOF CONNECT admin/password; whenever sqlerror exit sql.sqlcode; set echo off set heading off @pl_script_1.sql @pl_script_2.sql exit; EOF If you

How can I issue a single command from the command line through sql plus?

送分小仙女□ 提交于 2019-11-27 11:33:33
Using SQL Plus, you can run a script with the "@" operator from the command line, as in: c:\>sqlplus username/password@databasename @"c:\my_script.sql" But is it possible to just run a single command with a similar syntax, without a whole separate script file? As in: c:\>sqlplus username/password@databasename @execute some_procedure I am interested in this because I want to write a batch file that simply executes a command, without generating a bunch of two-line ".sql" files. I'm able to run an SQL query by piping it to SQL*Plus: @echo select count(*) from table; | sqlplus username/password