SQL+

Starting SQL+

… is easy:

sqlplus user/pwd@tnsalias

On the server where the database is installed, you can start sqlplus also when the listener is down, and when you have no Oracle client configuration.

Linux/Unix:

Connect as the user who installed the database, then
>. oraenv
Oraenv is controlled by the file /etc/oratab.

If this doesn't work, try
>export ORACLE_HOME=/app/oracle/product/11.2.0/dbhome1
>export ORACLE_SID=TESTDB   (uppercase!)
With
env | grep -i ora
you can see if all environment variables are set fine. Maybe, you have to set TNS_ADMIN

Then:
>sqlplus / as sysdba
If this doesn't work, try
>sqlplus '/ as sysdba'
If this doesn't work, try
>sqlplus sys as sysdba'
Enter password>changeoninstall
If this doesn't work, try
>sqlplus sys/password@TNS-ALIAS as sysdba
If you get a message 
ORA-00020: maximum number of processes (150) exceeded
you can use the -prelim parameter which will not try to create private session structures in the SGA:  
>sqlplus -prelim '/as sysdba'
SQL> shutdown immediate
ORA-01012: not logged on
SQL> shutdown abort
ORACLE instance shut down.
SQL>exit
>sqlplus / as sysdba
SQL> startup
ORACLE instance started.
...
SQL> exit

Windows:

Set environment variables ORACLE_HOME and ORACLE_SID:
Open a command window
set ORACLE_SID=TESTDB   (uppercase!)
For Windows the sqlnet authentication service in the sqlnet.ora has to be set to NTS:

SQLNET.AUTHENTICATION_SERVICES = (NTS)

Then:
>sqlplus / as sysdba
If this doesn't work, try
>sqlplus "/as sysdba"
If this doesn't work, try
>sqlplus sys/password as sysdba
If this doesn't work, try
>sqlplus sys/password@TNS-ALIAS as sysdba
If this doesn't work, try
Start - Programs - Oracle Home - SQL+


SQL+ Commands
sta xyz.sql (short: @xyz.sql)
Run sql-file. In HKEY_LOCAL_MACHINE\SOFTWARE\ORACLE\SQLPATH you find the path where SQL+ is looking for .sql-Files. Using  “;” as a separator, you can add additional direcrories.

Host ls (short: !ls)
Run an operating system command

Spool
Select …
Save xyz.out

Write output into xyz.out. You can use the following settings to format the output:

SQL+ settings
-- Anzahl Zeilen pro Seite
set pagesize 0
-- lange Zeilen nicht umbrechen
set wrap off
-- Ausgabe nicht puffern
set flush off
-- Anzahl selektierter Zeilen nicht anzeigen:
set feedback off
-- Befehle nicht anzeigen
set echo off
-- Substitutionen (&) nicht anzeigen
set verify off
-- keine SQL+-Ausgabe anzeigen
set term off
-- führende Leezeichen weglassen
set trim on
-- damit dbms_output.put_line funktioniert
set serveroutput on
-- keine Spaltenüberschriften
set heading off
-- Tabellen nicht umbrechen
set linesize 1000
-- sonst sind Spoolfiles immer 1000 Zeichen breit:
set trimspool on 


No comments:

Post a Comment