SQL*Plus: Release 10.1.0.4.0 startup behaviour (glogin and login)

Hi,
I'm working in a unix environment where I have a lot of sql scripts to run using different DB users but only one OS user.
I notice that in this version of SQL*Plus something was change regarding glogin and login scripts: they are executed also after a successful connect. There is no warning in the documentation to NOT use CONNECT in these scripts.
What happens is recurrent execution of the same login script if there is a CONNECT command in it up to 20 time (the limit of recurrence in SQL*Plus). The only workaround I found is to put SET SQLPLUSCOMPATIBILITY to a prior version in the same login file before the CONNECT command.
Has anyone a better idea ?
Thank you.

There is no warning in the documentation to NOT use CONNECT in these scripts.the change is documented
http://download.oracle.com/docs/cd/B19306_01/server.102/b14357/ch12015.htm
When you run a CONNECT command, the site profile, glogin.sql, and the user profile, login.sql, are executed.
I understand your problem. The best would be to use a valid login and glogin script. I do not recommend big modification in glogin.
Some tools, like OEMGC, particulary hates aggressive staff in glogin.sql, for example ALTER SESSION, etc...
It is not recommended to do a "SET TERMOUT OFF" or a "WHENEVER SQLERROR CONTINUE" or any DML/DDL in your glogin, because it will irreversibily affect some scripts.
The best I can rate you : remove your fancy staff from glogin.sql. If it is about the sql prompt, use 10g feature, like
set SQLP _USER@""_CONNECT_IDENTIFIER>much better than selecting from global name!!!
HTH
Laurent

