Hiding echo in sqlplus

I am sorry to ask this trivial question but i need some help on this.
I need to hide some displays from sqlplus so that the values echoed are not displayed.
For example I want this
ENTER USERNAME TO CHANGE TUNDE
old 2: WHERE USERNAME ='&USER1'
new 2: WHERE USERNAME ='TUNDE'
'ALTERUSER'||USERNAME||'IDENTIFIEDBYWHATEVER;'
alter user TUNDE identified by whatever;
Elapsed: 00:00:00.00
to show as just
alter user TUNDE identified by whatever;
I have tried setting echo and termout off but this has not helped.
i am passing values in the script but I dont want old and new psuedo columsn to be displayed.
All i require is the result.
Thanks very much

set ver off

Similar Messages

  • Variable substitution characters in sqlplus

    The question mark character - "?" is the substitution for ORACLE_HOME in sqlplus.
    What is the substitution character for ORACLE_SID?
    Are there any other characters that can be used?
    Where I can read about it?
    Leonid

    bcm@bcm-laptop:~$ cat abc.sh
    echo $ORACLE_SID
    sqlplus  <<EOF
    oe/oe
    select '/vol02/orabackup/$ORACLE_SID/expdp' from dual;
    exit
    EOF
    bcm@bcm-laptop:~$ sh -x  abc.sh
    + echo v112
    v112
    + sqlplus
    SQL*Plus: Release 11.2.0.1.0 Production on Mon Aug 23 08:40:14 2010
    Copyright (c) 1982, 2009, Oracle.  All rights reserved.
    Enter user-name:
    Connected to:
    Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
    With the Partitioning, OLAP, Data Mining and Real Application Testing options
    SQL>
    '/VOL02/ORABACKUP/V112/EXPD
    /vol02/orabackup/v112/expdp
    SQL> Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
    With the Partitioning, OLAP, Data Mining and Real Application Testing options
    bcm@bcm-laptop:~$ please mark TREAD as answered

  • Sqlplus command using a query instead of a sql file

    can any body guide me?..i want to execute the sql query using sqlplus without using a sql file. for example following command is valid:
    sqlplus abc/abc@abc @abc.sql
    but i want
    sqlplus abc/abc@abc @(select * from abc)
    i will be thankful if any body can suggest something
    Message was edited by:
    syed.habib
    Message was edited by:
    syed.habib

    i use the suggested command in a batch file and when i run this command, i get this:
    C:\>(
    echo select count(*) from tab
    More? echo /
    More? echo exit
    ) | sqlplus -s abc/abc@abc
    'More?' is not recognized as an internal or external command,
    operable program or batch file.
    'More?' is not recognized as an internal or external command,
    operable program or batch file.

  • Passing variables from shell script to separate sqlplus script

    Hi, I am having issues passing variables to a separate sqlplus script invoked by the shell script, e.g.
    #!/bin/sh
    DB_NAME=TEST
    PWD1=PA55W0rd
    echo exit | sqlplus / as sysdba @${DB_NAME}.sql ${DB_NAME} $PWD1 >> ${DB_NAME}.sql
    exit 0
    The script picks up the $DB_NAME variable fine, and therefore invokes the required sql script.
    However, when I pass the variable $PWD1 to the sql script I get an error.
    The script creates a database link:
    create or replace procedure new.link
    is
    begin
    execute immediate 'create database link TEST
    connect to TESTSCH identified by '$PWD1'
    using ''TEST''';
    end;
    exec new.link;
    output is:
    ERROR at line 1:
    ORA-00911: invalid character
    ORA-06512: at "NEW.LINK", line 4
    ORA-06512: at line 1
    any help appreciated!
    Edited by: 969765 on Apr 5, 2013 4:24 AM

    969765 wrote:
    that is a pretty unhelpful comment, this is actually my LAST resort I have looked up all the documentation etc.This is what I did...
    I went to the documentation:
    http://www.oracle.com/pls/db112/homepage
    I searched for "sqlplus" which gave me this documentation (under "SQL*plus program syntax")...
    http://docs.oracle.com/cd/E11882_01/server.112/e16604/ch_three.htm#i1169374
    I read the syntax:
    SQLPLUS [ [Options] [Logon|/NOLOG] [Start] ]and the subsequent information:
    >
    where Start has the following syntax:
      @{url|file_name[.ext]} [arg ...]and "Start" was hyperlinked, so I clicked on it, which took me to the section...
    >
    Start
    @} [arg ...]
    Specifies the name of a script and arguments to run. The script can be called from the local file system or from a web server.
    SQL*Plus passes the arguments to the script as if executing the file using the SQL*Plus START command. If no file suffix (file extension) is specified, the suffix defined by the SET SUFFIX command is used. The default suffix is .sql.
    See the START command for more information.
    >
    and here the "START" was hyperlinked, so I clicked on that...
    and hey presto, I ended up here:
    http://docs.oracle.com/cd/E11882_01/server.112/e16604/ch_twelve044.htm#BACJJHDA
    ... where the arguments are described...
    >
    arg ...
    Data items you wish to pass to parameters in the script. If you enter one or more arguments, SQL*Plus substitutes the values into the parameters (&1, &2, and so forth) in the script. The first argument replaces each occurrence of &1, the second replaces each occurrence of &2, and so on.
    >
    ... clearly explaining that SQL*Plus substitutes the substitution variables &1, &2 etc. in the script with the passed in arguments.
    Your script was including a Unix style substitution, not an SQL*Plus script substitution, so that's seems to be the most likely cause of your problem.
    And still you haven't come back to say whether it's worked for you or not... leaving others guessing as to whether you still need help.

  • SQLPlus Return Values

    Hi there. I am writing a DOS batch script that calls SQLPlus and I want to be able to have SQLPlus return a value back to the DOS batch script. My sql calls a User-defined function that returns different values based on various inputs. I have seen examples of how to return error codes (not values) in Unix, but NOT values in DOS. Any help would be appreciated.
    Mike

    Try a script like mytest.bat:
      @echo off
      sqlplus -s /nolog @mytest.sql
      echo Error is %ERRORLEVEL%Where mytest.sql is:
      prompt In mytest.sql
      exit 1

  • Spool Error capture question

    Hi,
    I am trying to spool data from tables into flat files. I am using the following scripts to accomplish it
    1. A cmd file (windows) that makes a call to a sql file
    2. The SQL file which generates another query file at the run time, depending upon the table name passed to it
    3. The run time query file , that executes the final query and spools the data into a txt file | delimited
    For eg:
    Actual command passed C:\Spool_utility\spool_utility TABLE_NAME
    Eg of the spool utility file :
    @echo off
    SET dbuser=XX@YY
    SET dbpw=xxxx
    echo %date% - %time% - Start > %1%log.txt
    echo START
    sqlplus -s %dbuser%/%dbpw% @spool_utility.sql %1>%1.txt
    echo %date% - %time% - Done >> %1%log.txt
    echo DONE
    Eg of the spool_utility.sql
    set echo off
    SET newpage 0
    SET feedback off
    SET linesize 32767
    set pagesize 0
    SET wrap off
    SET recsep off
    SET con off
    SET trim on
    SET trims on
    set verify off
    SET doc off
    SET termout off
    SET arraysize 5000
    SET HEADING off
    set colsep "|"
    spool &1.sql;
    Prompt Select * from &1 where some condition
    spool off
    set termout ON
    @ &1
    EXIT
    The above file generates a table_name.sql file with the actual table name at run time and gets executed and the output is written to the table_name.txt file.
    This works perfectly fine. But the issue is when someone passes some wrong table name or if there is a actual run time error while executing the query , the error with details itself itself gets written to the end spool file.
    For eg : if i do this just to generate an error and execute it from command line, the query generates an error and writes the error to the spool file , but at the command prompt where I executed the command I do not see any error and the process seems to have run perfectly well
    set xxx on xxx off as above
    spool &1.sql;
    Prompt Select * from &1 where rownum><10---this will cause the issue
    spool off
    set termout ON
    @ &1
    EXIT
    Eg of spool file generated :
    from     table_name WHERE rownum><=10 *
    ERROR at line 62:
    ORA-00936: missing expression
    My question is, is there any way i can capture this runtime error and return this error to my calling sql script spool_utility.sql and then propagate it to the calling command file and do some tasks for eg removing the spool file and writing the actual error to a log file . Basically any way to know at my OS calling level that the entire spooling operation was unsuccessful.
    Thanks

    Thanks for the reply.
    Querying the data dictionary will work only when the issue is a invalid table name. My question is can i capture any run time error, not only incorrect table name.
    If there is any run time error (for eg the one I showed where I used a >< sign which is a invalid operator) the error gets written to my spool file, but there is no way I am able to capture that in my calling sql script and subsequently in the calling command file so that I can do something with the error. For eg if a spool file may get written with error messages, some batch process or user may pick up the spool file and start processing which i dont want to happen. i would like to trap that error or at least be notified of the error at my outer calling sql file or outer command file level, so that I can write the error to a log file and delete the erroneous spool file etc.

  • Getting Autotrace of a sql on forms6i screen

    Hi,
    The sql scripts from forms 6i against 10G database are running fine when we click on a forms button..
    But why this Ora-00904 error comes along with the scripts results on forms 6i screen. You can see it below
    Below you find the complete code which I am using on WBPT.
    If you have suggestion about improving this code please let me know. I am a single
    person whoc is doing this.
    Your suggestion will be appreciated.
    Thanks
    Insbor
    Following result was generate on forms screen with ORA-00904: "POSITION" error
    Forms Screen
    ERROR:
    ORA-00904: "POSITION": invalid identifier
    Error enabling EXPLAIN report
    Statistics
    0 recursive calls
    0 db block gets
    8646 consistent gets
    45 physical reads
    0 redo size
    775383 bytes sent via SQL*Net to client
    356955 bytes received via SQL*Net from client
    3214 SQL*Net roundtrips to/from client
    0 sorts (memory)
    0 sorts (disk)
    48188 rows processed
    My code on forms button wbpt:
    Declare
    in_file Text_IO.File_Type;
    linebuf VARCHAR2(1800);
    output varchar2(1000);
    /* New Parameter define for form_ddl */
    v_create_table_sql varchar2(2000);
    v_test number;
    un VARCHAR2(80);
    pw VARCHAR2(80);
    cn VARCHAR2(80);
    BEGIN
    Get_Connect_Info(un,pw,cn);
    v_create_table_sql := 'Create table plan_table (STATEMENT_ID varchar2(30),'||
    'PLAN_ID NUMBER ,'|| 'TIMESTAMP DATE ,'|| 'remarks varchar2(80),'||
    'operation varchar2(30),'||'options varchar2(30),'||'object_owner varchar2(30),'
    ||'object_name varchar2(30),'||'optimizer varchar2(255),'||'search_columns number,'
    ||'id number(38),' ||'parent_id number(38),'
    ||'cost number(38),'||'cardinality number(38))';
    select count(*) into v_test
    from all_objects
    where object_name = 'PLAN_TABLE'
    and owner in (user,'PUBLIC');
    if v_test = 0 then
    forms_ddl(v_create_table_sql);
    Forms_DDL('grant select on plan_table to public');
    Forms_DDL('create public synonym plan_table for plan_table');
    Forms_DDL('create role plustrace');
    Forms_DDL('grant select on v_$sesstat to plustrace');
    Forms_DDL('grant select on v_$statname to plustrace') ;
    Forms_DDL('grant select on v_$session to plustrace') ;
    Forms_DDL('grant plustrace to dba with admin option') ;
    Forms_DDL('grant plustrace to public') ;
    end if;
    if v_test <> 0 then
    forms_ddl('delete from plan_table ');
    Forms_DDL ('commit');
    end if;
    IF NOT Form_Success THEN
    Message ('Table Creation Failed');
    ELSE
    null;
    -- Message ('Table Created');
    END IF;
    --Old Work
    in_file := Text_IO.Fopen('c:\explain_plus\misc\create_ascript3.bat', 'w');
    Text_IO.Put_Line(in_file, linebuf);
    Text_IO.put_line(in_file,' ');
    Text_IO.put_line(in_file,' @echo off');
    Text_IO.put_line(in_file,' ');
    Text_IO.put_line(in_file,' set connect_db=%1 ' );
    Text_IO.put_line(in_file,' ');
    Text_IO.put_line(in_file,' if exist connect_DB == goto usage ');
    Text_IO.put_line(in_file,' ');
    Text_IO.put_line(in_file,' echo " sqlplus %connect_db% @c:\explain_plus\misc\auto_trace.txt" > c:\explain_plus\misc\runauto.txt ');
    Text_IO.put_line(in_file,' ');
    Text_IO.put_line(in_file,' :end ');
    Text_IO.put_line(in_file,' ');
    Text_IO.put_line(in_file,' set connect_db= ');
    Text_IO.put_line(in_file,' ');
    Text_IO.FCLOSE(in_file);
    in_file := Text_IO.Fopen('c:\explain_plus\misc\create_ascript4.bat', 'w');
    Text_IO.Put_Line(in_file, linebuf);
    Text_IO.put_line(in_file,' ');
    Text_IO.put_line(in_file,' @echo off');
    Text_IO.put_line(in_file,' ');
    Text_IO.put_line(in_file,' set connect_db=%1 ' );
    Text_IO.put_line(in_file,' ');
    Text_IO.put_line(in_file,' if exist connect_DB == goto usage ');
    Text_IO.put_line(in_file,' ');
    Text_IO.put_line(in_file,' echo " sqlplus %connect_db% @c:\explain_plus\misc\raw_Explain.txt" > c:\explain_plus\misc\run_explain.txt ');
    Text_IO.put_line(in_file,' ');
    Text_IO.put_line(in_file,' :end ');
    Text_IO.put_line(in_file,' ');
    Text_IO.put_line(in_file,' set connect_db= ');
    Text_IO.put_line(in_file,' ');
    Text_IO.FCLOSE(in_file);
    in_file := Text_IO.Fopen('c:\explain_plus\misc\del_all.bat', 'w');
    Text_IO.Put_Line(in_file, linebuf);
    Text_IO.put_line(in_file,' ');
    Text_IO.put_line(in_file,' @echo off');
    Text_IO.put_line(in_file,' ');
    Text_IO.put_line(in_file,' del /s /q c:\explain_plus\misc\* ');
    Text_IO.put_line(in_file,' ');
    Text_IO.FCLOSE(in_file);
    in_file := Text_IO.Fopen('c:\explain_plus\misc\raw_explain.txt', 'w');
    Text_IO.Put_Line(in_file, linebuf);
    Text_IO.put_line(in_file,' set trimspool on ');
    Text_IO.put_line(in_file,' set heading off ');
    Text_IO.put_line(in_file,' set feedback off ');
    Text_IO.put_line(in_file,' set echo off');
    Text_IO.put_line(in_file,' EXPLAIN PLAN FOR ');
    Text_IO.put(in_file, :sql.sql);
    Text_IO.put_line(in_file,' ; ' );
    Text_IO.put_line(in_file,' ');
    Text_IO.put_line(in_file,' exit');
    Text_IO.FCLOSE(in_file);
    in_file := Text_IO.Fopen('c:\explain_plus\misc\auto_trace.txt', 'w');
    Text_IO.Put_Line(in_file, linebuf);
    Text_IO.put_line(in_file,' set trimspool on ');
    Text_IO.put_line(in_file,' set heading off ');
    Text_IO.put_line(in_file,' set feedback off ');
    Text_IO.put_line(in_file,' set echo off');
    Text_IO.put_line(in_file,' spool c:\explain_plus\misc\traceonly.txt');
    Text_IO.put_line(in_file,' set autotrace traceonly ');
    Text_IO.put_line(in_file,' ');
    Text_IO.put(in_file, :sql.sql);
    Text_IO.put_line(in_file,' ; ' );
    Text_IO.put_line(in_file,' ');
    Text_IO.put_line(in_file,' spool off');
    Text_IO.put_line(in_file,' set autotrace off ');
    Text_IO.put_line(in_file,' exit');
    Text_IO.FCLOSE(in_file);
    output:='c:\explain_plus\misc\create_ascript3.bat '||un||'/'||pw||'@'||cn ;
    Host(output,no_screen);
    output:='sqlplus -s system/manager @c:\explain_plus\misc\runauto.txt' ;
    Host(output,no_screen);
    output:='c:\explain_plus\misc\create_ascript4.bat '||un||'/'||pw||'@'||cn ;
    Host(output,no_screen);
    output:='sqlplus -s system/manager @c:\explain_plus\misc\run_explain.txt' ;
    Host(output,no_screen);
    set_'Explain Plan','You are going to generate explain plan for that SQL. ');
    exception
    WHEN OTHERS
    THEN
    message('Error occured');
    If Text_IO.is_open(in_file) then
    Text_IO.Fclose(in_file);
    output:='c:\explain_plus\misc\del_all.bat';
    host(output,no_screen);
    End if;
    end;

    Hi,
    Now my application of getting explain plan of a sql is running fine.
    But during running, one script which is written inside the wbp trigger, I manually close the forms plus80.sql screen, which is cumbersome. Could someone suggest me what changes I will do in the code in order to terminate this plus80.sql forms screen automatically.
    Thanks
    Insbor.
    My code as I posted earlier
    Declare
    in_file Text_IO.File_Type;
    linebuf VARCHAR2(1800);
    output varchar2(1000);
    /* New Parameter define for form_ddl */
    v_create_table_sql varchar2(2000);
    v_test number;
    un VARCHAR2(80);
    pw VARCHAR2(80);
    cn VARCHAR2(80);
    BEGIN
    Get_Connect_Info(un,pw,cn);
    select count(*) into v_test
    from all_objects
    where object_name = 'PLAN_TABLE'
    and owner in (user,'PUBLIC');
    if v_test = 0 then
    forms_ddl(v_create_table_sql);
    end if;
    if v_test <> 0 then
    forms_ddl('delete from plan_table ');
    Forms_DDL ('commit');
    end if;
    IF NOT Form_Success THEN
    Message ('Table Creation Failed');
    ELSE
    null;
    -- Message ('Table Created');
    END IF;
    --Old Work
    in_file := Text_IO.Fopen('c:\explain_plus\misc\create_ascript3.bat', 'w');
    Text_IO.Put_Line(in_file, linebuf);
    Text_IO.put_line(in_file,' ');
    Text_IO.put_line(in_file,' @echo off');
    Text_IO.put_line(in_file,' ');
    Text_IO.put_line(in_file,' set connect_db=%1 ' );
    Text_IO.put_line(in_file,' ');
    Text_IO.put_line(in_file,' if exist connect_DB == goto usage ');
    Text_IO.put_line(in_file,' ');
    Text_IO.put_line(in_file,' echo host " sqlplus -s %connect_db% @c:\explain_plus\misc\auto_trace.txt" > c:\explain_plus\misc\runauto.txt ');
    Text_IO.put_line(in_file,' ');
    Text_IO.put_line(in_file,' :end ');
    Text_IO.put_line(in_file,' ');
    Text_IO.put_line(in_file,' set connect_db= ');
    Text_IO.put_line(in_file,' ');
    Text_IO.FCLOSE(in_file);
    in_file := Text_IO.Fopen('c:\explain_plus\misc\create_ascript4.bat', 'w');
    Text_IO.Put_Line(in_file, linebuf);
    Text_IO.put_line(in_file,' ');
    Text_IO.put_line(in_file,' @echo off');
    Text_IO.put_line(in_file,' ');
    Text_IO.put_line(in_file,' set connect_db=%1 ' );
    Text_IO.put_line(in_file,' ');
    Text_IO.put_line(in_file,' if exist connect_DB == goto usage ');
    Text_IO.put_line(in_file,' ');
    Text_IO.put_line(in_file,' echo host " sqlplus -s %connect_db% @c:\explain_plus\misc\raw_Explain.txt" > c:\explain_plus\misc\run_explain.txt ');
    Text_IO.put_line(in_file,' ');
    Text_IO.put_line(in_file,' :end ');
    Text_IO.put_line(in_file,' ');
    Text_IO.put_line(in_file,' set connect_db= ');
    Text_IO.put_line(in_file,' ');
    Text_IO.FCLOSE(in_file);
    in_file := Text_IO.Fopen('c:\explain_plus\misc\raw_explain.txt', 'w');
    Text_IO.Put_Line(in_file, linebuf);
    Text_IO.put_line(in_file,' set trimspool on ');
    Text_IO.put_line(in_file,' set heading off ');
    Text_IO.put_line(in_file,' set feedback off ');
    Text_IO.put_line(in_file,' set echo off');
    Text_IO.put_line(in_file,' EXPLAIN PLAN FOR ');
    Text_IO.put(in_file, :sql.sql);
    Text_IO.put_line(in_file,' ; ' );
    Text_IO.put_line(in_file,' ');
    Text_IO.put_line(in_file,' exit');
    Text_IO.FCLOSE(in_file);
    in_file := Text_IO.Fopen('c:\explain_plus\misc\auto_trace.txt', 'w');
    Text_IO.Put_Line(in_file, linebuf);
    Text_IO.put_line(in_file,' set trimspool on ');
    Text_IO.put_line(in_file,' set heading off ');
    Text_IO.put_line(in_file,' set feedback off ');
    Text_IO.put_line(in_file,' set echo off');
    Text_IO.put_line(in_file,' spool c:\explain_plus\misc\traceonly.txt');
    Text_IO.put_line(in_file,' set autotrace traceonly ');
    Text_IO.put_line(in_file,' ');
    Text_IO.put(in_file, :sql.sql);
    Text_IO.put_line(in_file,' ; ' );
    Text_IO.put_line(in_file,' ');
    Text_IO.put_line(in_file,' spool off');
    Text_IO.put_line(in_file,' set autotrace off ');
    Text_IO.put_line(in_file,' exit');
    Text_IO.FCLOSE(in_file);
    output:='c:\explain_plus\misc\create_ascript3.bat '||un||'/'||pw||'@'||cn ;
    Host(output,no_screen);
    output:='sqlplus -s system/manager @c:\explain_plus\misc\runauto.txt' ;
    Host(output,no_screen);
    output:='c:\explain_plus\misc\create_ascript4.bat '||un||'/'||pw||'@'||cn ;
    Host(output,no_screen);
    output:='sqlplus -s system/manager @c:\explain_plus\misc\run_explain.txt' ;
    Host(output,no_screen);
    exception
    WHEN OTHERS
    THEN
    message('Error occured');
    If Text_IO.is_open(in_file) then
    Text_IO.Fclose(in_file);
    output:='c:\explain_plus\misc\del_all.bat';
    host(output,no_screen);
    End if;
    end;

  • Need help in execution of script

    Dear experts,
    We have a central database 10g installed on windows server 2008. We have 47 sites and each site has its own database. We created Materialized views in central DB which collect data from all 47 sites. We have a script to refresh these Materialized views. The problem is this when one/ some sites down, the script halts/stop working at that specific point. We want a script which skip that specific (down) site. following is some part of the script.
    start "" /wait /min cmd.exe /c "echo.|sqlplus.exe -S system/password @E:\scripts\CMM\CMM_DIRECTION\CMM_DIRECTION_AFLAGDB.SQL"
    start "" /wait /min cmd.exe /c "echo.|sqlplus.exe -S system/password@rrdb @E:\scripts\CMM\CMM_DIRECTION\CMM_DIRECTION_SLAYELDB.SQL"
    start "" /wait /min cmd.exe /c "echo.|sqlplus.exe -S system/password@rrdb @E:\scripts\CMM\CMM_DIRECTION\CMM_DIRECTION_DWASERDB.SQL"
    (note: AFLAG, SLAYEL & DWASER specifying the site name). Please experts help me in this concern.

    Probably the wrong forum for this question.
    My guess would be that you need to add some sort of check to see if the site is up before running the refresh.
    What is meant by having the site down?
    What kind of script is this?
    If it's a batch script:
    Batch script to test if Oracle instance is up on windows 2003
    Use that and loop through a text files of entries to try to connect to.
    Or you could probably do everything in a PL/SQL stored procedure if links are setup.  Having little idea what is in those SQL scripts I can't say whether or not this would be a good idea.
    There it would be a matter of testing the link by querying dual through the link and handling the particular exception(s) of a bad link properly.
    It would also reduce dependency on several script files.
    Looping through the instances would also probably be easier through a procedure.

  • Insert into a table using UNIX

    i have file Summary.txt
    contants looks like this
    ./log_CS-185.lst:Error detected, rollbacking
    ./log_CS-13603.lst:Error detected, rollbacking
    ./log_CS-1002.lst:Error detected, rollbacking
    now i have to parse this file to get (CS-185,CS-13603,CS-1002)
    and insert these vlaues into a table... how do i do this using unix script ?..

    i have to parse this file to get (CS-185,CS-13603,CS-1002)
    and insert these vlaues into a table... how do i do this using unix script ?..Example :$ cat read_Sum.sh
    cat Summary.txt | while read LINE
    do
            VAR=`echo $LINE | awk -F_ '{print $2}' | awk -F. '{print $1}'`
            echo $VAR
            sqlplus -s test/test << EOF
            insert into summary values('$VAR');
            exit
    EOF
    done
    $ ./read_Sum.sh
    CS-185
    1 row created.
    CS-13603
    1 row created.
    CS-1002
    1 row created.
    $ sqlplus test/test
    SQL*Plus: Release 10.2.0.3.0 - Production on Thu May 19 13:32:40 2011
    Copyright (c) 1982, 2006, Oracle.  All Rights Reserved.
    Connected to:
    Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - Production
    With the Partitioning, OLAP and Data Mining options
    SQL> select * from summary;
    CODE
    CS-185
    CS-13603
    CS-1002
    SQL>

  • Shell script for DB

    Hi,
    I have written shell script for below scenarios, can you please guide me to write this as correct way, requirment is,
    1. i need to connect the database which is on unix server , but before connecting the DB some of the files needs to be removed from \tmp directory.
    2. once removed the script need to connect the database and call the sql file which is in \tmp directory.
    3. the output files will be stored in \tmp directory start with DB name.
    4. finally csv files needs to be transferred to local windows with help of FTP. please find below the script
    #!/bin/sh
    rm -f /tmp/dbmon/DB1*
    CONNSTRING=username/PASSWORD@service
    sqlplus -s $CONNSTRING @/tmp/STATS.sql << EOF
    EXIT;
    EOF
    HOST='xxxxx'
    USER='xxxxx'
    PASSWD='xxxxxx'
    FILE='E:\STATS\DB1.*'
    cd /tmp/dbmon
    ftp -n -v $HOST << EOT
    user $USER $PASSWD
    prompt
    mput $FILE
    bye
    EOT
    EXIT;
    EOF
    Thanks
    Edited by: ASP on Nov 18, 2011 4:45 PM

    Hi ASP
    It's always a good idea to write entries to timestamped log file without which you will never know where the script went wrong or failed.
    This is not tested but just a small example
    #!/bin/sh
    export LOG_DIR=/tmp/log
    export LOGFILE=$LOG_DIR/`basename $0`_${TIMESTAMP}.log
    if [ ! -d $LOG_DIR ]
    then
         mkdir $LOG_DIR
    fi
    echo "Removing the temporary files from /tmp/dbmon at `date +%Y%m%d_%H:%M:%S`" | tee -a $LOG_FILE
    rm -f /tmp/dbmon/DB1*
    CONNSTRING=username/PASSWORD@service
    echo "Run SQLPlus file" | tee -a $LOG_FILE
    sqlplus -s $CONNSTRING @/tmp/STATS.sql << EOF
    EXIT;
    EOF
    echo "Now FTP the files to windows box " | tee -a $LOG_FILE
    HOST='xxxxx'
    USER='xxxxx'
    PASSWD='xxxxxx'
    cd /tmp/dbmon
    ftp -vn $HOST <<EOF
    quote USER $USER
    quote PASS $PASSWD
    ascii
    cd E:\STATS
    mput DB1.*
    bye
    EOF

  • After successfull installation problem in startup!

    Dear All,
    I have installed oracle 11gR1 on centOS. Have also set Oracle Paths.
    After this I logged on to sqlplus...
    and when I try to startup database I got the following error:
    ORA-01078: failure in processing system parameters
    LRM-00109: could not open parameter file '/u01/app/oracle/product/11.1.0/db_1/dbs/initbssglbrpl.ora'
    However file spfilebssglbrp.ora exists in dbs folder.
    I tried to create spfile from pfile and error was the same.
    How to rectify this error, please guide.
    regards, Imran Baig

    misterimran wrote:
    Dear All,
    I have installed oracle 11gR1 on centOS. Have also set Oracle Paths.
    After this I logged on to sqlplus...
    and when I try to startup database I got the following error:
    ORA-01078: failure in processing system parameters
    LRM-00109: could not open parameter file '/u01/app/oracle/product/11.1.0/db_1/dbs/initbssglbrpl.ora'
    However file spfilebssglbrp.ora exists in dbs folder.
    I tried to create spfile from pfile and error was the same.
    How to rectify this error, please guide.
    regards, Imran BaigHi Imran
    Could you post all output from SQL*PLus? If that file is at /dbs folder, then Oracle should find it. Please post the output of the following commands:
    ls -lh /u01/app/oracle/product/11.1.0/db_1/dbs/initbssglbrpl.ora
    echo $ORACLE_SID
    sqlplus "/ as sysdba"
    startup
    OR
    startup pfile='/u01/app/oracle/product/11.1.0/db_1/dbs/initbssglbrpl.ora';

  • Issue with sqlplus_exec_template.sql

    Hi all,
    I am trying to run a process flow using sqlplus_exec_template.sql, through a .bat file. I am getting the following errors:
    PLS-00201: identifier 'WB_RT_API_EXEC.RESULT_FAILURE' must be declared
    PLS-00201: identifier 'WB_RT_API_EXEC.RUN_TASK' must be declared
    I am using SQL*Plus: Release 10.2.0.3.0 and Oracle Database 10g 10.2.0.4.0
    I searched in other threads, but I could not find an answer.
    Thanks!
    Sebastian

    Hi Oleg,
    Thanks for the reply.
    If I got the idea of the template, would be required to type in the script the register Warehouse builder user?
    This current script contains the following code (and the execution of it gets the above errors):
    @echo off
    SQLPLUS USERNAME/PASSWORD@SERVER @sqlplus_exec_template.sql etc.etc
    Or am I missing something? Thanks for your help!
    Sebastian

  • Set substitution variable from Sql table

    Hi guys,
    I am new to sql/unix so I hope you can guide me in the right direction.
    whats the easiest way to update an essbase subvar from a sql table?
    would I have to write a sqlplus statement to output the variable to file,
    read the file in a maxl command and set the variable and call these commands using .sh script and esscmd?
    is there a more efficient way to set the variable? e.g only use sqlplus and esscmd?
    thanks in advance,

    Try something like this
    echo off
    sqlplus -s username/passwordusername/password@server/SID:@server/SID:port @test.sql > variable.txt
    for /f "usebackq delims=" %%a in (variable.txt) do set CurrentMonth=%%a
    echo %CurrentMonth%
    See whether you are getting the correct month.
    Regards
    Celvin
    http://www.orahyplabs.com

  • ULTRA SEARCH 10G 서버 콤포넌트를 수동으로 설치, 설치 해제하는 방법

    제품 : ORACLE SERVER
    작성날짜 : 2005-11-29
    ULTRA SEARCH 10G 서버 콤포넌트를 수동으로 설치, 설치 해제하는 방법
    =============================================
    PURPOSE
    이 문서는, Ultra Search 10G를 수동으로 설치하거나 설치 해제하는 방법을
    기술하고 있다.
    Explanation
    1. 수동 설치 절차
    1) Oracle Text와 JVM이 정상적으로 설치되어 있는지 확인한다. 관련된
    정보는 다음 문서에 기술 되어 있다
    Bulletin No: 22844 Oracle Text 10gR1의 수동 설치와, 설치 해제 방법
    2) OS 프롬프트에서 다음 디렉토리로 이동한다
    At the OS prompt, change to the following directory:
    Unix: $ORACLE_HOME/ultrasearch/admin
    Windows: $ORACLE_HOME\ultrasearch\admin
    3) JVM이 정상적으로 설치 되어 있는지 확인한다. Oracle JVM 설치 절차와 관련
    해더는 다음 문서를 참조한다 :
    Note 276554.1 <How to Reload the JVM in 10.1.0.X>
    4) SQLPlus를 사용하여, SYSDBA 권한을 가지고 SYS 계정으로 데이터베이스 연결한다.
    5) wk0install.sql SQL script를 실행시킨다.
    파라미터 요약:
    -- SYS = "&1" <== sys 유저 명: SYS
    -- SYSPW = "&2" <== sys 유저의 패스워드: (예 change_on_install)
    -- WKSYSPW = "&3" <== WKSYS 유저의 패스워드: (예 wksys)
    -- WK_TABLESPACE = "&4" <== WKSYS의 default tablespace: (예 SYSAUX)
    -- WK_TEMPTABLESPACE = "&5" <== WKSYS의 temporary tablespace: (예 TEMP)
    -- CONN_STRING = "&6" <== non-RAC instance 환경에서 Ultra Search를 설치할 경우
    null string을 지정 : (예 "")
    RAC 환경에서 설치할 경우 TNS descriptor: (예 <host name>:<port number>:<SID>
    - 또는 -
    (DESCRIPTION=(LOAD_BALANCE=yes)(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)
    (HOST=cls02a)(PORT=3999)) (ADDRESS=(PROTOCOL=TCP)(HOST=cls02b)(PORT=3999)))
    (CONNECT_DATA=(SERVICE_NAME=acme.us.com)))" )
    -- PORTAL_USER = "&7" <== Portal 유저. Portal을 사용하지 않는다면 null string 입력: (예 "")
    -- LAUNCH_ANYWHERE = "&8" <== TRUE 또는 FALSE; Clustered File System (CFS)을 사용하는
    RAC일 경우에만 TRUE 지정한다. 그외의 경우 FALSE: (예 FALSE)
    다음과 같은 명령 실행을 통해 Ultra Search 데이터베이스 패케지를 설치한다:
    SQLPLUS> set echo on
    SQLPLUS> spool ultrasearch_inst.log
    SQLPLUS> @$ORACLE_HOME/ultrasearch/admin/wk0install.sql SYS change_on_install wksys SYSAUX TEMP "" "" FALSE
    SQLPLUS> spool off
    SQLPLUS> exit
    6) wk0install.sql 스크립트를 실행하는데 에러가 발생하지 않았다면 수동
    설치는 성공한 것이다.
    7) wk0install.sql 스크립트를 실행하여 설치 후에는 객체의 갯수를 확인한다
    SQL> SELECT COUNT(*) FROM DBA_OBJECTS
    WHERE OWNER = 'WKSYS';
    COUNT(*)
    351
    참고: 대략 351개의 객체가 생성되어야 한다.
    SQL> SELECT COUNT(*) FROM DBA_OBJECTS
    WHERE OWNER = 'WKSYS' AND STATUS = 'INVALID';
    COUNT(*)
    0
    참고: invalid 상태의 객체가 없아야 한다.
    2. 수동 설치 해제 절차
    1) Ultra Search Schema (WKSYS) 설치 해제와 관련된 절차는 9.2.x 매뉴얼에 기술된
    내용과 동일하다. (Bulletin No: 21563 ULTRA SEARCH 수동 설치 및 제거 (9.2.0.1)
    의 내용을 참고한다. )
    2) OS 프롬프트에서 다음 디렉토리로 이동한다.
    Unix: $ORACLE_HOME/ultrasearch/admin
    Windows: $ORACLE_HOME\ultrasearch\admin
    3) SQLPlus를 사용하여, SYSDBA 권한을 가지고 SYS 계정으로 데이터베이스 연결한다.
    4) WKSYS 유저가 데이터베이스에 연결 된 상태가 아닌지 확인한다. 만약 WKSYS 사용자가
    연결된 상태라면, 해당 세션을 죽이거나, 세션이 종료 될 때 까지 기다린다:
    SELECT SID, SERIAL#, OSUSER FROM V$SESSION
    WHERE USERNAME = 'WKSYS';
    5) wk0deinst.sql SQL 스크립트를 실행시킨다.
    파라미터 요약:
    -- SYS = "&1" <== sys 유저 명: SYS
    -- SYSPW = "&2" <== sys 유저의 패스워드: (예 change_on_install)
    -- CONN_STRING = "&3" <== non-RAC instance 환경에서 Ultra Search를 설치할 경우
    null string을 지정 : (예 "")
    RAC 환경에서 설치할 경우 TNS descriptor: (예 <host name>:<port number>:<SID>
    - 또는 -
    (DESCRIPTION=(LOAD_BALANCE=yes)(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)
    (HOST=cls02a)(PORT=3999)) (ADDRESS=(PROTOCOL=TCP)(HOST=cls02b)(PORT=3999)))
    (CONNECT_DATA=(SERVICE_NAME=acme.us.com)))" )
    Ultra Search 데이터베이스 패키지를 다음 명령을 이용하여 설치 해제한다:
    SQLPLUS> set echo on
    SQLPLUS> spool ultrasearch_deinst.log
    SQLPLUS> @$ORACLE_HOME/ultrasearch/admin/wk0deinst.sql SYS
    change_on_install ""
    SQLPLUS> spool off
    SQLPLUS> exit
    6) 만약 wk0deinst.sql 스크립트를 실행하는 과정에서 에러가 발생하지 않았다면, WKSYS에
    대한 수동 설치 해제는 성공적으로 종료된 것이다.
    Example
    Reference Documents
    Note 283292.1 How to Manually Install and Uninstall Ultra Search 10G Server Components

  • Issue connecting to a second instance on a Oracle Linux Box.

    Hi all. I have the following scenario.
    - Two Oracle versions and instances on the same box (10g Rel2 and 11g Rel2).
    - Due to lack of disk space i installed 11g on another ORACLE_BASE / ORACLE_HOME:
    - Initial enviroment (10g):
    [oracle@VM1 ~]$ echo $ORACLE_BASE
    /home/oracle/app
    [oracle@VM1 ~]$ echo $ORACLE_HOME
    /home/oracle/app/OraDb10g
    [oracle@VM1 ~]$ echo $ORACLE_SID
    BETA
    [oracle@VM1 ~]$ echo $PATH
    /home/oracle/app/OraDb10g/bin:/usr/kerberos/bin:/usr/local/bin:/bin:/usr/bin
    - 11g related values:
    [oracle@VM1 oracle]$ echo $ORACLE_BASE
    /u01/oracle
    [oracle@VM1 oracle]$ echo $ORACLE_HOME
    /u01/oracle/Oradb11g
    [oracle@VM1 oracle]$ echo $ORACLE_SID
    ALFA
    [oracle@VM1 oracle]$ echo $PATH
    /u01/oracle/Oradb11g/bin:/usr/kerberos/bin:/usr/local/bin:/bin:/usr/bin
    [oracle@VM1 oracle]$
    Both databases are running including :
    - listener 1521 for 10g and 1525 for 11g-
    *10g:*
    [oracle@VM1 ~]$ lsnrctl status
    LSNRCTL for Linux: Version 10.2.0.4.0 - Production on 04-JAN-2013 06:42:27
    Copyright (c) 1991, 2007, Oracle. All rights reserved.
    Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=VM1.rioturbio.com.ve)(*PORT=1521*)))
    STATUS of the LISTENER
    Alias LISTENER
    Version TNSLSNR for Linux: Version 10.2.0.4.0 - Production
    Start Date 04-JAN-2013 05:25:12
    Uptime 0 days 1 hr. 17 min. 14 sec
    Trace Level off
    Security ON: Local OS Authentication
    SNMP OFF
    Listener Parameter File /home/oracle/app/OraDb10g/network/admin/listener.ora
    Listener Log File /home/oracle/app/OraDb10g/network/log/listener.log
    Listening Endpoints Summary...
    (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=VM1.rioturbio.com.ve)(PORT=1521)))
    (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC0)))
    Services Summary...
    Service "*BETA.azucarera_rioturbio.com.ve*" has 1 instance(s).
    Instance "BETA", status READY, has 1 handler(s) for this service...
    Service "BETAXDB.azucarera_rioturbio.com.ve" has 1 instance(s).
    Instance "BETA", status READY, has 1 handler(s) for this service...
    Service "BETA_XPT.azucarera_rioturbio.com.ve" has 1 instance(s).
    Instance "BETA", status READY, has 1 handler(s) for this service...
    Service "PLSExtProc" has 1 instance(s).
    Instance "PLSExtProc", status UNKNOWN, has 1 handler(s) for this service...
    The command completed successfully
    [oracle@VM1 ~]$
    *11g:*
    [oracle@VM1 oracle]$ lsnrctl status
    LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 04-JAN-2013 06:43:25
    Copyright (c) 1991, 2009, Oracle. All rights reserved.
    Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=VM1.rioturbio.com.ve)(*PORT=1525*)))
    STATUS of the LISTENER
    Alias LISTENER
    Version TNSLSNR for Linux: Version 11.2.0.1.0 - Production
    Start Date 04-JAN-2013 05:23:02
    Uptime 0 days 1 hr. 20 min. 22 sec
    Trace Level off
    Security ON: Local OS Authentication
    SNMP OFF
    Listener Parameter File /u01/oracle/Oradb11g/network/admin/listener.ora
    Listener Log File /u01/oracle/diag/tnslsnr/VM1/listener/alert/log.xml
    Listening Endpoints Summary...
    (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=VM1.rioturbio.com.ve)(PORT=1525)))
    Services Summary...
    Service "*ALFA.rioturbio.com.ve*" has 1 instance(s).
    Instance "ALFA", status READY, has 1 handler(s) for this service...
    Service "ALFAXDB.rioturbio.com.ve" has 1 instance(s).
    Instance "ALFA", status READY, has 1 handler(s) for this service...
    The command completed successfully
    [oracle@VM1 oracle]$
    - Instances and Enterprise Manager Database Control:
    *10g:*
    [oracle@VM1 ~]$ emctl status dbconsole
    TZ set to US/Eastern
    Oracle Enterprise Manager 10g Database Control Release 10.2.0.4.0
    Copyright (c) 1996, 2007 Oracle Corporation. All rights reserved.
    https://VM1.rioturbio.com.ve:1158/em/console/aboutApplication
    Oracle Enterprise Manager 10g is running.
    Logs are generated in directory /home/oracle/app/OraDb10g/VM1.rioturbio.com.ve_BETA/sysman/log
    [oracle@VM1 ~]$
    *11g:*
    [oracle@VM1 oracle]$ emctl status dbconsole
    Oracle Enterprise Manager 11g Database Control Release 11.2.0.1.0
    Copyright (c) 1996, 2009 Oracle Corporation. All rights reserved.
    https://VM1.rioturbio.com.ve:5500/em/console/aboutApplication
    Oracle Enterprise Manager 11g is running.
    Logs are generated in directory /u01/oracle/Oradb11g/VM1.rioturbio.com.ve_ALFA/sysman/log
    [oracle@VM1 oracle]$
    The problem happen when i try to access the 11g instance using sqlplus:
    [oracle@VM1 oracle]$ sqlplus / as sysdba
    SQL*Plus: Release 11.2.0.1.0 Production on Fri Jan 4 06:46:55 2013
    Copyright (c) 1982, 2009, Oracle. All rights reserved.
    Connected to an idle instance.
    SQL> show sga
    ORA-01034: ORACLE not available
    Process ID: 0
    Session ID: 0 Serial number: 0
    SQL>
    or
    [oracle@VM1 oracle]$ sqlplus system/Oradba11g
    SQL*Plus: Release 11.2.0.1.0 Production on Fri Jan 4 06:47:43 2013
    Copyright (c) 1982, 2009, Oracle. All rights reserved.
    ERROR:
    ORA-01034: ORACLE not available
    ORA-27101: shared memory realm does not exist
    Linux-x86_64 Error: 2: No such file or directory
    Process ID: 0
    Session ID: 0 Serial number: 0
    Enter user-name:
    However when access is performed using a TNS service connection it works....!
    See:
    [oracle@VM1 oracle]$ sqlplus system/Oradba11g@alfa
    SQL*Plus: Release 11.2.0.1.0 Production on Fri Jan 4 06:48:48 2013
    Copyright (c) 1982, 2009, Oracle. All rights reserved.
    Connected to:
    Oracle Database 11g Release 11.2.0.1.0 - 64bit Production
    SQL> show sga
    Total System Global Area 1043886080 bytes
    Fixed Size 2219952 bytes
    Variable Size 620757072 bytes
    Database Buffers 415236096 bytes
    Redo Buffers 5672960 bytes
    SQL>
    Which seems to be the problem here? Why can't i connect to the 11g instance using sqlplus?. I don't think it is related to enviroment since access can be done using local naming service.
    Please help ...!
    PD: i did not replace scripts on /usr/local/bin when installing 11g.

    myluism wrote:
    Hi all. I have the following scenario.
    See embedded comments below
    - Two Oracle versions and instances on the same box (10g Rel2 and 11g Rel2).
    - Due to lack of disk space i installed 11g on another ORACLE_BASE / ORACLE_HOME:
    - Initial enviroment (10g):
    [oracle@VM1 ~]$ echo $ORACLE_BASE
    /home/oracle/app
    [oracle@VM1 ~]$ echo $ORACLE_HOME
    /home/oracle/app/OraDb10g
    [oracle@VM1 ~]$ echo $ORACLE_SID
    BETA
    [oracle@VM1 ~]$ echo $PATH
    /home/oracle/app/OraDb10g/bin:/usr/kerberos/bin:/usr/local/bin:/bin:/usr/bin
    - 11g related values:
    [oracle@VM1 oracle]$ echo $ORACLE_BASE
    /u01/oracle
    [oracle@VM1 oracle]$ echo $ORACLE_HOME
    /u01/oracle/Oradb11g
    [oracle@VM1 oracle]$ echo $ORACLE_SID
    ALFA
    [oracle@VM1 oracle]$ echo $PATH
    /u01/oracle/Oradb11g/bin:/usr/kerberos/bin:/usr/local/bin:/bin:/usr/bin
    [oracle@VM1 oracle]$
    Both databases are running including :
    - listener 1521 for 10g and 1525 for 11g-
    An unnecessary complication that achieves nothing. A single listener, using the default name LISTENER and the default port 1521 is quite capable of -- WAS DESIGNED TO -- service multiple database instances of multiple versions running from multiple homes. In a multi-version environment, you'll want to use the listener from the highest version.
    *10g:*
    [oracle@VM1 ~]$ lsnrctl status
    LSNRCTL for Linux: Version 10.2.0.4.0 - Production on 04-JAN-2013 06:42:27
    Copyright (c) 1991, 2007, Oracle. All rights reserved.
    Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=VM1.rioturbio.com.ve)(*PORT=1521*)))
    STATUS of the LISTENER
    Alias LISTENER
    Version TNSLSNR for Linux: Version 10.2.0.4.0 - Production
    Start Date 04-JAN-2013 05:25:12
    Uptime 0 days 1 hr. 17 min. 14 sec
    Trace Level off
    Security ON: Local OS Authentication
    SNMP OFF
    Listener Parameter File /home/oracle/app/OraDb10g/network/admin/listener.ora
    Listener Log File /home/oracle/app/OraDb10g/network/log/listener.log
    Listening Endpoints Summary...
    (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=VM1.rioturbio.com.ve)(PORT=1521)))
    (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC0)))
    Services Summary...
    Service "*BETA.azucarera_rioturbio.com.ve*" has 1 instance(s).
    Instance "BETA", status READY, has 1 handler(s) for this service...
    Service "BETAXDB.azucarera_rioturbio.com.ve" has 1 instance(s).
    Instance "BETA", status READY, has 1 handler(s) for this service...
    Service "BETA_XPT.azucarera_rioturbio.com.ve" has 1 instance(s).
    Instance "BETA", status READY, has 1 handler(s) for this service...
    Service "PLSExtProc" has 1 instance(s).
    Instance "PLSExtProc", status UNKNOWN, has 1 handler(s) for this service...
    The command completed successfully
    [oracle@VM1 ~]$
    *11g:*
    [oracle@VM1 oracle]$ lsnrctl status
    LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 04-JAN-2013 06:43:25
    Copyright (c) 1991, 2009, Oracle. All rights reserved.
    Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=VM1.rioturbio.com.ve)(*PORT=1525*)))
    STATUS of the LISTENER
    Alias LISTENER
    Version TNSLSNR for Linux: Version 11.2.0.1.0 - Production
    Start Date 04-JAN-2013 05:23:02
    Uptime 0 days 1 hr. 20 min. 22 sec
    Trace Level off
    Security ON: Local OS Authentication
    SNMP OFF
    Listener Parameter File /u01/oracle/Oradb11g/network/admin/listener.ora
    Listener Log File /u01/oracle/diag/tnslsnr/VM1/listener/alert/log.xml
    Listening Endpoints Summary...
    (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=VM1.rioturbio.com.ve)(PORT=1525)))
    Services Summary...
    Service "*ALFA.rioturbio.com.ve*" has 1 instance(s).
    Instance "ALFA", status READY, has 1 handler(s) for this service...
    Service "ALFAXDB.rioturbio.com.ve" has 1 instance(s).
    Instance "ALFA", status READY, has 1 handler(s) for this service...
    The command completed successfully
    [oracle@VM1 oracle]$
    - Instances and Enterprise Manager Database Control:
    *10g:*
    [oracle@VM1 ~]$ emctl status dbconsole
    TZ set to US/Eastern
    Oracle Enterprise Manager 10g Database Control Release 10.2.0.4.0
    Copyright (c) 1996, 2007 Oracle Corporation. All rights reserved.
    https://VM1.rioturbio.com.ve:1158/em/console/aboutApplication
    Oracle Enterprise Manager 10g is running.
    Logs are generated in directory /home/oracle/app/OraDb10g/VM1.rioturbio.com.ve_BETA/sysman/log
    [oracle@VM1 ~]$
    *11g:*
    [oracle@VM1 oracle]$ emctl status dbconsole
    Oracle Enterprise Manager 11g Database Control Release 11.2.0.1.0
    Copyright (c) 1996, 2009 Oracle Corporation. All rights reserved.
    https://VM1.rioturbio.com.ve:5500/em/console/aboutApplication
    Oracle Enterprise Manager 11g is running.
    Logs are generated in directory /u01/oracle/Oradb11g/VM1.rioturbio.com.ve_ALFA/sysman/log
    [oracle@VM1 oracle]$
    The problem happen when i try to access the 11g instance using sqlplus:
    [oracle@VM1 oracle]$ sqlplus / as sysdba
    SQL*Plus: Release 11.2.0.1.0 Production on Fri Jan 4 06:46:55 2013
    Copyright (c) 1982, 2009, Oracle. All rights reserved.
    Connected to an idle instance.
    What was the setting of ORACLE_SID when you did this?
    SQL> show sga
    ORA-01034: ORACLE not availablewell, of course you get ORACLE not available. It already told you "Connected to an idle instance" . There is no running instance of the current value of ORACLE_SID.
    Process ID: 0
    Session ID: 0 Serial number: 0
    SQL>
    or
    [oracle@VM1 oracle]$ sqlplus system/Oradba11g
    SQL*Plus: Release 11.2.0.1.0 Production on Fri Jan 4 06:47:43 2013
    Copyright (c) 1982, 2009, Oracle. All rights reserved.
    ERROR:
    ORA-01034: ORACLE not available
    ORA-27101: shared memory realm does not exist
    Linux-x86_64 Error: 2: No such file or directory
    Process ID: 0
    Session ID: 0 Serial number: 0
    Enter user-name:
    However when access is performed using a TNS service connection it works....!
    Because when you connect with TNS, you are no longer dependent on the current setting of $ORACLE_SID.
    See:
    [oracle@VM1 oracle]$ sqlplus system/Oradba11g@alfa
    SQL*Plus: Release 11.2.0.1.0 Production on Fri Jan 4 06:48:48 2013
    Copyright (c) 1982, 2009, Oracle. All rights reserved.
    Connected to:
    Oracle Database 11g Release 11.2.0.1.0 - 64bit Production
    SQL> show sga
    Total System Global Area 1043886080 bytes
    Fixed Size 2219952 bytes
    Variable Size 620757072 bytes
    Database Buffers 415236096 bytes
    Redo Buffers 5672960 bytes
    SQL>
    Which seems to be the problem here? Why can't i connect to the 11g instance using sqlplus?. I don't think it is related to enviroment since access can be done using local naming service.Regardless of what you think, It is absolutely, 100% related to your environment settings.
    >
    Please help ...!repeat your above demo, but with this modification
    id
    cat /etc/oratab
    env |grep ORA | sort
    echo $PATH
    sqlplus / as sysdbaIn a multi-db environment, you need to always set your environment before trying to work with any database. The easiest way is to use the oracle utility 'oraenv'
    oracle:orcl$ . oraenv
    ORACLE_SID = [orcl] ? dwsbx
    The Oracle base for ORACLE_HOME=/u01/app/oracle/product/11.2.0/db_1 is /u01/app/oracle
    oracle:dwsbx$ echo $ORACLE_SID
    dwsbx
    oracle:dwsbx$Notice the command is 'dot space oraenv'
    >
    PD: i did not replace scripts on /usr/local/bin when installing 11g.

Maybe you are looking for