It is not enough to force sqlplus not to wrap lines. It is also necessary to tell the viewer that you use to view the spool file not to wrap lines.
If your viewer is less then -S the option you have to use according to
On Unix/Linux you can use head -1 output.txt to get the first ...
There is nothing like PostgreSQL's set search_path in Oracle.
The closest thing I can think of would be a logon trigger for the user that run's an ALTER SESSION SET CURRENT_SCHEMA ...
CREATE OR REPLACE TRIGGER LOGON_TRG
AFTER LOGON ON SCHEMA
EXECUTE IMMEDIATE 'ALTER SESSION SET CURRENT_SCHEMA = foobar';
After two hours, I figured it out.
Oracle's documentation for the error didn't seem terribly descriptive at first:
ORA-24454: client host name is not set
Cause: The network host name in files like /etc/hosts was not set.
Action: Set the host name and try again.
Now, the command worked on my machine (Ubuntu laptop), but it didn't work on EC2. I ...
You can set the EDITOR environment variable before running SQL*Plus (Assuming Unix), to allow use of an external text editor (vi, by way of example):
Then type ed in SQL*Plus to edit the previous query in the vi editor. Of course, you may prefer nano, pico, emacs, vim etc etc.
If you don't wish to set an environment ...
The most simple is to use tnsnames.ora file to connect to the database.
For that edit it and add a new entry:
This file normally resides in the $ORACLE HOME\NETWORK\ADMIN directory.
(ADDRESS = (PROTOCOL = TCP)(Host = c)(Port =a))
and then you could connect to ...
This is a known bug (description is not public unfortunately):
Bug:4396234 ET10.2OREDEF: NULLABLE COL OF *_TAB_COLUMNS TABLE NOT UPDATED AFTER ONLINE REDEF
The NOT NULL constraints are copied as NOVALIDATE, and you have to set them to VALIDATE state manually, e.g:
ALTER TABLE t84_redefenition ENABLE VALIDATE CONSTRAINT constraint_name;
The primary key ...
This answer based on a1ex07 comment:
given the folowing detailes:
user name: demo
listener port: 1521
oracle SID: orcl
pdb service name: pdborcl
connect to core db from db host as sysdba:
without need of password: sqlplus / as sysdba
password manually: sqlplus sys as sysdba
password in command: sqlplus sys/Pass1234 as ...
You can do most of this by using a login.sql. login.sql is executed during - surprising - login and is loaded from your SQLPATH or current directory. For the examples you gave, your really chose the worst case.
Problem is the sqlterminator. Whatever you put in there, the forward slash is maintained as a free sqlterminator. Next to that, sqlplus first scans ...
To original poster... in the first option you missed a closing parenthesis
Incorrect: (Your string)
On your Windows client, you need to specify the TNS alias @ORCL, or else it assumes you're trying to connect to a local database running on your Windows client, which there isn't one. Also, system as sysdba generally isn't used, not even sure if that makes sense. SYS as sysdba and just plain system are used.
Enter user-name: system@ORCL
You need to terminate the SQL statement with a semicolon (;) or a put a slash (/) in the new line instead of hitting Enter. For example: select * from dual;. Otherwise SQLPlus will believe you have not finished your SQL statement, and it starts counting the lines. 2 is actually a line number, it is the 2nd line of your SQL statement. If you type nothing here ...
Yup, this is Bug 2391334 which has been around for long time, and probably will not be fixed in the near future.
One way of working around this is "know" the path for scripts without actually hard coding that path. To do this in SQLPlus requires a trick - if you try to run a non-existent file, then you'll get an error message that includes the path name.
When your OS user is from a DBA group, you can connect AS SYSDBA with OS authentication:
Two special operating system groups control database administrator
connections when using operating system authentication. These groups
are generically referred to as OSDBA and OSOPER. The groups are
created and assigned specific names as part of the database
SYSDBA is not a user, it is a system privilege. When you connect as / you are connecting to the SYS user. You don't need a password when you connect as you are - as long as it's a local connection from an OS account in the DBA group.
You haven't said what happens when you try to connect, or why you think you need a password; possibly that is that failing (...
DROP and TRUNCATE are Data Definition Language commands and thus cannot be rolled back. However, in Oracle you can use the following technologies to recover your table:
Tablespace Point in Time Recovery
Table-Level Recovery From Backups (new in 12c)
If the Recycle Bin is enabled in your database, you can ...
NLS_LANG can't be changed from inside a session, however other settings can.
You can't change the character set once a database connection has been established (ie: the 2nd part of NLS_LANG), but you can change the language with:
alter session set NLS_LANGUAGE=SPANISH
... and the territory with:
alter session set NLS_TERRITORY=SPAIN
In Oracle Database, you can use Database Resource Manager (DRM) to manage memory, CPU, time and other resources.
Usually your workflow is as follows:
Create a resource plan
Create the resource consumer groups
Create the resource consumer group mappings
Create the resource-plan directives
You create a plan with the DBMS_RESOURCE_MANAGER.CREATE_PLAN ...
Because you are not logged in as the user system. When you execute conn system/password as sysdba, Oracle won't even check the user and password (--> from the local systeem where the db is running on). If you enter the system/password as sysdba and then execute 'show user', you'll notice you are logged in as user 'SYS'. So you are actually entering the wrong ...
Get all privileges from AAA
SELECT DBMS_METADATA.GET_GRANTED_DDL('ROLE_GRANT','AAA') FROM DUAL;
SELECT DBMS_METADATA.GET_GRANTED_DDL('SYSTEM_GRANT','AAA') FROM DUAL;
SELECT DBMS_METADATA.GET_GRANTED_DDL('OBJECT_GRANT','AAA') FROM DUAL;
Change the DDL commands with the user 'BBB' and execute.
When you use sqlplus userName/myPassword@"(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=asdasdasd.com)(PORT=1524))(CONNECT_DATA=(SID=AARCER1)))" then you don't need any tnsnames.ora file.
Your entry in tnsnames.ora file should be like this:
AARCER1 = (DESCRIPTION=
(SID = ...
This can't be done without some kind of workaround, so here's one for you.
You can recompile the PL/SQL after creation & raise an exception if the recompilation fails. This will cause SQL*Plus to exit on failure.
create or replace procedure foo
this is an error;
exec execute immediate 'alter procedure foo ...
I don't think you can. The only thing I know that sort of does that (but is slightly annoying IMO) is the PAUSE option which waits for you to press enter between pages. The annoying part is that it pauses before the first row... You can Ctrl C to interrupt when you've seen enough.
SQL> set pause on
SQL> set pages 10 pause 'press enter to continue'
You simply don't use begin in sqlplus if you're just going to issue a series of SQL queries. You're in a transaction already as soon as you issue some SQL. You can't really be outside of a transaction anyway for practical purposes (sure, if you've just logged in, or just committed and haven't started anything else, well, you're not in a transaction).
A few ...
If you're using Linux/Unix, there's a way of making SQL*Plus loads friendlier on the command line - use rlwrap. It adds readline support to SQLPlus, allowing you to use the cursor keys to navigate to previous queries (it retains a history), and edit them when you've made a mistake.
Launch SQL*Plus with rlwrap -i sqlplus or add alias sqlplus="rlwrap -i ...
The OSDBA group (typically, dba)
You must create this group the first time you install Oracle Database software on the system. This group identifies operating system user accounts that have database administrative privileges (the SYSDBA privilege).
This is expected behavior as you are logging the Oracle Database from the OS user which belongs to DBA OS ...