sqlplus

sqlplus / as sysdba 没有权限

一笑奈何 提交于 2019-12-05 07:34:25
想通过如下命令登陆,这种方式是 以操作系统权限认证的oracle sys管理员登陆 sqlplus / as sysdba BUT.... 提示我没有权限, 百度下是由于当前用户不在 ora_dba 用户组中 (我的环境是win10) 寻思将当前用户放在oracle用户组中,奈何win10没有用户组,只能用命令行改 win10查看用户 C:\WINDOWS\system32>net user \\LAPTOP-BOU3T0DJ 的用户帐户 ------------------------------------------------------------------------------- Administrator DefaultAccount depen Guest WDAGUtilityAccount 命令成功完成。 C:\WINDOWS\system32> win10查看组 C:\WINDOWS\system32>net localgroup \\LAPTOP-BOU3T0DJ 的别名 ------------------------------------------------------------------------------- *__vmware__ *Administrators *Device Owners *Distributed COM

SQLPLUS saving to file

对着背影说爱祢 提交于 2019-12-05 06:38:04
I have to use SQLPLUS for my database class, and our first assignment is simple saving. I followed the instructions.. (I'm using PuTTY to access sqlplus) "Use the following SQL commands in this exercise and try the SAVE and SPOOL commands to save your SQL commands and output to external files. select table_name from all_tables where owner='UNIVERSITY'; select * from university.faculty; select * from university.clubs; For this lab, do the following: At the SQL> prompt, type Save test.sql (or save test.sql replace if the file already exists) then hit enter ; then type any SQL commands, the

How to prevent dbms_output.put_line from trimming leading whitespace?

不问归期 提交于 2019-12-05 06:27:00
I am trying to right-align the output of some PL/SQL code, but dbms_output.put_line is trimming the leading whitespace from my strings. How do I make it stop? Or is there a better way to output strings with leading whitespace? dbms_output.put_line(lpad('string', 30, ' ')); outputs: string instead of: string The problem is not with dbms_output but with SQL*Plus. Use SET SERVEROUTPUT ON FORMAT WRAPPED or SET SERVEROUTPUT ON FORMAT TRUNCATED to preserve the spaces. From the documentation (PDF) of SET SERVEROUT WORD_WRAPPED (which is the standard): SQL*Plus left justifies each line, skipping all

Number data type showing up as # in SQL Plus

我与影子孤独终老i 提交于 2019-12-05 06:02:45
Number data type showing up as # instead of the numbers in SQL Plus. Please refer to the H_RATE for the issue prevously it was showing up correctly and I have searched the internet and stackoverflow for a simliar issue or answer but none have the same. Could you help in fixing it so it shows the number instead of #? # is displayed if the value can't fit in the column; from the SQL*Plus documentation : If a value cannot fit in the column, SQL*Plus displays pound signs (#) instead of the number. If it was displaying OK and now isn't, I think you've probably set a column format that is too small

Getting SQLPlus to spool out Unicode characters, are being output as?

佐手、 提交于 2019-12-05 04:37:24
I am attempting to get Oracle sqlplus (10.2) to spool out Unicode data on a Linux machine. I have found several discussions of this issue, but no clear answers, other than to check locale settings and set NLS_LANG to AL32UTF8. All locale info is set to "en_US.UTF-8", I'll post the full output upon request. The OS (vi, etc.), will recognize and accept Unicode characters without issue. However, when using sqlplus, all non-ASCII characters are changed to ? characters. The Oracle DB has NLS_CHARACTERSET set to AL32UTF8, and NLS_NCHAR_CHARACTERSET set to AL16UTF16. Am I missing some setting or

sqlplus stuck on delete query

旧时模样 提交于 2019-12-05 02:59:26
问题 I'm experiencing a strange issue while using a an anonymous PL/SQL block launched by SQL*Plus. This block contains a delete statement and it works as expected if launched by the oracle sql developer interface. It gets stuck if I launch it from the cmd through sqlplus. I discovered the delete statement is the problem... I have the same situation with a simpler code like that: set serveroutput on size 1000000 begin DELETE FROM USER_LEAD; dbms_output.put_line('test'); end; / exit; If I remove

Dumping CLOB fields into files?

帅比萌擦擦* 提交于 2019-12-05 00:59:25
问题 Say you have the table: Column_name | data_type Title | Varchar2 Text | CLOB with some rows: SomeUnkownMovie | A long time ago in a galaxy far, far away....(long text ahead) FredMercuryBio | Awesomeness and stuff....(more long text) Is there a way I could query that so it outputs files like SomeUnkownMovie.txt FredMercuryBio.txt (and ofc, with their respective texts inside) I reckon this should be a easy enough sqlplus script.. though I'm just not the one :( thanks! 回答1: This pl/sql code

Display Dynamic EXECUTE Output Within pl/sql From sqlplus

断了今生、忘了曾经 提交于 2019-12-05 00:34:01
How to get the dynamic select results of EXECUTE within PL/SQL from Oracle sqlplus ? I'm writing a simple sqlplus script to collect the sum of all NUMBER columns of a given table: SET SERVEROUTPUT ON DECLARE CURSOR column_cur IS SELECT column_name FROM ALL_TAB_COLS WHERE owner = '&scheme_name' AND table_name = '&table_name' AND data_type = 'NUMBER'; sql_query VARCHAR2(32767); BEGIN sql_query := 'select '; FOR column_rec IN column_cur LOOP sql_query := sql_query || 'SUM(' || column_rec.column_name || ') "SUM(' || column_rec.column_name || ')", '; END LOOP; sql_query := substr(sql_query, 0,

SQLPlus settings to generate tab-separated data file

时光怂恿深爱的人放手 提交于 2019-12-04 23:00:01
Anyone have a good set of sqlplus configuration directives to help transform a given sql query into nicely tab separated output for pulling into a spreadsheet or further processing? Check out the Oracle documentation: Formatting SQLPlus Reports Generating HTML Reports from SQLPlus You can generate a tab in Oracle by using the tab's ASCII value 9 and the chr function: select chr(9) from dual; user158017 As Justin pointed out in his link, using the set colsep function SQLPlus command saves typing a separator for each column. But for tab-delimited, set colsep Chr(9) won't work. For UNIX or LINUX,

How to connect to Azure Oracle 12c Database using sqlplus or sql developer cloud connection

♀尐吖头ヾ 提交于 2019-12-04 17:17:56
I have 2 VM in azure one is a DB server and the other is a web server. I can get remote desktop connection for both these servers and web server can connect to Database wih sqlplus user/password@internal_network_ip:port/sid But however I cannot connect to Cloud DB from my local system. I tried sqlplus user/password@internal_ip:8552/sid ORA-12170: TNS:Connect timeout occurred sqlplus user/password@xxxx.something.net:8552/sid -- oracle port ORA-12170: TNS:Connect timeout occurred sqlplus user/password@xxxx.something.net:54955/sid -- port for cloud system used when taking remote desktop