Similar Messages

  • SQL*Plus Release 9.2.0.1 remote connection to 10g EX

    Greetings,
    I am trying to access my XE database from a linux machine using SQLplus 9.2.0.1. I do the following:
    sqlplus /nolog
    sql>connect username/[email protected]:XEERROR:
    ORA-06401: NETCMN: invalid driver designator
    If I leave out the "XE" I get the following error:
    sql>connect username/[email protected]:
    ORA-12514: TNS:listener could not resolve SERVICE_NAME given in connect
    descriptor
    There seems to be nothing wrong with my database (tnsping works, etc).
    One of the enviromental variables in linux is "ORACLE_SID=CLASS1"
    I might have a syntax error in the connect function.
    Thanks in advance to whoever can help me. I viciously search the forum before posting this and could not get it to work.
    Andrey.

    Andrey,
    Is there a reason why you are using a colon between the <hostname>.<domain> and XE? If you use a period instead of a colon and define the default domain in the sqlnet.ora file as follows:
    NAMES.DEFAULT_DOMAIN = <hostname>.<domain>.XE
    You should be able to use a similar TNS alias but the colon will trigger an error. If you define your TNS alias as <hostname><domain>:XE and do not define the default domain in the sqlnet.ora file, then you should be able to connect from the command-line but not from within the SQL*Plus environment. For example, using this tnsnames.ora entry:
    hostname.domain:XE =
    (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = hostname.domain)(PORT = 1521))
    (CONNECT_DATA = (SERVER = DEDICATED)(SERVICE_NAME = XE)))
    You can connect running this at the command line:
    [oracle@s1 admin]$ sqlplus plsql/[email protected]:XE
    SQL*Plus: Release 10.1.0.2.0 - Production on Mon Nov 14 18:22:54 2005
    Copyright (c) 1982, 2004, Oracle. All rights reserved.
    Connected to:
    Oracle Database 10g Express Edition Release 10.2.0.1.0 - Beta
    SQL>
    However, you will get the following running:
    [oracle@s1 admin]$ sqlplus /nolog
    SQL*Plus: Release 10.1.0.2.0 - Production on Mon Nov 14 18:21:42 2005
    Copyright (c) 1982, 2004, Oracle. All rights reserved.
    SQL> conn plsql/[email protected]:XE
    ERROR:
    ORA-12545: Connect failed because target host or object does not exist
    Since the error will not occur if you define a default domain, it appears that changing the colon to a period may be your best solution.

  • Can SQL*PLUS deal with 'flat ASCII files' (input ) in UNIX ? and how?

    Can SQL*PLUS deal with 'flat ASCII files' (input ) in UNIX ? and how?

    No, but PL/SQL can. Look at utl_file.
    John Alexander www.summitsoftwaredesign.com

  • Checking Module to Prevent SQL Plus usage on Database

    I have a question regarding logon triggers checking against SYS_CONTEXT('USERENV', 'MODULE'). I created a logon trigger that looks for SYS_CONTEXT('USERENV', 'MODULE') = 'SQLPLUS.EXE'
    and if it matches then it only allows specified users to log in to the database. This code works but I am confused as to why when I check SYS_CONTEXT('USERENV', 'MODULE') after I login in
    shows SQL*Plus which clearly does not match my IF statement in my logon trigger.
    Second issue. If I rename sqlplus.exe to jeff.exe and run it I am abled to log in to the database as a non DBA user. But the module still shows as SQL*Plus. Why is this?
    Database Version: 11.2.0.2 64bit
    OS: Windows Server 2003 R2
    Client: 11.2.0.1
    /*********************Create Trigger******************************/
    CREATE OR REPLACE TRIGGER application_check_al
      after logon ON database 
    DECLARE
      l_username VARCHAR2(20);
      l_module   VARCHAR2(20);
    BEGIN
      l_username := SYS_CONTEXT('USERENV', 'SESSION_USER');
      l_module   := UPPER(SYS_CONTEXT('USERENV', 'MODULE'));
      IF l_module LIKE 'SQLPLUS.EXE' AND
         l_username NOT IN ('SYS', 'SYSTEM', 'DVOWNER', 'DVMGR') THEN
        raise_application_error(-20001, 'SQLPLUS ACCESS RESTRICTED FOR NON DBA USERS');
      END IF;
    END application_check_al;
    /*********************Run SQLPLUS******************************/
    SQL*Plus: Release 11.2.0.1.0 Production on Wed Mar 7 12:22:23 2012
    Copyright (c) 1982, 2010, Oracle.  All rights reserved.
    Enter user-name: jeffc@dev
    Enter password:
    ERROR:
    ORA-00604: error occurred at recursive SQL level 1
    ORA-20001: SQLPLUS ACCESS RESTRICTED FOR NON DBA USERS
    ORA-06512: at line 10
    Enter user-name: system@dev
    Enter password:
    Connected to:
    Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production
    With the Partitioning, OLAP, Data Mining, Oracle Database Vault
    and Real Application Testing options
    system@dev> select sys_context('USERENV','MODULE') from dual;
    SYS_CONTEXT('USERENV','MODULE')
    SQL*Plus
    SQL>

    jeff81 wrote:
    That doesn't make sense. Why am I able to log in when I renamed the exe? And why does the module still show as SQL*Plus?You are right - it does not make sense. The idea that Oracle might perhaps set module to SQLPLUS.EXE on executable start, and then re set from SQLPLUS.EXE to SQL*Plus after connect, or in glogin.sql, to ensure it is consistent across all operating system never crossed my mind.
    You might want to refer to Support Note "SQL*Plus Session/Module is Not Showing in V$SESSION" [ID 1312340.1] to see whether anything in there helps. I'm pretty sure http://docs.oracle.com/cd/E11882_01/server.112/e16604/ch_twelve040.htm#i2698573 doesn't help much, though.
    I'd certainly be raising it with Support as a potential security challenge, to get that potential hole closed.
    Edited by: Hans Forbrich on Mar 7, 2012 2:23 PM
    I wonder whether Oracle put that capability in there - if an untained SQLPLUS.EXE, it tells you that it is SQLPLUS.EXE, but if renamed it tells you 'SQL*Plus'? Specuklation, but it is one thing I might do to subtly raise the flag. Best bet - ask Support.
    Edited by: Hans Forbrich on Mar 7, 2012 2:29 PM

  • Oracle10g Developer Suite - Application Development - SQL Plus Login Info

    I have installed Oracle10g Developer Suite and when I am trying to login into the sql*plus environment the username scott with the passcode tiger is not working. I have Oracle9i Enterprise Edition Release 9.2.0.1.0 as the database.
    Can anyone help me in setting up the username and password to login into Sql*plus Release 10.1.0.4.2

    It sounds like you may be new to Oracle and its products. I would recommend doing some reading.
    Oracle 9.2 Net Services Admin Guide
    http://download-west.oracle.com/docs/cd/B10501_01/network.920/a96580/toc.htm
    Oracle Developer Suite Installation Guide
    http://download-west.oracle.com/docs/cd/B25016_06/doc/dl/core/B16012_03/toc.htm
    You create the "login" information when you install the database. If you are not the person who performed the installation, you will need to contact them or install it again. Also, be aware that the SCOTT schema is disabled by default in newer database versions for security reasons.
    The tnsnames.ora and sqlnet.ora files can be found in the ORACLE_HOME\network\admin directory. This is the same for all Oracle products that use Sql-Net for database connections. You can also use the TNS_ADMIN environment variable to point to a pre-existing tnsnames.ora file (see previously mentioned documents).
    The tnsnames.ora entry will be unique to your database and its listener however here is an example:
    ORCL =
    (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = someServer.com)(PORT = 1521))
    (CONNECT_DATA =
    (SERVICE_NAME = orcl)
    )

  • SQL*PLUS 32 Bit Client needed for Windows 64 Bit

    Hi,
    I have got a 64 Bit Windows OS and an Oracle 11.
    With 32 Bit Applications ( Crystal Reports) I can not run SQL NET Thick, SQL NET Thin and JDBC.
    Oracle 32 Bit Installation is Missing.
    Oracles "Instant Client Downloads for Microsoft Windows (32-bit)" will not do it.
    http://www.oracle.com/technetwork/topics/winsoft-085727.html
    What else to use ?
    Thank You
    Martin Sautter

    Martin.Sautter wrote:
    Hi,
    i used:
    instantclient-basic-nt-11.2.0.2.0.zip (32BitClient)
    instantclient-sqlplus-nt-11.2.0.2.0.zip.
    I did not find an "old", "classic" SQL*PLUs client.What does that mean exactly, classic client?
    Did you unzip the ic sqlplus .zip (the one listed) in the same dir as ic basic?
    After dezipping waht than ?
    No installer, nothing ...That's the beauty of Instant Client, just unzip or move a few files, set PATH if needed, and you have client libraries all "installed" and ready.
    >
    You can give advice ?Generally, required lib files are (n Windows) oci.dll, oraociicusN.dll or oraocieiN.dll (N= e.g. 11). Then for Sql*plus add orasqlplusicN.dll and the .exe from ic-sqlplus package.
    C:\Users\Test\Ora-IClite>dir
    Volume in drive C is OS
    Volume Serial Number is 6E8F-186A
    Directory of C:\Users\Test\Ora-IClite
    2011-12-16  09:30    <DIR>          .
    2011-12-16  09:30    <DIR>          ..
    2011-08-31  11:39                38 ldap.ora
    2011-07-30  12:21           683 008 oci.dll
    2011-07-30  12:21        44 153 856 oraociicus11.dll
    2011-07-30  12:21         1 501 696 Orasqlplusic11.dll
    2011-07-30  12:21           869 376 sqlplus.exe
    C:\Users\Test\Ora-IClite>.\sqlplus user@'localhost/xe'
    SQL*Plus: Release 11.2.0.2.0 Production on Fri Dec 16 09:34:13 2011
    Copyright (c) 1982, 2010, Oracle.  All rights reserved.
    Enter password:Edited by: orafad on Dec 16, 2011 9:35 AM

  • How to get the SQL file name in SQL*plus

    hi all,
         I have created two sql file at C drive as "c:\Createtable.sql" and "c:\Deletetable.sql"
    afterwards i open
    C:\>sqlplus
    SQL*Plus: Release 10.2.0.1.0 - Production on Wed Jan 30 11:37:10 2008
    Copyright (c) 1982, 2005, Oracle.  All rights reserved.
    Enter user-name: scott/tiger
    Connected to:
    Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
    With the Partitioning, OLAP and Data Mining options
    SQL> @C:\Createtable.sql'
    Table created.
    SQL> @'C:\Deletetable.sql'
    Table dropped.
    SQL>My problem is to get the name of the file as "c:\createtable.sql" and "C:\Deletetable.sql" in sql*plus enviornment.
    Thanks & Regards
    Singh

    Dear Damorgan,
         >>your version number to three decimal places
         My Oracle DB Version i have already stated in my previous post is 10.2.0.1.0
    Actually my problem is to get the sql files name we run in sqlplus enviornment with @ symbol. like
    i have created one sql file in c drive as
    "C:\Createtable.sql"
    afterwords i have connected to sqlplus as
    sql> conn scott/tiger
    sql>@c:\createtable.sql
    Now i want some query to get the name of the file which is run.
    In actual my problem is as
    i have suppose 10 or more SQL files in some folder ( sql1.sql, sql2.sql, sql3.sql ....).
    i created one file to call all the 10 sql files (main.sql)
    i have also one track_table which will keep track that which sql file is runned.
    I want some automated script which will insert the record in that track_table....... for that i need the name of sql file which is runned.
    Hope this will help you.
    Thanks & Regards
    Singh

  • SQL PLUS acitvity in process flow

    I looked at other threads and did exactly the same but I am getting a error. Any ideas.
    I created a variable as counter.
    In sqlplus activity Paramter List I did not do anything. for result code I did the binding as counter which is my variable.In script I put in the below code.
    VARIABLE COUNTER_PPAL NUMBER;
    DECLARE
    BEGIN
    SELECT COUNT(*) INTO :COUNTER_PPAL FROM TEMP_TABLE
    END;
    EXIT :COUNTER_PPAL
    The error I am getting is
    SQL*Plus: Release 10.2.0.1.0 - Production on Mon Jan 25 08:30:15 2010
    Copyright (c) 1982, 2005, Oracle. All rights reserved.
    Connected to:
    Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - 64bit Production
    With the Partitioning, OLAP and Data Mining options
    Session altered.
    END;
    ERROR at line 4:
    ORA-06550: line 4, column 4:
    PLS-00103: Encountered the symbol "end-of-file" when expecting one of the
    following:
    begin case declare end exception exit for goto if loop mod
    null pragma raise return select update while with
    <an identifier> <a double-quoted delimited-identifier>
    <a bind variable> << close current delete fetch lock insert
    open rollback savepoint set sql execute commit forall merge
    pipe
    SP2-0670: Internal number conversion failed
    Usage: { EXIT | QUIT }     [ SUCCESS | FAILURE | WARNING | n |
    <variable> | :<bindvariable> ] [ COMMIT | ROLLBACK ]
    Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - 64bit Production
    With the Partitioning, OLAP and Data Mining options

    I was missign a semi colon after my select statement.

  • Error when connecting to SQL*PLUS via ODBC to Excel

    OS: Windows 2000 Professional
    Oracle DB: 9i release 2
    SQL*Plus: Release 9.2.0.1.0
    MS Excel: 2000
    ===================
    When I try to connect to SQL*PLUS via ODBC to Excel with "connect scott/tiger@odbc:libro" I get the following error:
    ORA-03121: no interface driver connected - function not performed

    SQL Server objects are commonly case sensitive, so please surround the column and table names by double quotes:
    SELECT "Type_PK_ID" FROM "dbo"."boundaries"@sqlserver
    SIDE NOTE: Oracle is by default not case sensitive and all object names are stored in upper case. To get case sensitive objects they need to be surrounded by double quotes. In HSODBC case sensitive table names were commonly found even when not surrounded by double quotes as the gateway used internal SQL Server methods to find the correct table nameing - this method does not work for column names. So to be able to query a case sensitive column it needs to be surrounded by double quotes and the table name must be written as stored in the source database.

  • Oracle SQL*PLUS has encountered a problem and needs to close

    When I have done like below,
    C:\Documents and Settings\himanshu.chaudhari>sqlplus /nolog
    SQL*Plus: Release 10.2.0.1.0 - Production on Tue Jul 14 07:38:22 2009
    Copyright (c) 1982, 2005, Oracle. All rights reserved.
    SQL> conn sys@dev as sysdba
    Enter password:
    Connected.
    SQL> spool e:/spool/test.log
    SQL> @e:/spool/ms_script.sql
    Got error like ,
    Oracle SQL*PLUS has encountered a problem and needs to close. We are sorry for the inconvenience.
    AppName: sqlplus.exe     AppVer: 0.0.0.0     ModName: oranls10.dll
    ModVer: 10.2.0.1     Offset: 0005d6ff
    I am using,
    Operating System: Microsoft Windows XP Professional Version 2002 Service Pack 3,
    Have two different oracle client on same drive
    1) 10.2.0.1.0
    2) 8.1.7.4.0
    I have tried,
    Run selecthome.bat from BIN but got same error,
    Run sqlpus.exe from particular home then also got same error..
    So , Please anyone can have some idea regarding the same ?

    Is there any other error in error.log file?
    What do you run in that (ms_script) script?
    Have you used both sqlplus?
    Kamran Agayev A. (10g OCP)
    http://kamranagayev.wordpress.com
    [Step by Step install Oracle on Linux and Automate the installation using Shell Script |http://kamranagayev.wordpress.com/2009/05/01/step-by-step-installing-oracle-database-10g-release-2-on-linux-centos-and-automate-the-installation-using-linux-shell-script/]

  • Displaying Chinese characters in SQL*Plus

    DB version: 11.2
    OS Version : AIX 6.1
    DB characterset:AL32UTF8
    To display chinese characters in SQL*Plus, I did the following:
    $ export LANG=zh_CN.UTF-8
    $ export LC_ALL=zh_CN.GB2312
    $ export NLS_LANG="SIMPLIFIED CHINESE_CHINA.ZHS16GBK"
    $
    $ sqlplus / as sysdba
    SQL*Plus: Release 11.2.0.2.0 Production on ÐÇÆÚÈý 5ÔÂ 2 15:52:33 2012
    Copyright (c) 1982, 2010, Oracle.  All rights reserved.
    Connected to:
    Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production
    With the Partitioning option
    SQL> ALTER SESSION SET NLS_LANGUAGE='SIMPLIFIED CHINESE';
    Session altered.
    SQL> ALTER SESSION SET NLS_TERRITORY='CHINA';
    Session altered.
    SQL> select unistr('\8349') from dual;  ---- not 100% sure if this is the way to verify if chinese characters can be displayed.
    UN
    ²Ý                 ----------------------------------------> Getting a junk character instead of chinese If I was using putty, are the above steps enough to get chinese characters displayed ?
    Our ssh client is Tectia (not putty).
    According the below ML Note, the SSH client has to configured correctly to use globalization features.
    +The correct NLS_LANG setting in Unix Environments [ID 264157.1]+
    Googling "Tectia + Chinese" didn't return useful results

    I understand that you are talking about Windows SSH Client.
    For Putty, you should set:
    $ export LANG=zh_CN.UTF-8
    $ export LC_ALL=zh_CN.UTF-8
    $ export NLS_LANG="SIMPLIFIED CHINESE_CHINA.AL32UTF8"
    and configure Putty in Window->Translation to use UTF-8.
    There is nothing about this subject on Tectia website and in their manuals, so my best guess is that the client requires Windows code page to work correctly. In such case you need to set your Windows system default locale (locale for non-Unicode programs) to Chinese and use the following settings on the server:
    $ export LANG=zh_CN.GBK
    $ export LC_ALL=zh_CN.GBK
    $ export NLS_LANG="SIMPLIFIED CHINESE_CHINA.ZHS16GBK"
    Verify with 'locale -a' that the setting zh_CN.GBK is supported on your system.
    -- Sergiusz

  • Execution of Immediate SQL in compiled package in two versions of SQL*PLUS

    A peculiar problem has risen in our database.
    Execution of Immediate SQL in compiled package in two versions of SQLPLUS gives different results
    We have a compiled package with two procedures that contain immediate SQL statements, and these are:
    +PROC_DELETE_ROWS+
    +     -- This immediate sql deletes unreferenced Document Types from the DOC_REF_TYPE table+
    +     delete from doc_ref_type t where exists (select 1 from PROARC_DOC_REF_TYPE_VW d where d.doc_ref_type = t.doc_ref_type)+
       +     and not exists (select 1 from doc_ref d where d.doc_ref_type = t.doc_ref_type)+
       +     and doc_ref_type not in (select doc_ref_type from eis_doc_ref_type)+
       +     and doc_ref_type not in (select eis_doc_ref_type from eis_doc_ref_type)+
    +PROC_ADD_NEW_ROWS+
    +     -- Drop the temporary table+
    +     drop table TMP_PROARC_DOC_REF_TYPE+
    +     -- Create a temporary table+
    +     create table tmp_PROARC_DOC_REF_TYPE as+
    +     select DOC_REF_TYPE, substr(DOC_REF_TYPE_DESC,1,100) as DOC_REF_TYPE_DESC+
    +     from PROARC_DOC_REF_TYPE_VW+
    +     -- Insert document types that do not exist in the DOC_REF_TYPE table+
    +     insert into doc_ref_type t (DOC_REF_TYPE, DOC_REF_TYPE_DESC)+
            +     select distinct DOC_REF_TYPE, DOC_REF_TYPE_DESC from tmp_PROARC_DOC_REF_TYPE s+
            +     where not exists (select 1 from doc_ref_type t where t.doc_ref_type = s.doc_ref_type)+
    I am using the following test script:
    +Exec mypackage.proc_delete_rows;+
    +Commit;+
    +Select count(*) from DOC_REF_TYPES;+
    +Exec mypackage.proc_add_new_rows;+
    +Commit;+
    +Select count(*) from DOC_REF_TYPES;+We have a Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - 64bit
    I am using SQL*Plus: Release 8.1.7.0.0
    The test script is working as expected.
    Count after delete =155
    Count after insert = 511
    but when I use another computer with SQL*Plus: Release 10.x
    The Test script returns the following
    Count after delete =155
    Count after insert =155
    The same is happening when I am running the scripts as a scheduled job.
    QUESTION:
    I believe I have found a fix for the problem though. By changing tmp_PROARC_DOC_REF_TYPE in the insert statement to all upper case, the script is running in both environments apparently. But how is this possible? I am executing a compiled package in the database. The session shell should have no impact on the behaveour of the procedure I am calling. What causes this?
    Edited by: Reon on Jun 16, 2011 4:44 AM

    1) I am using the same user (PANDORA)
    2) (PANDORA) for both
    3) I am actually not handling any errors. Just skipping any error altogether. I'll check to see what exceptions are raised, and come back.
    I have also noticed that SQL/PLUS is not the culprit here. If I use SQLTools 1.5 to run the script, the same thing happens. So it has to do something with the connection or session environment that is inheritet to both clients.
    The CODEZ:_
      procedure add_doc_types IS
      sqlstr     VARCHAR2(2000);
      begin
      BEGIN
           sqlstr := 'drop table TMP_PROARC_DOC_REF_TYPE';
         EXECUTE IMMEDIATE sqlstr;
        EXCEPTION
          WHEN OTHERS THEN
            null;
        END;
      BEGIN
           sqlstr := 'create table tmp_PROARC_DOC_REF_TYPE as select DOC_REF_TYPE, substr(DOC_REF_TYPE_DESC,1,100) as DOC_REF_TYPE_DESC from PROARC_DOC_REF_TYPE_VW';
         EXECUTE IMMEDIATE sqlstr;
        EXCEPTION
          WHEN OTHERS THEN
            null;
        END;
        BEGIN
            sqlstr := 'insert into doc_ref_type t (DOC_REF_TYPE, DOC_REF_TYPE_DESC)
                    select distinct DOC_REF_TYPE, DOC_REF_TYPE_DESC from TMP_PROARC_DOC_REF_TYPE s
                    where not exists (select 1 from doc_ref_type t where t.doc_ref_type = s.doc_ref_type)';
         EXECUTE IMMEDIATE sqlstr;
            sqlstr := 'update doc_ref_type t set DOC_REF_TYPE_DESC = (
                    select DOC_REF_TYPE_DESC from tmp_PROARC_DOC_REF_TYPE s
                    where t.doc_ref_type = s.doc_ref_type)
                    where exists (select 1 from tmp_PROARC_DOC_REF_TYPE s where t.doc_ref_type = s.doc_ref_type)';
         EXECUTE IMMEDIATE sqlstr;
        EXCEPTION
          WHEN OTHERS THEN
            null;
        END;
      end add_doc_types;
      procedure delete_doc_types IS
      sqlstr     VARCHAR2(2000);
       BEGIN
            sqlstr := 'delete from doc_ref_type t where exists (select 1 from PROARC_DOC_REF_TYPE_VW d where d.doc_ref_type = t.doc_ref_type)
            and not exists (select 1 from doc_ref d where d.doc_ref_type = t.doc_ref_type)
            and doc_ref_type not in (select doc_ref_type from eis_doc_ref_type)
            and doc_ref_type not in (select eis_doc_ref_type from eis_doc_ref_type)';
          EXECUTE IMMEDIATE sqlstr;
         EXCEPTION
           WHEN OTHERS THEN
             null;
      end delete_doc_types;Edited by: Reon on Jun 16, 2011 2:01 AM

  • SQL * PLUS WORKSHEET wrapping

    I am using the SQL*Plus: Release 8.1.6.0.0 and the query gives us a wrapping results which is so hard to read and takes awhile to execute.

    The default value for SQL*Plus LINESIZE is 80 and for PAGESIZE is 25. If the row of records select increases 80 then the records start wrapping. The suggestions are
    1>. either limit the columns selected. i.e. instead of using SELECT * from TABLE use
    SELECT col_a, col_b ... from TABLE
    2>. increase the linesize by using the following
    SET LINESIZE 300 ;
    The valid values for linesize are 0 through 32767.
    However, if you increase the linesize to a very high value, then you will need to do horizontal scroll to see all the columns.

  • Windows System Environment Variables in "Sql * plus"

    Can i use/reference Windows System Environment variables in "Sql * plus"?
    For example, i want to create sql-script to run in database server computer that asks variable "ORA_HOME" and uses this value to execute some sql/plsql sentences.
    Oracle 10g Personal, Windows 7.
    Edited by: CharlesRoos on 12.11.2010 17:28

    CharlesRoos wrote:
    Business problem:
    I have created 2 databases in my computer. Both databases needs tablespaces created by a script. Tablespaces' datafiles (.dbf files) names are same for both database. Both database has it's own directory where it holds datafiles at the moment. At the moment the datafiles for Database1 are in folder something like "%ORACLE_HOME%"\oradata\%databasename1%\*.dbf, and second database has its datafiles in other folder, somewhere ""%ORACLE_HOME%"\oradata\%databasename1%\*.dbf". I want now the script to create tablespace called "INDX" with same datafile name "indx1.dbf" into both database. So into both mentioned folder the file "indx1.dbf" must be created by script. I think the script should do following:
    1. get ORACLE_HOME.
    2. connect to database "databasename1"
    3. EXECUTE IMMEDIATE "Create TableSpace INDX....file=%ORACLE_HOME% || databasename1 || indx1.dbf"
    4. connect to database "databasename2"
    5. EXECUTE IMMEDIATE "Create TableSpace INDX....file=%ORACLE_HOME% || databasename2 || indx1.dbf"I don't have Oracle database near by anymore, so the code was pseudocode.
    I don't understand how to use ?-shortcut.OK, my first impression is "why does this even NEED to be scripted? Creation of new tablespaces is usually a one-off operation.
    But that aside how about this sqlplus command-line substitution variables. This example is in linux, but will work as well in Windows with the change of the way environment variables are referenced:
    *nix - echo $myvariable
    Windows - echo %myvariable%
    First, the sqlscript to create the TS. Note the use of the substitution variable "&1"
    {code}
    [oracle@vmlnx01 ~]$ cat cat makets.sql
    set echo on feedback on verify on trimsp on
    prompt &1
    CREATE SMALLFILE TABLESPACE EDSTEST
    DATAFILE '/ora01/oradata/&1/edstest.dbf'
    SIZE 5M
    REUSE
    AUTOEXTEND ON
    NEXT 1280K
    MAXSIZE 32767M
    LOGGING
    EXTENT MANAGEMENT LOCAL
    SEGMENT SPACE MANAGEMENT AUTO
    drop tablespace edstest
    including contents and datafiles
    exit
    {code}
    So, at the OS prompt: Notice that the @ is separated by a space, makeing it a command line parm instead of part of the connect string
    {code}
    [oracle@vmlnx01 ~]$ export myparm=vlnxora1
    [oracle@vmlnx01 ~]$ sqlplus system/pswd @makets $myparm
    SQL*Plus: Release 10.2.0.4.0 - Production on Fri Nov 12 13:18:05 2010
    Copyright (c) 1982, 2007, Oracle. All Rights Reserved.
    Connected to:
    Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - Production
    With the Partitioning, OLAP, Data Mining and Real Application Testing options
    SQL> prompt &1
    vlnxora1
    SQL> --
    SQL> CREATE SMALLFILE TABLESPACE EDSTEST
    2 DATAFILE '/ora01/oradata/&1/edstest.dbf'
    3 SIZE 5M
    4 REUSE
    5 AUTOEXTEND ON
    6 NEXT 1280K
    7 MAXSIZE 32767M
    8 LOGGING
    9 EXTENT MANAGEMENT LOCAL
    10 SEGMENT SPACE MANAGEMENT AUTO
    11 ;
    old 2: DATAFILE '/ora01/oradata/&1/edstest.dbf'
    new 2: DATAFILE '/ora01/oradata/vlnxora1/edstest.dbf'
    Tablespace created.
    SQL> --
    SQL> drop tablespace edstest
    2 including contents and datafiles
    3 ;
    Tablespace dropped.
    SQL> exit
    Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - Production
    With the Partitioning, OLAP, Data Mining and Real Application Testing options
    [oracle@vmlnx01 ~]$
    {code}

  • SQL*Plus sysdba remote connection

    Hello all,
    I'm attempting to connect to a remote database via splplus as the sys as sysdba user and am unable to do so. However, I am able to connect as a non-sysdba user. When I attempt to connect as sysdba, I receive no error but only the sqlplus Usage message. Here is some initial information:
    Client
    Microsoft Windows XP [Version 5.1.2600]
    (C) Copyright 1985-2001 Microsoft Corp.
    U:\>sqlplus regular_user/password@mySID
    SQL*Plus: Release 9.2.0.1.0 - Production on Thu Jul 2 10:05:29 2009
    Copyright (c) 1982, 2002, Oracle Corporation.  All rights reserved.
    Connected to:
    Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - 64bit Production
    With the Partitioning, OLAP and Data Mining options
    SQL> exit
    Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - 64bit Production
    With the Partitioning, OLAP and Data Mining options
    U:\>sqlplus sys/password@mySID as sysdba
    Usage: SQLPLUS [ [<option>] [<logon>] [<start>] ]
    where <option> ::= -H | -V | [ [-L] [-M <o>] [-R <n>] [-S] ]
          <logon>  ::= <username>[/<password>][@<connect_string>] | / | /NOLOG
          <start>  ::= @<URI>|<filename>[.<ext>] [<parameter> ...]
            "-H" displays the SQL*Plus version banner and usage syntax
            "-V" displays the SQL*Plus version banner
            "-L" attempts log on just once
            "-M <o>" uses HTML markup options <o>
            "-R <n>" uses restricted mode <n>
            "-S" uses silent modeServer
    Microsoft Windows [Version 5.2.3790]
    (C) Copyright 1985-2003 Microsoft Corp.
    U:\>sqlplus sys/password@mySID as sysdba
    SQL*Plus: Release 10.2.0.1.0 - Production on Thu Jul 2 10:21:01 2009
    Copyright (c) 1982, 2005, Oracle.  All rights reserved.
    Connected to:
    Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - 64bit Production
    With the Partitioning, OLAP and Data Mining options
    SQL>Based upon what I read here: I've found that the server has a PWDmySID.ora file in %ORACLE_HOME%\database. I've updated the %ORACLE_HOME%\database\initmySID.ora file to include the REMOTE_LOGIN_PASSWORDFILE=EXCLUSIVE line and have restarted the database.
    Any thoughts? Apparently I'm making some sort of syntax error logging in but I don't know what it is? :) Thanks.
    Edited by: nmd on Jul 2, 2009 9:43 AM

    HI,
    can you please try it like first entrying into the sqlplus and then enter the username and password..
    Also it should be sqlplus "sys/password as sysdba"
    Regards

