SQL script problem

Hi all

I have a sql script which is given below.

Select "alter system kill session ' |" SID | «, » || SERIES # session $ v where MACHINE = "Skykollap27";

Out: -.

"ALTERSYSTEMKILLSESSION" | SID | «, » || SERIAL NO.

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

alter system kill session 57.25

But it should be

alter system kill session '57.25';

How to do this. Help, please.

Thanks in advance

its solved...

Thank you

Tags: Database

Similar Questions

  • Other new lines in SQL script file and problem with SQL * more

    Hi all


    I would like to ask a question on the characters of new line inside files SQL scripts. I have a very long SQL query, stored in a file txt (ANSI encoding). Because query instructions are very long (several table joins and WHERE conditions) tried to separate, WHERE and ORDER BY clauses by inserting several new characters of lines (just hit the entrance) among them in order to improve the clarity of the source code. Now the problem is, whenever these newline characters are inserted in the file, apparently SQL * Plus cannot parse the file properly and gives me the following error message:
    SP2-0042: unknown command "FROM" - rest of line ignored.
    SP2-0734: unknown command beginning "myenterpri..." - rest of line ignored.
    The problem is definitely related to these new line because characters that when I remove them, the scripts runs without any problem. I would appreciate that you could kindly guide me how should I deal with this problem. Is there any SQL * Plus command to run to correctly interpret the new line characters?


    Thanks in advance,


    Kind regards
    Dariyoosh

    Hello

    In [SQL * Plus 9 | http://download.oracle.com/docs/cd/B10501_01/server.920/a90842/ch13.htm#1013073] (and), you can tell

    SET     SQLBLANKLINES   ON
    

    allow to completely empty rows in an SQL statement.

  • can the run/run .sql script in another application?

    Hello..

    I have a problem to run my .sql script (for example: @c:\Users\test.sql) in my netbeans application. There is no problem when I want to run/run my sql query (for example: "select * from...").

    But when I want to run my script, no presentation of the result. my script content my query to export to the csv file.

    script: @c:\Users\test.sql

    in the script:

    coil c:\Users\test.csv;

    ' Select ' ' ' | LOT_NUMBER | « «, » » || DEVICENUMBER | « «, » » || DEVICENAME | « «, » » || STEP_NAME | « «, » » || INSERT_DATE | « «, » » || STATUS | « «, » » || DISPOSEDBY | « «, » » || ACCEPTBY | « «, » » || AVAILABLE | « «, » » || GENDISPOSITION | » » »

    of RF_LOT_ON_HOLD_LIST;

    spool off;

    Thank you.

    bunch

    Yes, we know what talking about your question.

    a .sql script is just a plain text file containing everything you want.  The code in it can be a pure SQL statements, it may contain of the PL/SQL code, and it can also include SQL * more specific orders (keep in mind SQL * more is a tool, not a language, so that these commands are specific to this tool and other tools which can also interpret the same commands).

    Not quite sure how your question relates to this blog, as this blog is showing the code that gets the data in JSON format in a jqGrid (jQuery grid?) and then exports the data in an Excel file.

    What you're trying to do is to take a series of SQL * Plus and SQL statements in a text file and generate a CSV file from them.

    As already mentioned, SPOOL is a SQL * more order, specific to SQL * more command line tool.  The database itself has no idea what "spool" means, while passing to the database somehow does not work.  I also doubt that netbeans knows what that means, either.

    So, in short, how you try to do, not you cannot.

  • Running SQL scripts on different databases

    Hello!

    At my work we have many databases on a server. I have to make a request so that users can run the application on a selected database SQL scripts.

    So my question may be separated into 2 sections:

    1 - is possible to let users SQL scripts run directly from the application?

    I think a database to create a page that displays the list of all the SQL scripts, that we want to use, and when you click on a specific script name in the list, it asks something like "Where the database you want to run the script?", and then, as confirmed by the user, it would show results running the script on a different page.

    is 2 - possible to let users choose what database to run these scripts?

    Any information would be helpful, I'm at the beginning of the project and am not sure at all about how to proceed, or if it is at all possible.

    Thank you!

    Fallen_Kaede wrote:

    Thanks for the quick response. I confirm that we are talking about databases on a server.

    The request is to "debug" to other databases. For example, be run scripts to the locks on the list, to show the different indexes on a table, etc. to help diagnose problems.

    It looks like the 'users' are DBA who should use OEM/Grid Control to do so.

    1 - is possible to let users SQL scripts run directly from the application?

    Lol the only way to run scripts in the APEX is the use of the SQL Scripts for SQL workshop component.

    The key word in your question is 'application '. SQL * more and Developer SQL are applications that allow users to run SQL scripts on the desktop. Scripts SQL is an APEX integrated application that allows developers to run SQL scripts on the web. However, there is no documented way supported for end users to run SQL scripts in a custom of APEX application that you created. Therefore, rethink your approach. Rather than create an application APEX runs scripts, you must convert the scripts in PL/SQL, APEX packages, pages, components and applications leverage features of the APEX and reports, graphics and interactivity (e.g. exploration links; timed refreshes etc.). This will give you a user experience improved, beyond what is possible using static SQL scripts.

    is 2 - possible to let users choose what database to run these scripts?

    The APEX applications would exist on an instance of the APEX in a database and access other databases using the database links (which can have a performance impact). It would be possible to create a LOV based on the view of the USER_DB_LINKS dictionary and use in a selection set to a global page list to provide a control to set the current context of the database. Region data sources will have to be generated dynamically in the packages of PL/SQL use the links from relevant database based on this value LOV.

  • The execution of a lot of. SQL scripts in a folder?

    Hello

    I have 60 + sql scripts in a folder X... Is it possible to run these scripts only once... ??

    I am looking for a shortcut run these scripts by using scripts SQL (all possible ways) MORE...

    Can someone give little light to solve my problem?

    Kind regards
    John

    JPY wrote:
    I use Windows then?

    dir /b *.sql > combined.sql
    

    Then you 'CD' in this directory to run the combined script (as well as add the '@' symbol for each).

    It can work also (not tested):

    for /f %i in ('dir /b') do echo @%i >> combined.sql
    

    Published by: Centinul on June 20, 2011 14:46

  • SQL script to change the database user

    Oracle 11g on Solaris 10.5 64-bit SPARC

    I work on generate a SQL script to change all default users to a new or custom password.
    Example: change the system of the user identified by new_password

    Problem:
    My problem is that I don't want the 'new_password' be in plain text, because the script will on the ground prior to deployment.
    Can anyone give me some suggestions?
    Is this doable or I can generate the already hashed password - as change User Manager idenfified < hash_characters >

    Example change manager users identified by 'HE5823WE4095432241252 ';

    You can use the hashed password if you say for example:

    change the system of the user identified by values 'hashed_password_string '.

  • question about pl/sql script

    Hi all
    I need to manage other tables that will contain as follows:
    whenever the user query it will be an insert in this table called mng_rishui_session that contain
    track:
    NUM of user's session id,
    Date and time of execution of the request,
    type of query
    every 15 minutes, I need to delete the data of the user of some the various tables according to the type of the query.
    the tables that contain the data:
    mng_rishui_session / / DESC
    session_id_num NOT NULL VARCHAR2 (30)
    type_query not null number (2)
    date of time_query
    I want to write a pl/sql script like this:
     
    declare cursor c1 as 
    select session_id_num,type_query 
    from mng_rishui_session 
    where time_query (/*here i need to do the condition that 15 minutes has passed from the time query 
     i don't know how to do this */
    begin 
    for e in c1 loop 
    
    case e.type_query 
    when 1 
    delete query1_table where session_id_num :=e.session_id_num;
    when 3 
    delete query3_table where session_id_num :=e.session_id_num;
    end
    end loop;
    end;
    issues related to the:
    1. how to check if 15 minutes where the past
    2. it is good to do with loop for writing valid deletion in the loop
    or do I have to do it another way to write this.
    Thanks in advance
    Naama

    Hi, Naama,

    Naama wrote:
    ... now my script looks like this:
    mng_session. SQL

    
    declare cursor c1 as
    select session_id_num,type_query
    from mng_rishui_session
    where  (sysdate - t_query) * 24 * 60 >= 15;  
    
    begin
    for e in c1 loop
    case e.type_query
    when 1 then
    delete query1_table where session_id_num = e.session_id_num;
    when 3 then
    delete query3_table where session_id_num  =e.session_id_num;
    end case;
    end loop;
    end;
    

    first of all, I want to know where I'm going to do the validation, if I need to do.

    In the PL/SQL code (so we won't do it in case of error) but after the LOOP is finished.
    In other words, assuming you are using a LOOP. It will be much more effective if you just do a DELETE statement on each table. Think about it: If your mng_rishui_session has 1,000 rows where t_query (or time_query, if the column is always so called) is fortunate to have one of the type_queries you want at least 15 minutes, and 100 of these lines, then you must fetch the 1,000 rows (if not all of the table) , and separate 100 DELETE queries. It is more effective to extract 100 lines (assuming that there is an index composed of type_query and t_query) and to only 2 DELETE statements. See below.

    Second:
    I run this script through linux system, in order to head to sleep.
    My problem is that I am trying to append the output of script;
    but it won't let me

    People on this site will try to help you. Why not try to help them do it?
    Do not say "he won't let me": show all that you know the problem. What exactly have you tried? That's happened? If you got an error, display the full error message, including the line number. If you got the wrong results, describe what happened.

    My goal is:

    a script running the sql scripy called:
    CS-mng-session:

    #!bin/bash
    sqlplus user/passwd@dbname @mng_session /*mng_session is the script were i declare the cursor etc.*/
    in the command line i want to write :
    (sleep 600; sh cs-mng-session)& 
    

    the problem is that if I do not exit. He recorded in sql and the script does not return to the command line.
    How do I overcome this problem?

    Make an EXIT.

    Try something like this:

    DECLARE
         cutoff_date     DATE     := SYSDATE - (15 / (24 * 60));
    BEGIN
         DELETE     query1_table
         WHERE     session_id_num  IN (
                             SELECT  session_id_num
                             FROM     mng_rishui_session
                             WHERE     type_query     = 1
                             AND     t_query          <= cutoff_date
                           );
    
         DELETE     query3_table
         WHERE     session_id_num  IN (
                             SELECT  session_id_num
                             FROM     mng_rishui_session
                             WHERE     type_query     = 3
                             AND     t_query          <= cutoff_date
                           );
    
         COMMIT;          -- If desired
    END;
    /
    
    EXIT;
    

    Is there a reason why query1_table should be different from query3_table? Why can't you have just a query_table, with a column of type_query?

    What happens if there is an error? You won't want to know? You must add an EXCEPTION section to write the details about the error in a log table and someone send an email on this subject.

    Published by: Frank Kulash, August 31, 2010 09:07
    Added / issue;

  • SQL script to check the status of the last command

    Hi all

    I need to make a SQL script and call it from Unix (bash) shell.


    =========================
    sqlplus vikas/vikas < < END
    coil /oracle/vikas/output.txt
    order 1
    command 2
    ...
    ....
    command N
    spool off;
    commit;
    END
    =========================


    It works perfectly, but my problem is that if a command fails, the other controls in suite works. However, I need to keep a check when a broken command that you exit the script.

    On unix, we have an option of echo $? to check the status of the previous command, but how to accomplish this SQL.

    Pls help!
    __________________
    == > VIKAS < ==

    =========================
    sqlplus vikas/vikas<>
    coil /oracle/vikas/output.txt
    WHENEVER SQLERROR EXIT; -Add this
    order 1
    command 2
    ...
    ....
    command N
    spool off;
    commit;
    END
    =========================

  • Update SQL script

    Hi friends,

    I started this thread yesterday, but for some reason that I'm not able to answer/continue on this old thread. Here are the details from the old thread

    I need help with a sql script to update sid_no_new column with values based on sid_no for about 6000 + records.

    Here is an example below...

    SQL > select * from test1;

    SID_NO SID_NO_NEW UNIT_NO

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

    2000                                                          unit1

    2000                                                          unit3

    2000                                                          unit4

    2002                                                          unit16

    4500                                                          unit22

    In the example above, there are 3 sid_no consecutive '2000'. Sid_no_new must be 2000_1, 2000_2, 2000_3, respectively.

    It should be like:

    SQL > select * from test1;

    SID_NO SID_NO_NEW UNIT_NO

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

    2000 2000_1 unit1

    2000 2000_2 unit3

    unit4 2000_3 2000

    2002 2002 unit16

    4500 4500 unit22

    I ran the script (thanks to the experts who have contributed to) below, it works very well for the above documents, but I get ORA-30926 error when I run on the table with 6000 records...

    Fusion IN test1 tgt USING

    (SELECT sid_no,

    sid_no_new,

    unit_no,

    Count (sid_no) over (partition BY sid_no) cnt,

    ROW_NUMBER() over (partition BY order of sid_no to unit_no) rn

    OF test1

    ) CBC ON(tgt.sid_no=src.sid_no AND tgt.unit_no=src.unit_no)

    WHEN matched THEN

    UPDATE SET Sid_no_new = CASE WHEN cnt > 1 THEN sid_no |' _'. RN ELSE sid_no END;

    ERROR on line 1:

    ORA-30926: failed to get a stable set of rows in the source tables

    Please give your suggestions... Thank you very much

    In fact, this could be done easier:

    SQL > select *.

    test1 2

    3.

    SID_ SID_NO UNIT_N

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

    2000 2000_1 unit1

    2000 2000_2 unit3

    unit4 2000_3 2000

    2002 2002 unit16

    4500 4500 unit22

    SQL > select *.

    2 of test4

    3.

    UID_NO TYP RULE_DUE

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

    RAF 2000 90

    3140 TH 100

    6712 JUL 21

    233 12 H6

    SQL > fusion

    2 in d of test4

    3 use)

    4 with as t4)

    5. Select uid_no,

    6                               type,

    7                               rule_due,

    8 rowid RID,

      9                               uid_no || '_' || ROW_NUMBER() over (partition by uid_no by 1 order) sid_no_new

    10 of test4

    11                      )

    12. Select t1.sid_no_new,

    T4.type 13,

    T4.rule_due 14,

    15 cases

    16 when t1.sid_no = t1.sid_no_new then t4.rid

    17 when t4.sid_no_new = t1.sid_no_new then t4.rid

    18 end rid

    19 of t4,

    Test1 20 t1

    21 where t1.sid_no = t4.uid_no

    22          ) s

    23 on)

    24 d.rowid = s.rid

    25       )

    26 when matched

    27 then

    Update 28

    29 set d.uid_no = s.sid_no_new

    30 when no match

    31 then

    32 insert

    33 values)

    s.sid_no_new 34,

    s.type 35,

    36 s.rule_due

    37                )

    38.

    3 lines merged.

    SQL > select *.

    2 of test4

    3.

    UID_NO TYP RULE_DUE

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

    2000_1 RAF 90

    3140 TH 100

    6712 JUL 21

    233 12 H6

    2000_3 RAF 90

    2000_2 RAF 90

    6 selected lines.

    SQL >

    SY.

  • Call of from.mxl under linux .sql script file

    Hello Experts,

    I have a requirement to call the sql script in the maxl file in the linux server. I get EOF file error.

    Could you please say how to achieve this requirement.

    MAXL Script:

    Reel to ' / / essbase02//MaxL//Test_MR.log ';

    the value of message level.

    Set timestamp

    echo 'start logging ';

    login "admin", "password" on 'server '.

    echo "beginning of sh execution."

    MSH ' / / essbase02//MaxL//Test_MR.sh';

    / * Create label * /.

    echo "Completed";

    disconnection;

    spool off;

    Contents of the Test_MR.sh file:

    sqlplus-s user@orcl/password @"' / / essbase02//MaxL//TEST.sql '"


    Journal for the maxl:

    essmsh timestamp: Wed Aug 5 23:17:35 2015

    'Start of logging.

    essmsh timestamp: Wed Aug 5 23:17:35 2015

    MAXL > login "admin" "admin" on "server1.hq.emirates.com";

    OK/INFO - 1051034 - [admin@Native Directory] user connection.

    OK/INFO - 1241001 - connected to Essbase.

    essmsh timestamp: Wed Aug 5 23:17:35 2015

    "Beginning of HS performance."

    essmsh timestamp: Wed Aug 5 23:17:35 2015

    MAXL > sqlplus-s user@orcl/password @ "/ essbase02/MaxL/TEST." SQL ".

    2 >

    3 >

    4 >

    essmsh error: end of file breaks the statement

    essmsh timestamp: Wed Aug 5 23:17:35 2015

    essmsh timestamp: Wed Aug 5 23:17:35 2015

    "Completed".

    essmsh timestamp: Wed Aug 5 23:17:35 2015

    MAXL > disconnect;

    The user admin is offline

    essmsh timestamp: Wed Aug 5 23:17:35 2015

    Thank you

    RM

    If you want to execute operating system commands you use Shell, not "msh". MSH is to call an additional MaxL script with MaxL orders only.

    Optionally, there should be no need to store the command shell in a separate file, that is, it should be possible to place the command sqlplus directly inside the MaxL script when you use the Shell.

  • How to run multiple parallel sql scripts?

    I try to execute multiple sql scripts parallel to the short run of the process via sqlplus. Are there opportunities to do? LINUX ORACLE 5. XX

    I do it too via Scheduler, but now I need to do this via sqlplus or shell + sqlplus?

    How do I start using shell script several xterminals and ech session begins all the sql scripts?

    nohup./SQL1.sh &

    nohup./sql2.sh &

    nohup./SQL3.sh &

    The '&' causes the script1.sh to run in the background so that the command prompt is returned immediately.  This means that sql2.sh can start immediately and at the same time as sql1.sh.  It doesn't have to wait for sql1.sh.   This assumes that there are no dependencies between scripts!  This meets your need to run scripts in parallel.

    The nohup untie your shell script.  So, even if you disconnect, the script continues to run.  Without the nohup, if you were to close your session before the end of the scripts running, they would get fired.

    Hemant K Collette

  • How to format the output of a .sql script that has select statements.

    Hello

    I have a .sql script which is having several select statements. Each Select statement is to have hundreds of Table columns.

    When we run the .sql script, we are unable to read the output.

    Please let know us the commands that we include for better readable output format.

    You work with the lin standard set 80.
    Increase this setting to set lin 3000 or more.

  • Create jobs and positions via PL/SQL script

    Hi, it is recommended to insert new jobs and positions via PL/SQL Script?

    I know it's possible, I'm not sure if it is recommended. especially when it's via a direct insertion.

    Is there an API for it?

    I have about 200 + positions I need to set in our Instance of the EBS Test.

    Thank you!

    The APIs are the best way to do it in batches of charges-

    Job: HR_JOB_API

    Position: HR_POSITION_API

    To know that all the seeds API, add the responsibility of integrated SOA gateway

  • passage OEM "SQL Script" job name in lowercase as proxy database

    Hello

    I have a SQL script that requires the name of the database in lower case to be passed when running - she uses it as a substitution variable to create database directories that point to the UNIX file system (which is why they are case sensitive). I want to be able to configure this script as work in OEM (12 c version 3) so that I can run on several databases (11.2.0.3), but at the creation of employment, the % DBName parameter returns only the name of the database uppercase. I tried to change the % DBName parameter and run the script in a PL/SQL block, but the variable I spend it is interpreted as a literal string. I also tried to run in a shell script, but because of the way the user operating system is set up that I can't get that to work either.

    Does anyone have any ideas how this can be done? Ideally, I wish I could just run @script lower (%DBName%) or something similar.

    Thanks in advance,

    Robin

    In case anyone else has trouble with this, I worked on that I was able to use a PL/SQL block to convert the variable substitution for lower case, then create the directory with the variable:

    DECLARE

    v_lowerSID varchar2;

    BEGIN

    Select lower ('& 1') in the double v_lowerSID;

    run immediately ' create the db_dir as directory "/ [path] /' | v_lowerSID | '/' || v_lowerSID | ' _directory1 "';

    END;

    /

  • Where is CMCLEAN. SQL script now?

    Hello

    I think I should find the cmclean.sql script in the following note:

    Simultaneous treatment of - CMCLEAN. SQL - Script Non-destructive to clean the simultaneous Tables Manager [ID 134007.1]


    But when I searched Doc ID 134007.1 I was surprised to see that the Doc ID is present but cmclean.sql script is not available here as it was:


    Now the title of the Doc has also changed to:

    Simultaneous - treatment simultaneous Recovery Manager Troubleshooting Wizard (Doc ID 134007.1)

    Can you please let me know what happened to the original note and help me get to the script cmclean.sql on MOS.

    Thank you

    Armande

    Florent,

    cmclean. SQL script is so more exist and you should use the "Competitor Assistant Manager of recovery".

    Thank you

    Hussein

Maybe you are looking for