sqlplus

ORACLE startup报错之ORA-01261、ORA-01263错误

做~自己de王妃 提交于 2019-12-30 17:43:52
【推荐】2019 Java 开发者跳槽指南.pdf(吐血整理) >>> 报错现象:C:\Users\Administrator.LOB>sqlplus / as sysdba SQL*Plus: Release 11.2.0.4.0 Production on 星期四 12月 26 11:36:50 2019 Copyright (c) 1982, 2013, Oracle. All rights reserved. 已连接到空闲例程。 SQL> startup; ORA-01261: Parameter db_recovery_file_dest destination string cannot be translated ORA-01263: Name given for file destination directory is invalid OSD-04018: ?????????????????????????? O/S-Error: (OS 2) ?????????????????????? 其实是spfile文件中一个路径db_recovery_file_dest找不到导致的。 *.audit_file_dest='D:\app\Administrator\admin\orcl\adump:' *.audit_trail='db' *.compatible='11

Pass values read from a file as input to an SQL query in Oracle

余生长醉 提交于 2019-12-30 13:42:11
问题 #cat file.txt 12354 13456 13498 #!/bin/bash for i in `cat file.txt` do sqlplus XXXXX/XXXXX@DB_NAME << EOF select *from TABLE_NAME where id="$i" EOF done This is not working for me. Help me how I can solve this. 回答1: Here is the right way to use the heredoc << , along with the choice of while read instead of for to read the file: #!/bin/bash while read -r value; do sqlplus xxxxx/xxxxx@db_name << EOF select * from table_name where id='$value'; # make sure heredoc marker "EOF" is not indented

Format query results in SQL*Plus

橙三吉。 提交于 2019-12-30 11:53:11
问题 when I want to see one table with its records in oracle, the table is disorganized,I mean is not like my-sql to see each value of attribute exactly under the name of attribute!how can I solve it? 回答1: What tool are you using? If you are using the command-line SQL*Plus, you may need to use formatting commands to specify how wide the display should be, i.e. Ugly data SQL> select empno, ename, job, mgr, hiredate, sal, comm, deptno 2 from emp; EMPNO ENAME JOB MGR HIREDATE SAL COMM D EPTNO -------

How to verify sqlplus can connect?

試著忘記壹切 提交于 2019-12-30 08:26:01
问题 I'd like to know if its possible to get sqlplus output in some way to discover if my database is up. I want to run a list of scripts on a database, but before I do that, I want to know if the database is up and running with my script. Here is what I tried: sqlplus /@DB1 << EOF > select 1 from dual; > EOF It cannot connect, but the return code of sqlplus still says "everything OK"! SQL*Plus: Release 11.2.0.4.0 Production on Mon Nov 28 10:06:41 2016 Copyright (c) 1982, 2013, Oracle. All rights

How to override >2499 character error in Oracle DB?

时间秒杀一切 提交于 2019-12-30 06:42:27
问题 I have a Oracle query which I'm executing through shell script and in that my query is getting exceeded the maximum length of 2499. I'm getting error SP2-0027: INPUT IS TOO LONG(> 2499 CHARACTERS) - LINE IGNORED 回答1: Here are some options for working around SQL*Plus line length limitations: Upgrade to 12.2(?) client. On 12.2 the client allows up to 4999 characters. Which is infuriating in a way - if Oracle finally admits that 2499 is not enough, why did they only increase the limit to 4999?

How do I format my oracle queries so the columns don't wrap?

落花浮王杯 提交于 2019-12-29 04:30:07
问题 I've tried this, but it doesn't work: col * format a20000 Do I really have to list every column specifically? That is a huge pain in the arse. 回答1: Never mind, figured it out: set wrap off set linesize 3000 -- (or to a sufficiently large value to hold your results page) Which I found by: show all And looking for some option that seemed relevant. 回答2: I use a generic query I call "dump" (why? I don't know) that looks like this: SET NEWPAGE NONE SET PAGESIZE 0 SET SPACE 0 SET LINESIZE 16000 SET

Inserting national characters into an oracle NCHAR or NVARCHAR column does not work

一世执手 提交于 2019-12-28 13:37:08
问题 When inserting strings in an oracle database, some national characters are replaced with question marks, even though they are inserted in an NCHAR or NVARCHAR column - that should be able to handle all Unicode characters. This happens using either Oracle's SQL Developer, sqlplus or using the JDBC driver. The database NLS_CHARACTERSET is set to WE8ISO8859P1 (western european iso-8859-1) The NLS_NCHAR_CHARACTERSET used for NCHAR columns is set to AL16UTF16. (UTF-16) Any character not in the NLS

How to kill a running SELECT statement

纵饮孤独 提交于 2019-12-27 16:59:18
问题 How can I stop a running SELECT statement by killing the session? The command is continuously giving me output based on the SELECT statement, I want to stop it in between. 回答1: As you keep getting pages of results I'm assuming you started the session in SQL*Plus. If so, the easy thing to do is to bash ctrl + break many, many times until it stops. The more complicated and the more generic way(s) I detail below in order of increasing ferocity / evil. The first one will probably work for you but

Oracle使用实例:创建只读用户

与世无争的帅哥 提交于 2019-12-27 13:45:53
【推荐】2019 Java 开发者跳槽指南.pdf(吐血整理) >>> Oracle使用实例:创建只读用户 原创 L.Lawliet 发布于2017-08-04 19:02:36 阅读数 12529 收藏 展开 场景:数据库dbtest(服务名)下,创建reader只读用户访问查询scott普通用户下的表及数据 这里先只介绍使用命令操作的一种方法 1. 管理员权限登陆sqlplus 打开cmd,登陆方法命令很多,例如: sqlplus scott/tiger @dbtest as sysdba 1 或者 sqlplus / as sysdba 之类命令进入sqlplus 然后conn scott/tiger @dbtest as sysdba 2. 创建一个新用户reader,密码123456 create user reader identified by 123456; 1 3. 为reader用户赋权限 /** 连接权限 */ grant connect to reader; /** 创建同义词权限 */ grant create synonym to reader; 1 2 3 4 4. 为reader用户赋查询表权限 为查询指定表”table1”赋权 grant select on scott.table1 to reader; 1 为查询所有表赋权

How do I get the delta for user_id since the previous months using oracle sql

烂漫一生 提交于 2019-12-25 17:04:27
问题 Let's say I have a table that has "user_id, loaddate", and many users are in user_id, but some may be added or removed at each month. How can i compare to find out who has been added or dropped out to the previous month´s? I suppose it would be getting a delta over the previous month for each and every month. 回答1: Presuming LOADDATE represents the date when a user was added to your system, then the delta of the newbies is easy to calculate. The wrinkle is finding the users who have been