Maybe you are looking for

  • How to find files stored in an application

    I have a program application called silhouette and I save things to my library in that app. I want to make a backup copy of the files i have downloaded in that program but cannot find them on my computer. Must be hidden.. How do I find them?  Help

  • Dreamweaver fails to boot up. page links will not open in explorer

    i have the current dreamweaver as part of my cretive cloud subscription. i have a mac, os 10.8.5. for months after i subscribed to creative cloud, dreamweaver worked fine. then, after doing a CC update about two weeks ago, dreamweaver refused to load

  • Movies on iWeb 09

    I just finish creating my first iWeb 09 web and after getting through the learning curve, I found it to be a good & simple intro tool to creating websites. But, I did run into two problems: 1) all hyperlink colors changed from page to page, even thou

  • WLS6.1 SP2/JDK1.3.1_03/HTTP 302 Error

    Hello, we use WLS6.1 SP2 with JDK1.3.1_03 and we get sometimes an HTTP 302 error, when a JSP-page is requested. The error appears in the browser is following:      This document you requested has moved temporarily.      It's now at </zv/account/accou

  • Ratings System

    Does anyone know of any utility which can allow a change in the way songs are rated ? I'm looking for either more than 5 stars or the ability to award 1/2 stars to tracks. I have nearly 10,000 tracks and find the 5 stars system not enough - anyone el