Maybe, and this might be dependant on the command line environment you're using, you need to quote the string, something like
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 ...
You can use easy connect for this:
To enable easy connect on your machine, you need to add it to the NAMES.DIRECTORY_PATH in sqlnet.ora, e.g.:
If your listener is on a non-default port use ...@hostname.network:port/....
Actually it seems you have to supply a service ...
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';
Create a copy of the tnsnames.ora file in a directory that you can write to, modify the file accordingly, then set the TNS_ADMIN environment variable to the location of that directory.
cp $ORACLE_HOME/network/admin/tnsnames.ora /tmp/tnsnames.ora
# edit the /tmp/tnsnames.ora file to add your entries
# Set the $TNS_ADMIN environment variable so that ...
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 ...
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 ...
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 ...
Metalink bug 9103343 states:
This is expected behaviour. SQL*Plus is written in oci and oci has a
default prefetch value of 1 row. However prefetch upon a fetch (as
opposed to upon an execute) only takes place when you are not
performing an array fetch, so when arraysize is 1. Regardless of
arraysize the first fetch in the trace is always 1 ...
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 ...
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 ...
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 seems to be a quirk of SQL*Plus and arraysize rather than pipelined functions - the following demonstrates the same effect:
create or replace function pause return integer as
select pause from dual connect by level<10;
You can (sort of) workaround the issue by selecting the rows twice and discarding ...