Connect SQL Developer, SQL * Plus can't

I installed Oracle Database Development VM VM: VM VirtualBox for developers & lt; / title & gt; & lt; meta name = & quot; Title & quot; content = & quot; VM VirtualBox for developers & q...

Added two adapters, one as a host-only, as NAT.

We add a few entries tnsnames.ora for network database servers.

Developer SQL inside the VM can connect to all three databases: XE, remote_db1 and remote_db2.

SELECT * FROM Dual using a remote connection returns the data immediately.

SQL * Plus inside the VM can connect to XE, but not to a remote server. It hangs just for awhile and finally back: ORA-12545: Connect failed because target host or object does not exist

Outside of the virtual machine (on the host), Developer SQL (database connection Type) and SQL (sqlplus connection string) can connect to all three systems.

What is going on?

Brian Tkatch wrote:

SQL * Plus inside the VM can connect to XE, but not to a remote server. It hangs just for awhile and finally back: ORA-12545: Connect failed because target host or object does not exist

Sounds like the hostname resolution failed.

A host name must be resolved to an IP address. If you use a host name in the TNS connection string, you need to make sure that it can be resolved to an IP address. With the help of the ping command is an easy way to determine if the host name is resolved.

Some listeners (such as remote control and headphones RAC), accepts a connection client and in response redirect the client to a different hostname (and port). For example, a remote listener can serve 10 cases (each with a different service name). The client connects, asking servcice5. The listener redirects the customer to hostname ora-Server5 on port 1521. The customer now tries to connect to ora-Server5, to resolve the hostname to an IP address and then make the call to connect.

If the listener can redirect the customer to a new host name - and the customer must be able to resolve the host name. The error that you get so don't always relates to the connection initial listener. It can also occur when the client driver follows the redirect to the listener and attempt a new connection to a new host.

Tags: Database

Similar Questions

  • How to return an error code of SQL * Plus of PL/SQL procedure

    Hello

    I want to be able to pass a variable back to the Unix script, and I have the following code

    ******************

    sqlplus/myuser mypass < < EOF
    WHENEVER SQLERROR EXIT 41.
    WHENEVER OSERROR EXIT 81;
    execute pkonp.run_onp;
    output
    EXPRESSIONS OF FOLKLORE

    ERRORCODE = $?

    If [$ERRORCODE! = 0] #test for successful onp
    then
    #Notify failure of the administrator of the ONP.
    echo 'Fail ONP to 'date' \n'
    FI

    ******************
    However, I am unable to get my PL/SQL to pass an error code to SQL * more.

    How to catch an error in PL/SQL and pass the SQL error code *, so that SQL * Plus can then pass the error to the Unix Shell script?

    Thank you very much.

    Yes - in a nut shell, you need to convert Oracle codes exception to the process of Linux/Unix/Windows exit codes as the number of exception Oracle is physically too large to fit into an integer to a byte that is used by the operating system for the exit codes.

    The best place to do this would be something like a SQL * more script as is the process real o/s which should only return exit code of the kernel.

  • Can I connect SQL Developer to Essbase?

    I know that tools such as the table can connect to Essbase, but how can I connect Oracle SQL Developer to Essbase?

    You have not, I'm afraid.

    SQL Developer is a development tool for working with databases oracle that supports connections to a set of data bases third-parties for the purposes of specific to oracle migration.

    Third-party databases supported are listed in help, but from memory they are UDB DB2, MS SQl Server, Sybase, MySQL and Teradata.

    Developer SQL is not a tool of multiple databases.

  • not able to connect Toad/sql * plus with ebs R12.2

    Dear experts,

    I have a R12.2 EBS instance with linux 5 (32-bit), but trying to connect to the database using toad / sql * plus of the client machine. his mistake.

    another instance ebs r12.1.1 with the work of database 11g very well,

    Please suggest how I can fix it.

    Database - 11.2.0.3.0

    EBS - R12.2

    OS - release of the Red Hat Enterprise Linux 5.5 Server (Tikanga)

    concerning

    pritesh Rodriguez

    problem is solved.

    using the id of doc metalink 291897.1.

    concerning

    pritesh Rodriguez

  • The SQL * PLUS cannot be connected

    The SQL * PLUS cannot be connected.

    When I try to connect to sqlplus, I get the following error message: ORA-12560: TNS:protocol adapter error
    I have trouble shoot in accordance with what follows the steps, but have not found any problems:
    C:\Documents and Settings\Administrator>sqlplus / as sysdba
    
    SQL*Plus: Release 11.1.0.6.0 - Production on Tue Apr 27 09:45:51 2010
    
    Copyright (c) 1982, 2007, Oracle.  All rights reserved.
    
    ERROR:
    ORA-12560: TNS:protocol adapter error
    
    
    Enter user-name:
    
    C:\Documents and Settings\Administrator>lsnrctl status
    
    LSNRCTL for 32-bit Windows: Version 11.1.0.6.0 - Production on 27-APR-2010 09:37:56
    
    Copyright (c) 1991, 2007, Oracle.  All rights reserved.
    
    Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
    STATUS of the LISTENER
    ------------------------
    Alias                     LISTENER
    Version                   TNSLSNR for 32-bit Windows: Version 11.1.0.6.0 - Production
    Start Date                27-APR-2010 09:35:08
    Uptime                    0 days 0 hr. 2 min. 48 sec
    Trace Level               off
    Security                  ON: Local OS Authentication
    SNMP                      OFF
    Listener Parameter File   F:\app\oracle\product\11.1.0\db_1\network\admin\listener.ora
    Listener Log File         f:\app\oracle\diag\tnslsnr\HOST1\listener\alert\log.xml
    Listening Endpoints Summary...
      (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(PIPENAME=\\.\pipe\EXTPROC1521ipc)))
      (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=HOST1)(PORT=1521)))
    Services Summary...
    Service "db1" has 1 instance(s).
      Instance "db1", status UNKNOWN, has 1 handler(s) for this service...
    The command completed successfully
    
    C:\Documents and Settings\Administrator>tnsping db1
    
    TNS Ping Utility for 32-bit Windows: Version 11.1.0.6.0 - Production on 27-APR-2010 09:38:46
    
    Copyright (c) 1997, 2007, Oracle.  All rights reserved.
    
    Used parameter files:
    F:\app\oracle\product\11.1.0\db_1\network\admin\sqlnet.ora
    
    
    Used TNSNAMES adapter to resolve the alias
    Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = host1)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICA
    TED) (SERVICE_NAME = db1)))
    OK (500 msec)
    
    
    C:\Documents and Settings\Administrator>echo %oracle_sid%
    db1
    The OracleServiceDB1 service and the OracleOraDb11g_home1TNSListener service has already begun.

    If the original instance cannot be deleted, you can try to create a new instance of the same name.

    oradim -new -sid db1
    
  • 30EA2 - SQL Developer Vs Index SQL/Plus functional on column Date

    I just spotted this while using EA3.2, but it may also exist on other versions, I will consider. I'm on a 9i 9.2.0.7 box, but will see if I can recreate on an instance of 10 or 11

    The question is, if I create a shadow table

    CREATE TABLE paul_test
    (
    CREATION_DATE DATE,
    DATE of creation_date2,
    last_updsate_date DATE,
    date of last_updsate_date2
    )
    ;

    If I then create a functional index on creation_date via SQL Dev:

    create index pt_idx1 on paul_test (nvl (creation_date, ' 01-JAN-4000'));

    and create a functional index on creation_date2 via SQL more

    create index pt_idx2 on paul_test (nvl (creation_date2, ' 01-JAN-4000'));

    What I see when you perform a describe table statement and looking at the index or when querying ALL_IND_EXPRESSIONS on the table TABLE_NAME is the following:

    SQL Dev index is: NVL("CREATION_DATE",'01-JAN-4000')

    The Index of over SQL is: NVL ('CREATION_DATE2', TO_DATE ('4000-01-01 00:00:00 ',' yyyy-mm-dd hh24:mi:ss'))))

    Why are they not compatible?

    If I then fill up with 1 million rows and fill creation_date/creation_date2 with enough data to make no small enough value I then collect statistics on the table and explain the plans of selects on creation_date/creation_date2 via SQL dev. and SQL Plus what I see, it's different


    -Select
    NVL SELECT (creation_date, ' 01 - JAN - 4000 "")
    OF eagadev.paul_test
    where nvl (creation_date, ' 01-JAN-4000') = ' 01-JAN-4000';

    SQL Dev explain Plan
    Use PT_IDX1


    More SQL explain Plan:

    SQL > SELECT count (1)
    2 FROM eagadev.paul_test
    3 where nvl (creation_date, ' 01-JAN-4000') = ' 01-JAN-4000';

    COUNT (1)
    ----------
    100


    Execution plan
    ----------------------------------------------------------
    0 SELECT STATEMENT Optimizer = CHOOSE (cost = 30 card = 1 bytes = 8)
    1 TRI 0 (AGGREGATE)
    2 1 INDEX (LINE SCAN) OF "PT_IDX1" (NO ONE) (cost = 30 Ca
    RD = 5825 bytes = 46600)

    Statistics
    ----------------------------------------------------------
    14 recursive calls
    0 db block Gets
    8 compatible Gets
    0 physical reads
    Redo size 60
    224 bytes sent via SQL * Net to client
    276 bytes received via SQL * Net from client
    2 SQL * Net back and forth to and from the client
    0 sorts (memory)
    0 sorts (disk)
    1 rows processed


    -Select2

    SELECT count (1)
    OF eagadev.paul_test
    where nvl (creation_date2, ' 01-JAN-4000') = ' 01-JAN-4000';

    SQL Dev explain the Plan:
    FULL analysis

    More SQL explain Plan:

    SQL > SELECT count (1)
    2 FROM eagadev.paul_test
    3 where nvl (creation_date2, ' 01-JAN-4000') = ' 01-JAN-4000';

    COUNT (1)
    ----------
    100


    Execution plan
    ----------------------------------------------------------
    0 SELECT STATEMENT Optimizer = CHOOSE (cost = 28 card = 1 bytes = 8)
    1 TRI 0 (AGGREGATE)
    2 1 INDEX (LINE SCAN) OF "PT_IDX2" (NO ONE) (cost = 28 Ca
    RD = 5825 bytes = 46600)





    Statistics
    ----------------------------------------------------------
    14 recursive calls
    0 db block Gets
    8 compatible Gets
    0 physical reads
    Redo size 60
    224 bytes sent via SQL * Net to client
    276 bytes received via SQL * Net from client
    2 SQL * Net back and forth to and from the client
    0 sorts (memory)
    0 sorts (disk)
    1 rows processed


    The select on creation_date2 says plan is different between Dev SQL and SQl Plus. SQL Dev does not seem to be implicitly convert the '' 01-JAN-4000 in a date.

    Their behaviour are not the same?

    Then the problem may be due to different configurations of NLS between SQLPlus and SQLDeveloper, try to check the date format configured NLS in SQLPlus and SQLDeveloper.

    You can change the date format in SQLDeveloper, NLS of:

    Tools-> preferences - ZDatabase-> NLS

  • Can I install SQL Plus in a client PC?

    Dear friends,

    I'm working on a PC that accesses the database using PL/SQL Developer and command-line SQLPLUS (instant client). I would like to download SQL PLUS as well. Is there a way? I've seen some way PC but don't know how to do it.

    Could someone guide me.

    Thanks in advance.

    Looking for your support.

    Benard

    My apologies. I did not yet installing Oracle11g customer and assumed it was the same as Oracle 10g. My bad. During the initial examination, I could not find the SQL * Plus for Windows (sqlplusw.exe) in the Oracle11g Client installation or the other.

    Could always try installing with Oracle10g customer or Oracle10g Express Edition.

    Had heard some comments awhile back that SQL * Plus for Windows would disappear at some point, but do not think that was going to be to 11g of product.

    Published by: J.A.Hill on May 27, 2009 13:51

  • ORA-12154 error using SQL PLUS

    I have no problems connecting using SQL Developer, but I'm having issues using SQL Plus or command prompt. I also set the Oracle_home and SID and still it fails with the following message. Is there anything I can check?

    ORA-12154: TNS could not resolve the connect identifier

    The same account and tnsnames work well using SQL Developer.

    BSK wrote:
    Here's the info. Not sure why only SQL MORE fails to solve the connection identifier when the SQL Developer works very well.

    tnsnames.ora

    B51 =
    (DESCRIPTION =
    (SDU = 32768)
    (ADDRESS = (PROTOCOL = TCP (PORT = 1527))(HOST = hostname.com))
    (CONNECT_DATA =
    (SERVICE_NAME = B51)
    )
    )

    SQLNET.ora

    sqlnet.ora # Network Configuration file: C:\oracle\product\11.2.0\client_1\network\admin\sqlnet.ora
    # Generated by Oracle configuration tools.

    # This file is actually generated by netca. But if customers can opt for
    # install 'Software Only', this file does not exist and without the native
    authentication #, they will not be able to connect to the database on NT.

    SQLNET. AUTHENTICATION_SERVICES = (NTS)

    NAMES. DIRECTORY_PATH = (TNSNAMES, EZCONNECT)

    That's what I'm trying:

    view the results at the bottom

    sqlplus username/passwd@'hostname.com:1527/B51'

  • Unable to see the tilde characters correctly in SQL * Plus window BACK

    Hello

    I have a tilde character display problem in SQL * more correctly.

    The environment is: Oracle 10.2.0.5 Server (Yes, I know, it is longer supported, but it is not possible to update now).

    Database settings:

    SQL > select * from nls_database_parameters by parameter.

    PARAMETERVALUE

    ------------------------------ ----------------------------------------

    NLS_CALENDARGREGORIAN
    NLS_CHARACTERSETWE8MSWIN1252
    NLS_COMPBINARY
    NLS_CURRENCY?
    NLS_DATE_FORMATRR. MR. DD
    NLS_DATE_LANGUAGEPortuguese
    NLS_DUAL_CURRENCY?
    NLS_ISO_CURRENCYPortugal
    NLS_LANGUAGEPortuguese
    NLS_LENGTH_SEMANTICSBYTE
    NLS_NCHAR_CHARACTERSETAL16UTF16
    NLS_NCHAR_CONV_EXCPFAKE
    NLS_NUMERIC_CHARACTERS,.
    NLS_RDBMS_VERSION10.2.0.5.0
    NLS_SORTWEST_EUROPEAN
    NLS_TERRITORYPortugal
    NLS_TIME_FORMATHH24:MI:SSXFF
    NLS_TIME_TdZ_FORMATTZR HH24:MI:SSXFF
    NLS_TIMESTAMP_FORMATRR. MR. DD HH24:MI:SSXFF
    NLS_TIMESTAMP_TZ_FORMATRR. MR. DD HH24:MI:SSXFF TZR

    20 selected lines.

    Data are inserted and displayed correctly by the application (Oracle Forms 6 - Yes, I know it is old and not supported more :-)))

    The only problem is that I can't view "tilde one" or "o tilde" correctly when you use SQL * Plus window BACK directly connected to the database. Other accented characters appear very well (acute accents a, for example).

    If I use the SQL Windows * more available in point 10.2 so all the characters appear correctly.

    NLS_LANG and code page are correct.

    SQL > host chcp

    Active code page: 850

    SQL > host % NLS_LANG Echo%

    AMERICAN_AMERICA.we8pc850

    SQL > select * from nls_session_parameters by parameter.

    VALUE OF THE PARAMETER

    ------------------------------ ----------------------------------------

    NLS_CALENDAR GREGORIAN

    BINARY NLS_COMP

    NLS_CURRENCY $

    NLS_DATE_FORMAT DD-MON-RR

    NLS_DATE_LANGUAGE PORTUGUESE

    NLS_DUAL_CURRENCY $

    NLS_ISO_CURRENCY AMERICA

    NLS_LANGUAGE AMERICAN

    NLS_LENGTH_SEMANTICS BYTES

    NLS_NCHAR_CONV_EXCP FAKE

    NLS_NUMERIC_CHARACTERS.,.

    NLS_SORT BINARY_AI

    NLS_TERRITORY AMERICA

    NLS_TIME_FORMAT HH.MI. SSXFF AM

    NLS_TIME_TZ_FORMAT HH.MI. SSXFF AM TZR

    NLS_TIMESTAMP_FORMAT-DD-MON-RR HH.MI. SSXFF AM

    NLS_TIMESTAMP_TZ_FORMAT DD-MON-RR HH.MI. SSXFF AM TZR

    17 selected lines.

    Bad displays data:

    SQL > select notes to atj_disc_cong where Ref = 645; -See attached screenshot Snap1.jpg

    However, the data is stored correctly:

    SQL > select dump (notes) in the atj_disc_cong where Ref = 645;

    DUMP (NOTES)

    --------------------------------------------------------------------------------

    Typ = 1 Len = 21: 231,32,227,225,224,226,32,233,232,234,32,237,236,32,243,245,242,224,32,250,249

    Also, if I copy the wrong characters has resulted in Word, they appear very well (that is, I get a tilde correctly a)

    No idea why they are not display correctly in SQL * more?

    Thank you

    The data is stored correctly, as shown in the PICTURE, even if you really do not have the data expected if I'm only guessing.

    The problem is most likely with the police. Your command prompt is implemented with code 850 (WE8PC850), but the police page seems to be in the code page 437 (US8PC437). You should change the font to a non-raster font or change page codes and NLS_LANG to the code page 437.

    Note, do not define NLS_LANG in system properties, because it affects so Oracle Forms. Set only in the command prompt given.

    Thank you

    Sergiusz

  • A question on the impact of SQL * PLUS SERVEROUTPUT Optionconcernant v$ sql

    Hello everyone,
    SQL> SELECT * FROM v$version;
    
    BANNER
    ------------------------------------------------------------------------------
    Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
    PL/SQL Release 11.2.0.1.0 - Production
    CORE    11.2.0.1.0  Production
    TNS for Linux: Version 11.2.0.1.0 - Production
    NLSRTL Version 11.2.0.1.0 - Production
    
    SQL> 
    
    
    OS : Fedora Core 17 (X86_64) Kernel 3.6.6-1.fc17.x86_64
    I would like to ask a question about SQL * Plus SET SERVEROUTPUT option on / off and its impact on queries on views such as v$ sql and v$ session. This is the problem

    In fact I define three variables in SQL * Plus to store sidcolumns, serial # and prev_sql_id of session $ v in order to be used later, several times in various other queries, while I work always in the current session.

    So, here's how
    SET SERVEROUTPUT ON;  -- I often activate this option as the first line of almost all of my SQL-PL/SQL script files
    
    SET SQLBLANKLINES ON;
    
    VARIABLE mysid NUMBER
    VARIABLE myserial# NUMBER;
    VARIABLE saved_sql_id VARCHAR2(13);
    
    
    -- So first I store sid and serial# for the current session
    BEGIN
        SELECT sid, serial# INTO :mysid, :myserial#
        FROM v$session
        WHERE audsid = SYS_CONTEXT('UserEnv', 'SessionId');
    END;
    /
    
    
    PL/SQL procedure successfully completed.
    
    
    -- Just check to see the result
    SQL> SELECT :mysid, :myserial# FROM DUAL;
    
        :MYSID :MYSERIAL#
    ---------- ----------
           129   1067
    
    SQL> 
    Now let's say I want to run the following query as the last SQL statement is executed within my current session
    SELECT * FROM employees WHERE salary >= 2800 AND ROWNUM <= 10;
    According to the reference of database Oracle® 11 g Release 2 (11.2) description of session $ v

    http://docs.Oracle.com/CD/E11882_01/server.112/e25513/dynviews_3016.htm#REFRN30223]

    column prev_sql_id includes the sql_id of the last executed sql statement for the sid and serial data which, in the case of my example, it will be the above mentioned query SELECT on the employees table. So right after the SELECT statement on the employees table I have run the following
    BEGIN
        SELECT prev_sql_id INTO :saved_sql_id
        FROM v$session 
        WHERE sid = :mysid AND serial# = :myserial#;
    END;
    /
    
    PL/SQL procedure successfully completed.
    
    SQL> SELECT :saved_sql_id FROM DUAL;
    
    :SAVED_SQL_ID
    --------------------------------
    9babjv8yq8ru3
    
    SQL> 
    The value of sql_id, I'm supposed to find all the information on the sliders for my SELECT statement and also its value sql_text in v$ sql. Here is what I get when I query v$ sql on the stored sql_id
    SELECT child_number, sql_id, sql_text 
    FROM v$sql 
    WHERE sql_id = :saved_sql_id;
    
    
    CHILD_NUMBER   SQL_ID          SQL_TEXT
    ------------  --------------   -------------------------------
    0              9babjv8yq8ru3    BEGIN DBMS_OUTPUT.GET_LINES(:LINES, :NUMLINES); END;
    So instead of
    SELECT * FROM employees WHERE salary >= 2800 AND ROWNUM <= 10;
    get the next value for the value of sql_text
    BEGIN DBMS_OUTPUT.GET_LINES(:LINES, :NUMLINES);
    Which is of course not what I expected to find in v$ sql for the given sql_id.

    After a little googling, I found the next thread on OTN forum, where it was suggested (well, I think that may not be exactly the same problem) to disable SERVEROUTPUT.

    Problem with dbms_xplan.display_cursor

    It was exactly what I did
    SET SERVEROUTPUT OFF
    After that, I repeated the procedure as a whole and this time everything worked pretty much as expected. I checked SQL * more documentation for SERVEROUTPUT
    and also the page of v$ session, yet I don't find nothing indicating that SERVEROUTPUT should be operated off every time that views such as v$ sql, v $session
    are queired. I don't really understand the link in what concerns the impact that can have on the other or better say rather, why is there an impact

    Could someone kindly do a few details?


    Thanks in advance,

    Kind regards
    Dariyoosh

    >

    and also the page of v$ session, yet I don't find nothing indicating that SERVEROUTPUT should be operated off every time that views such as v$ sql, v $session
    are queired. I don't really understand the link in what concerns the impact that can have on the other or better say rather, why is there an impact

    Hi Dariyoosh,
    SET SERVEROUTPUT ON has the effect of dbms_output.get_lines running after each statement. Not only related to the system view.

    Below is what Tom Kyte is explained in this page:

    Now, sqlplus sees this feature and says "Hey, it wouldn't be nice for me to empty the buffer to the screen for the user? Thus, they added the command SQLPlus "set serveroutput we" which does two things

    (1) he tells SQLPLUS you would like run dbms_output.get_lines after each statement. You would like to make this network rounded up after each call. You want that this additional load will take place (think of a script of installation with hundreds / thousands of statements to run - maybe, just maybe you don't want this extra call after each call)

    (2) SQLPLUS automatically calls the API dbms_output "activate" to activate the buffering which is in the package.

    Kind regards.
    Al

  • SQL * PLUS command to get rid of the old and new sqls when using and

    Hi all

    If we use "and in" any query sql in SQL * PLUS, we get the OLD and the NEW sqls as below. How can I get rid of them?
    SQL> select n.name,s.value from v$sesstat s,v$statname n where n.STATISTIC#=s.STATISTIC# and n.name in ('physical read bytes','physical write bytes','redo size','redo writes','session pga memory','sorts (disk)','sorts (memory)','sorts (rows)','undo change vector size','temp space allocated (bytes)') and s.sid=&in;
    Enter value for in: 3
    old   1: select n.name,s.value from v$sesstat s,v$statname n where n.STATISTIC#=s.STATISTIC# and n.name in ('physical read bytes','physical write bytes','redo size','redo writes','session pga memory','sorts (disk)','sorts (memory)','sorts (rows)','undo change vector size','temp space allocated (bytes)') and s.sid=&in
    new   1: select n.name,s.value from v$sesstat s,v$statname n where n.STATISTIC#=s.STATISTIC# and n.name in ('physical read bytes','physical write bytes','redo size','redo writes','session pga memory','sorts (disk)','sorts (memory)','sorts (rows)','undo change vector size','temp space allocated (bytes)') and s.sid=33
    
    NAME                                                              VALUE
    ------------------------------------------------------------ ----------
    session pga memory                                              1199976
    physical read bytes                                               90112
    physical write bytes                                                  0
    redo size                                                           200
    redo writes                                                           0
    temp space allocated (bytes)                                          0
    undo change vector size                                               0
    sorts (memory)                                                        0
    sorts (disk)                                                          0
    sorts (rows)                                                          0
    
    10 rows selected.
    TIA,
    JJ

    Hello

    highlight:

    set verify off
    

    Herald tiomela
    http://htendam.WordPress.com

  • Out of the queue of SQL * Plus for Excel

    I'm out of the queue of SQL * Plus for Excel. The code I use is down. I want that all white space to carve when I open the updated file waiting in Excel. How can I ensure this?

    I was reading on the SET TRIM command, but it says that it does not affect the output queued. (http://ss64.com/ora/syntax-sqlplus-set.html)

    Is there a way to NOT display whitespace at the beginning and the end of a column in SQL * more? In other words, if I shoot a single column of a record, and a data element is only 3 characters in length, I want to be also 3 characters instead of extending over 40 characters across the width of the column.


    The column for your troubleshooting information
    IDNUMBER is NUMBER (12)
    FIRST is VARCHAR2 (40)
    The LAST is VARCHAR2 (60)


    Code
    SET LINESIZE 100
    SET PAGESIZE 0
    SET MARKUP HTML PREFORMAT ON
    set colsep,
    coil c:\prospects.csv
    Select '' perspective ID"', '" First"',""finally" "from dual;
    Select to_char (p.idnumber), p.first, prospect_view p.last p where idnumber = 164515;
    spool off

    DataHandle wrote:
    I'm out of the queue of SQL * Plus for Excel. The code I use is down. I want that all white space to carve when I open the updated file waiting in Excel. How can I ensure this?

    I was reading on the SET TRIM command, but it says that it does not affect the output queued. (http://ss64.com/ora/syntax-sqlplus-set.html)

    TRIM affects the expressions in your SELECT clause. It has nothing to do with the padding of SQL * Plus adds to align the columns upwards.

    Is there a way to NOT display whitespace at the beginning and the end of a column in SQL * more? In other words, if I shoot a single column of a record, and a data element is only 3 characters in length, I want to be also 3 characters instead of extending over 40 characters across the width of the column.

    Here's a way to make the main request:

    SELECT        TO_CHAR (idnumber)
    || ',' ||  first
    || ',' ||  last
    FROM           prospect_view
    WHERE        idnumber     = 164515
    ;
    

    This will include spaces only if they occur in first or last. Depending on your data and your requriements, you may need to use the FILLING (first) instead of the first, and/or TRIM (finally) instead of the last.

    Using this technique, it does not matter what is COLSEP: the query produces a single column.

    Use the SQL * more order

    SET  TRIMSPOOL ON
    

    to keep SQL * more add space after this single column.

  • SQL Plus - guest user with: "do you want to continue?

    I am running a script, PL/SQL using SQL more. In the middle of the script, I would essentially like to have the following logic:

    Request to the user: "do you want to continue?
    IF the user types 'Y', continue with script (run update instructions)
    ELSE IF
    types user 'n' end script

    What is the best way to do it? Thank you!

    You cannot ask for PL/SQL code. The PL/SQL code runs in a process on the database server and can interface with the end front of the customer.
    You must use a front-end interface for this apart from any PL/SQL code. SQL * Plus offers a basic intervention, but you would be better using a good front-end such as Application Express, .NET, Java etc. or maybe even a Windows command/batch file.

  • Why launch SQL * Plus with / nolog

    What is the difference between from SQL * as in

    sqlplus sys as sysdba

    compared to

    sqlplus/nolog
    Connect sys as sysdba

    I can imagine that the second method prevents some log writing, but sometimes newspapers are useful. Is there more than that?

    Thank you
    Gregory

    / nolog does mean no logon, not no record.

    One of the reasons to start sqlplus with / nolog is to hide the BONE connection credentials.
    For example if you launch sqlplus with login as

    sqlplus test/test@rman
    
    if someone do ps. he will see
    
    ps -ef|grep sql
      oracle 29455  9100  0 09:32:55 pts/3    0:00 sqlplus test/test@rman
    
    If you embedding the login into your SQL script and
    start sqlplus with /nolog,
    ps will only show
    
      oracle 29460  9100  0 09:33:14 pts/3    0:00 sqlplus /nolog
    
  • How to connect sql database to esxi to save all data from the virtual machine

    How to connect sql database to esxi to save all data from the virtual machine

    Please provide steps

    In simple terms, you cannot connect ESXi to SQL. Connect a vCenter SQL (Windows only).

    If you want to save all the data that is contained in your virtual machines, I suggest a backup solution.

    Suhas

Maybe you are looking for