SQL wildcard question!

SQL dear friends...

Can someone help me with this-

I need DBA_USERS query table in the database to list only users of the application. I don't want nicks individuals that appear in the result. All our nicks individual have a model - from 1 letter followed by 5 digits. For example, V67890, Q87544 etc...

How to use the wild cards...

Thanks for the help...

If not regexp_like (username, ' ^ [A - Z] \d {5} $')

Tags: Database

Similar Questions

  • SQL * Net questions - which forum?

    Does anyone know what forum manages SQL * Net questions?

    THX

    For general issues, it's probably as good a place to ask as any.

    If you have SQL * Net questions that are specific to a particular technology (i.e. how various options of TNS interact with different configurations of CARS), you probably want to ask in the forums dedicated to these products.

    Justin

  • Microsoft SQL server question

    The company I work for has a production with SQL Server Standard Edition (64-bit) database server. However when I try to configure Oracle as a linked server, the 'Microsoft OLE DB Oracle provider' does not appear in the drop down menu to the provider. The server is running service pack 2 and the .NET version on the server is 3.5 SP1 and more 2.0 SP2 and 3.0 SP2. Please guide as to what needs to be done.

    Hi Claudine Gupta,

    Welcome to the Microsoft Answers Forum community!

    The question you posted would be better suited to the TechNet community. Please visit the link below to find a community that will provide the best support.

    http://social.technet.Microsoft.com/forums/en-us/w7itpronetworking/threads

    Thank you best regards &,.

    Calogero - Microsoft technical support.
    Visit our Microsoft answers feedback Forum
    http://social.answers.Microsoft.com/forums/en-us/answersfeedback/threads/ and tell us what you think

  • Virtualize SQL Cluster - questions

    We want to consolidate and improve our infrastructure SQL.

    We have dedicated two ESX (VI 3.5, update 3) boxes (IBM 3850 M2 - 4 x 4-core @ 2.13 Ghz - 128G of ram).

    We are planing using Microsoft Clustering with a knot on each ESX Server.

    We also use several levels: production, pre-production, development, and test (in dedicated virtual machines) in the 2005 version of SQL or SQL 2008.

    This means that we will have 8 VMs on each server: 4 SQL 2005 machines virtual (one for each level) and 4 in SQL 2008 (also for each level). We want to use a MS (for each instance) with the other ESX Server cluster.

    We also want to install an additional VM for Reporting Services.

    We use versions of Windows 2003 and SQL, x 64 editions company.

    Here are a few questions:

    • We devote 16G of RAM for each active node. Of course, the passive node must be configured as active. This means that the passive virtual machine should also have 16G of RAM. Also we need to dedicate memory since this virtual machine will be pasive mode and not used unless the cluster switch?

      • If the answer is Yes, this means that we will actually use 32 G of ram for each level. With 4 levels and 2 versions of SQL, we devote 32 x 8 = 256 G of ram.

      • Unless I'm not understanding correctly how the memory works in ESX, I'm out of memory for the virtual machine Reporting Services (and all the needs of furture)

    • Knowing that the Windows swap file is 1.5 times the amount of RAM, this means that a VM with 16G needs to have a pagefile of 24G

      • We need to have 24G of swap file already knowing the virtual machine have an own swip file?

    • Knowing the volume of crude OIL are recommended for SQL, is there any issue with several GROSS volumes in a single ESX box? (We want to use 4 GROSS volumes by level (MSTDC, Quorum, journals and databases. That means 16 volumes GROSS)

    Your help is appreciated.

    Sébastien

    • * If the answer is Yes, this means that we will actually use 32 G of ram for each level. With 4 levels and 2 versions of SQL, we devote 32 x 8 = 256 G of ram.

    • Unless I'm not understanding correctly how the memory works in ESX, I'm out of memory for the virtual machine Reporting Services (and all the needs of furture)

    You are planning to book memory?  I don't think this is necessary.  If you use 2 ESXi servers for a battery of SQL servers, you can simply allocate memory, and you should be fine using actions.  If you are short of memory, I want to begin to see how you share memory, are these machines in the same pool of resources?

    Knowing that the Windows swap file is 1.5 times the amount of RAM, this means that a VM with 16G needs to have a pagefile of 24G

    In fact, the pagefile is not a formula, it is dynamic.  I hope that you run Windows 2003 for these VM SQL if if just use automatic paging size, because you can't handle memory better than Windows, and you would be guessing how much swap is needed.  In addition, swap does not mean additional memory some processes such as nucleus and Exchange DLL regardless of the amount of RAM that is available there.  SQL rarely use memory swap, so available RAM is more essential, then by defining a finite number of 1.5 available RAM, you could be on the award or the RAM of hunger for SQL.  Use the settings of AWE in SQL and let it manage memory and the value of the minimum RAM you need.

    • We need to have 24G of swap file already knowing the virtual machine have an own swip file?

    In fact if you reserve memory for a virtual computer, the Exchange is not necessary.  The VM swap file is for memory allocated to the virtual machine, then you will need IF the memory of the VM on the HOST is not exceed if the client needs more RAM.  Widespread.

  • 2000 MS SQL simple question

    Small question people,

    What is the MS SQL Server 2000 syntax for inserting multiple records with a single INSERT statement?

    I get ODBC barfs with:

    INSERT orders (UserID, FacilitiesOrServicesID, transmitted)
    VALUES ((10486, 2195, 0), (10486, 1156, 0))

    Thank you.

    INSERT INTO
    Orders (UserID, FacilitiesOrServicesID, transmitted)
    SELECT
    10486, 2195, 0
    SELECT UNION
    10486, 1156, 0
    SELECT UNION
    10487, 1776, 99
    etc, etc.

  • SQL Performance question

    Hello

    The following query performs badly when the predicate

    AND (v_actionFlag IS NULL or ACTION_CODE = v_actionFlag)

    is present. In all executions of the query v_actionFlag will be NULL. In addition, because of the plan when the predicate is included, the returned results are incorrect. We seek to treat rows with the lowest priority. With the included predicate query performs the join, gets 20 lines, sorts, and puts back them rather than getting 20 lines with the lowest priority through the index of QUEUE_TAB0 and return of these.

    The questions I have are-

    -Why the predicate affects the query in this way
    -What is the difference between the HASH JOIN ANTI and HASH JOIN RIGHT ANTI


    We were able to remove this predicate as the functionality it supports has not yet been implemented.



    Background

    Version of DB - 10.2.0.4
    optimizer_features_enable - 10.2.0.4
    optimizer_mode - ALL_ROWS
    Table
    
    - table has approximately 475,000 rows and the statistics are up to date
    
    
    sql> desc queue_tab
     Name                                      Null?    Type
     ----------------------------------------- -------- ----------------------------
     ENTITY_KEY                                NOT NULL NUMBER(12)
     ENTITY_TYPE                               NOT NULL CHAR(1)
     ACTION_CODE                               NOT NULL CHAR(1)
     REPORT_NO                                 NOT NULL NUMBER(12)
     PRIORITY                                  NOT NULL NUMBER(4)
    
    
    
    Indexes
    
    Primary Key (QUEUE_TAB_PK)
    
     ENTITY_KEY                                 
     ENTITY_TYPE                                
     ACTION_CODE                                
     REPORT_NO 
    
    
    Non Unique Index (QUEUE_TAB0)
    
     PRIORITY  
     ENTITY_KEY   
     ENTITY_TYPE  
     ACTION_CODE 
    
    
    
    Cursor
    
    
            SELECT /*+ INDEX_ASC (main QUEUE_TAB0) */
                   REPORT_NO
                 , ENTITY_TYPE
                 , ENTITY_KEY
                 , ACTION_CODE
                 , PRIORITY
              FROM QUEUE_TABV01 main
             WHERE PRIORITY > 1
               AND (v_actionFlag IS NULL OR ACTION_CODE = v_actionFlag )
               AND NOT EXISTS
                   ( SELECT /*+ INDEX_ASC (other QUEUE_TAB_pk) */ 1
                       FROM QUEUE_TABV01 other
                      WHERE main.ENTITY_TYPE = other.ENTITY_TYPE
                        AND main.ENTITY_KEY = other.ENTITY_KEY
                        AND main._ACTION_CODE IN ( constant1, constant2 )
                        AND other.ACTION_CODE IN ( constant3, constant4 ) )
               AND NOT EXISTS
                   ( SELECT 1 FROM QUEUE_TABV01 multi
                      WHERE main.ENTITY_TYPE = multi.ENTITY_TYPE
                        AND main.ENTITY_KEY = multi.ENTITY_KEY
                        AND multi.PRIORITY = 1 )
               AND ROWNUM < rowCount + 1
             ORDER BY PRIORITY, ENTITY_KEY, ENTITY_TYPE,
                      ACTION_CODE;
    
    
                                     
    Plan when predicate "AND (v_actionFlag IS NULL OR ACTION_CODE = v_actionFlag )" is present
    
    
    call     count       cpu    elapsed       disk      query    current        rows
    ------- ------  -------- ---------- ---------- ---------- ----------  ----------
    Parse        1      0.00       0.00          0          0          0           0
    Execute      1      0.00       0.00          0          0          0           0
    Fetch       21      5.53       5.40          2     780463          0          20
    ------- ------  -------- ---------- ---------- ---------- ----------  ----------
    total       23      5.53       5.40          2     780463          0          20
    
    Misses in library cache during parse: 0
    Optimizer mode: ALL_ROWS
    Parsing user id: 60     (recursive depth: 1)
    
    Rows     Row Source Operation
    -------  ---------------------------------------------------
         20  SORT ORDER BY (cr=780463 pr=2 pw=0 time=5400939 us)
         20   COUNT STOPKEY (cr=780463 pr=2 pw=0 time=5400872 us)
         20    HASH JOIN ANTI (cr=780463 pr=2 pw=0 time=5400823 us)
     459033     TABLE ACCESS BY INDEX ROWID QUEUE_TAB (cr=780460 pr=2 pw=0 time=4640394 us)
     459033      INDEX RANGE SCAN QUEUE_TAB0 (cr=608323 pr=1 pw=0 time=3263977 us)(object id 68038)
      10529       FILTER  (cr=599795 pr=1 pw=0 time=2573230 us)
      10529        INDEX RANGE SCAN QUEUE_TAB_PK (cr=599795 pr=1 pw=0 time=2187209 us)(object id 68037)
          0     INDEX RANGE SCAN QUEUE_TAB0 (cr=3 pr=0 pw=0 time=34 us)(object id 68038)
    
    
    
    
    Plan when predicate "AND (v_actionFlag IS NULL OR ACTION_CODE = v_actionFlag )" is removed
    
    
    call     count       cpu    elapsed       disk      query    current        rows
    ------- ------  -------- ---------- ---------- ---------- ----------  ----------
    Parse        1      0.00       0.00          0          0          0           0
    Execute      1      0.02       0.00          0          0          0           0
    Fetch       21      0.05       0.05          0       6035          0          20
    ------- ------  -------- ---------- ---------- ---------- ----------  ----------
    total       23      0.07       0.06          0       6035          0          20
    
    Misses in library cache during parse: 1
    Misses in library cache during execute: 1
    Optimizer mode: ALL_ROWS
    Parsing user id: 60     (recursive depth: 1)
    
    Rows     Row Source Operation
    -------  ---------------------------------------------------
         20  SORT ORDER BY (cr=6035 pr=0 pw=0 time=54043 us)
         20   COUNT STOPKEY (cr=6035 pr=0 pw=0 time=962 us)
         20    HASH JOIN RIGHT ANTI (cr=6035 pr=0 pw=0 time=920 us)
          0     INDEX RANGE SCAN QUEUE_TAB0 (cr=3 pr=0 pw=0 time=53 us)(object id 68038)
         20     TABLE ACCESS BY INDEX ROWID QUEUE_TAB (cr=6032 pr=0 pw=0 time=701 us)
         20      INDEX RANGE SCAN QUEUE_TAB0 (cr=6001 pr=0 pw=0 time=533 us)(object id 68038)
         40       FILTER  (cr=199 pr=0 pw=0 time=2048 us)
         40        INDEX RANGE SCAN QUEUE_TAB_PK (cr=199 pr=0 pw=0 time=1975 us)(object id 68037)

    user599445 wrote:
    Hello Justin and Camille,

    Thank you for taking the time to look at it. I changed the query to correctly practice the ROWNUM. I run and traced the query with the predicate IS NULL and without, with each track below. As you both have suggested that the predicate appears to have no impact on the plan does. All feedback is appeciated.

    Mark,

    the obvious problem with the new plan is that no record is filtered by the first NOT EXISTS clause (using anti-join operation), and then for each line an index seek is performed that filters the records only about 14 000. It is the search for index that takes most of the time, gets consistent since he performs about 2 e/s logic by research, in total nearly 1 million.

    The last 456 000 rows are then sorted (top n) and the top 20 are returned.

    A possible problem could be that the optimizer does not switch mode optimization first_rows_N due to the variable binding used in the filter ROWNUM.

    You can try to execute the statement using a literal (ROWNUM< 21)="" instead="" of="" the="" bind="" variable="" to="" see="" if="" it="" changes="">

    I think in this case, it could be much more effective for the QUEUE_TAB0 of the market index in the order requested and perform the two NOT EXISTS clause as activities of recursive filters provided as your ROWNUM predicate is generally rather low.

    Be aware however that is you do not use a "binary" NLS_SORT index parameter can not be used for an operation of NOSORT ORDER BY STOPKEY of CHAR values, so please check your settings NLS (NLS_SESSION_PARAMETERS. PARAMETER = "NLS_SORT") in which case the optimizer will not use the index for sorting. Note that the NLS parameters are customer specific and can theoretically be different for each session / client.

    You can test this by using a query simple top N: SELECT * FROM (SELECT * ACTION_CODE, ENTITY_TYPE, ENTITY_KEY, QUEUE_TAB ORDER OF PRIORITY) WHERE ROWNUM<>

    If it does not use the QUEUE_TAB0 index to stop the sort operation, you might have a problem with the NLS parameters.

    In order to prevent the transformation of the GUESSED you can also try adding a hint NO_UNNEST two subqueries ("SELECT / * + NO_UNNEST * /...") ("in the respective subquery) and you can also try to switch mode FIRST_ROWS (n) using for example the FIRST_ROWS indicator (20) in the body of the request (but which must be done by the ROWNUM predicate).

    Kind regards
    Randolf

    Oracle related blog stuff:
    http://Oracle-Randolf.blogspot.com/

    SQLTools ++ for Oracle (Open source Oracle GUI for Windows):
    http://www.sqltools-plusplus.org:7676 /.
    http://sourceforge.NET/projects/SQLT-pp/

  • HPDM 4.6 - SQL database Question

    I have the console HPDM installed on my machine and the device management server/gateway running on a server.  The database is a database of SQL2012.  I've set up a new machine with SQL2014, and I want to move the database there.  I'm not moving all other parts.

    The problem that I'm running into is that I don't know where to go or what pieces to apply the change to, to point the HPDM at the new location of the SQL Server.

    Any help is appreciated!  Thank you.

    Another way to migrate the DB - dbsetup.exe stimulus, before doing so, please the current DB using the backup of backup & restore tools

    1. stop the server HPDM

    2. navigate... \Hp Device Manager\Server\bin in the command line window

    3. run dbsetup '-language = en ""-country = US "to reopen the DIALOGUE of INSTALLATION DB box

    4. choose the third option - MIGRATE

    5. choose source DB and select the destination DB

    6 finish the Walker

    7. start the DM server

  • SQL loader question

    Hi people,

    Please find the table with the records below

    CREATE TABLE EMPLOYEE_LOAD (ID NUMBER, NAME VARCHAR2 (100), UNIVERSITY_NAME VARCHAR2 (100));

    File to load: employee.txt

    ID | NAME | UNIVERSITY_NAME

    1. JAMES | UNIVERSITY OF MIT

    2. LISA | UNIVERSITY OF CAMBRIDGE

    3. MINDY | "THIS UNIVERSITY

    4. ' ALLEN J |' IT UNIVERSITY

    5. ' MIKE'ALLEN | "THIS UNIVERSITY

    I've written SQL Loader control as file below

    OPTIONS(SKIP=1,DIRECT=TRUE)

    DOWNLOAD THE DATA

    INFILE ' mnt/employee.txt.

    BADFILE "mnt/employee.bad.

    DISCARDFILE ' mnt/employee.dsc.

    ADD THE EMPLOYEE_LOAD TABLE

    FIELDS TERMINATED BY ' | '. SURROUNDED OF POSSIBLY ' ' ' TRAILING NULLCOLS

    (

    ID,

    NAME,

    UNIVERSITY_NAME

    )

    sqlldr userid = < username > @database/password control=/mnt/employee.ctl log=/mnt/employee.log

    Only 2 first recordings are loading (excluding the header) and face below errors

    (1) no terminator found after CLOSE and CLOSED field

    (2) second string for the attachment does not exist

    These 3 recordings are in the wrong files and how do I force sql loader to load subfolders too?

    3. MINDY | "THIS UNIVERSITY

    4. ' ALLEN J |' IT UNIVERSITY

    5. ' MIKE'ALLEN | "THIS UNIVERSITY

    Try to remove the ENCLOSED BY ' ' ' clause.  It is not true, according to your sample data.

    These quotes seem to be interspersed randomly.

  • SQL query question

    I have a table named Test, data inserted as below

    col1 Val
    There3
    x1
    z2

    We write a query to output below:

    col1 Val
    x1
    There2
    z3

    Please suggest the best way to reach above result.

    It is not clear what you're trying to do, but you can use something like:

    Select col1,

    ROW_NUMBER() (any order of col1) val

    of the test

    /

    For example:

    with the trial as)

    Select 'x' col1, 3 val union double all the

    Select 'y', 2 double Union all

    Select 'z', 1 double

    )

    Select col1,

    ROW_NUMBER() (any order of col1) val

    of the test

    /

    C VAL
    - ----------
    x          1
    y          2
    z          3

    SQL >

    SY.

  • Datasource/eis Microsoft SQL Server question

    Hello

    I have 2 sources of data microsoft SQL server in weblogic server, say the DS1 and DS2. I want to talk through connection of the study of environmental impact of the adaptor DB OSB service.

    It is just a table insert.

    While I had created with HIA pointing to DS1, it works fine, then I changed the eis connection to point to the DS2.

    This change does not take effect, is ist always refers to DS1, the data is inserted into the DS1 not DS2.

    I had droppped the DS1 now, so his complain that DS1 is missing.

    OSB server, we need to change the login name of EIS in 3 places, .jca, business service wsdl, service companies file.

    Which means that iam wrong?

    See you soon,.
    Vijay

    I have fixed this issue by increasing the query and Timed Out at 20 under JDBC position options during setup of the DB adapter, you can find it.

    See you soon,.
    Vijay

  • SQL * more question: unprinted despite SET ECHO ON command

    RDBMS Version: 11.2.0.4

    OS: Oracle Linux 6.4 (bash shell)

    I'm kinda a newbie to SQL * more.

    Here's a SQL * Plus script embedded in bash script that scales multiple data files. This script has been run on the DB server side.

    #! / bin/bash

    export ORACLE_SID = ORCL1

    echo "resize Datafile began to" 'date '.

    sqlplus "/ as sysdba" < < EOF

    set echo on

    Set of feedback on

    ALTER DATABASE DATAFILE '+ DATA/brfcsprd/datafile/manh_audit_lob.338.834340223' resize 25g;

    ALTER DATABASE DATAFILE '+ DATA/brfcsprd/datafile/manh_audit_lob.337.834340223' resize 25g;

    ALTER DATABASE DATAFILE '+ DATA/brfcsprd/datafile/manh_audit_lob.336.834340225' resize 25g;

    ALTER DATABASE DATAFILE '+ DATA/brfcsprd/datafile/manh_audit_lob.335.834340225' resize 25g;

    ALTER DATABASE DATAFILE '+ DATA/brfcsprd/datafile/manh_audit_lob.334.834340225' resize 25g;

    ALTER DATABASE DATAFILE '+ DATA/brfcsprd/datafile/manh_audit_lob.333.834340225' resize 25g;

    ALTER DATABASE DATAFILE '+ DATA/brfcsprd/datafile/manh_audit_lob.332.834340227' resize 25g;

    quit smoking

    EXPRESSIONS OF FOLKLORE

    echo "resize Datafile ended in" 'date '.

    As you can see, the SQL * more script contains ON SET ECHO ON and PUT your COMMENTS.

    But in the logfile (see below), I don't see every ALTER DATABASE DATAFILE... command printing. I see that ' altered database.'  printing messages.

    I executed the script to nohup as

    nohup resize.sh > MyResize2.log &

    $ cat MyResize2.log

    DataFile resize started at Sun Dec 29 00:09:45 MYT 2013

    SQL * more: Production of the 11.2.0.4.0 on Sun Dec 29 00:09:45 version 2013

    Copyright (c) 1982, 2013, Oracle.  All rights reserved.

    Connected to:

    Oracle Database 11 g Enterprise Edition Release 11.2.0.4.0 - 64 bit Production

    With partitioning, Real Application Clusters, Automatic Storage Management, OLAP,.

    Options of Data Mining and Real Application Testing

    SQL > SQL > SQL > SQL > SQL >

    Database altered.

    SQL >

    Database altered.

    SQL >

    Database altered.

    SQL >

    Database altered.

    SQL >

    Database altered.

    SQL >

    Database altered.

    SQL >

    Database altered.

    Hello

    ECHO applies only to the SQL commands * Plus reads through the @ or the STARTUP command, no statements you type directly in the SQL > prompt or read the bash script statements.

    Try to create a separate file, containing only the command ALTER DATABASE in a separate file (let's call it alter_database.sql for now) and call it from your script bash, like this:

    #! / bin/bash

    export ORACLE_SID = ORCL1

    echo "resize Datafile began to" 'date '.

    sqlplus "/ as sysdba".<>

    set echo on

    Set of feedback on

    @whatever/alter_database

    quit smoking

    EXPRESSIONS OF FOLKLORE

    echo "resize Datafile ended in" 'date '.

  • SQL must QUESTION

    Hello

    I have a requirement as below. Please help me to write the SQL query for the same.

    My entry is:
    DEPTNO  ENAME  STARTDATE
    10  SAM  5/6/2013
    10  RAM  5/6/2013
    10  ZUN  5/6/2013
    20  LAL  5/10/2013
    20  PAL  5/10/2013
    20  ROLL  5/10/2013
    10  SIG  5/6/2013
    10  ZIG  5/6/2013
    30  COOL  5/20/2013
    30  FOOL  5/20/2013
    30  ROOL  5/20/2013
    the required power should be like:
    DEPTNO  5/6/2013  5/10/2013  5/20/2013  ENAME
    10  5    NULL    NULL    SAM,RAM,ZUN,SIG,ZIG
    20  NULL    3    NULL    LAL,PAL,ROLL     
    Thanks in advance...

    Try this

    with data as
    (select 10 DEPTNO,'SAM'  ENAME, '5/6/2013'  STARTDATE FROM dual union all
    select 10 DEPTNO,'RAM'  ENAME, '5/6/2013'  STARTDATE FROM dual union all
    select 10 DEPTNO,'ZUN'  ENAME, '5/6/2013'  STARTDATE FROM dual union all
    select 20 DEPTNO,'LAL'  ENAME, '5/6/2013'  STARTDATE FROM dual union all
    select 20 DEPTNO,'PAL'  ENAME, '5/10/2013'  STARTDATE FROM dual union all
    select 20 DEPTNO,'ROLL'  ENAME, '5/10/2013'  STARTDATE FROM dual union all
    select 10 DEPTNO,'SIG'  ENAME, '5/6/2013'  STARTDATE FROM dual union all
    select 10 DEPTNO,'ZIG'  ENAME, '5/6/2013'  STARTDATE FROM dual union all
    select 30 DEPTNO,'COOL'  ENAME, '5/20/2013'  STARTDATE FROM dual union all
    select 30 DEPTNO,'FOOL'  ENAME, '5/20/2013'  STARTDATE FROM dual union all
    select 30 DEPTNO,'ROOL'  ENAME, '5/20/2013'  STARTDATE FROM dual
    )
    
    SELECT DEPTNO,
     SUM(CASE WHEN STARTDATE =  '5/6/2013' THEN 1 END) AS COL_06052013,
     SUM(CASE WHEN STARTDATE =  '5/10/2013' THEN 1 END)  AS COL_10052013,
     SUM(CASE WHEN STARTDATE =  '5/20/2013' THEN 1 END) AS COL_20052013,
     LISTAGG(ENAME, ', ') WITHIN GROUP (ORDER BY STARTDATE)  AS ENAME
    FROM  DATA
    GROUP BY DEPTNO;
    
    DEPTNO  COL_06052013  COL_10052013  COL_20052013  ENAME
    ----------  ----------------- --------------- ---------------  --------------
    10                5          NULL         NULL           RAM, SAM, SIG, ZIG, ZUN
    20                1              2          NULL         PAL, ROLL, LAL
    30          NULL         NULL         3            COOL, FOOL, ROOL
    

    Published:
    Additional results

  • SQL - CROSS Question

    Dear expert operator SQL Set,

    I have 5 queries that run in the database lists top 15 SQL ID, based on the highest - physical reads, buffer gets, executions Total, elapsed time and Cluster waiting respectively by each of the query. There will be a few common SQL identifiers that will appear in the result set of multiple queries. I would like to examine all 5 applications together and report SQL ID, sorted by number of appearances desc hight. How can this be achieved?

    If we consider 2 sets of results, a simple "INTERSECT" operator will do the job. What happened in my case? All thoughts... appreciate your help.

    Thank you.

    I just used the clause to generate data, given that I don't have something practical to use than real queries. If you want the sentence using the clause instead of views online, it's like:

    with reads as (
       select *
       from (select sql_id
             from dba_maint.DB_HIST_SQLSTATS
             where PARSING_SCHEMA_NAME in ('GLOGDBA','SNIOTM','OEM_READ') and
                   trunc(BEGIN_INTERVAL_TIME) between trunc(sysdate-1) and trunc(sysdate-1 )
             group by sql_id
            order by sum(disk_reads_delta) desc)
       where rownum < 16),
    gets as (
       select *
       from (select sql_id
             from dba_maint.DB_HIST_SQLSTATS
             where PARSING_SCHEMA_NAME in ('GLOGDBA','SNIOTM','OEM_READ') and
                   trunc(BEGIN_INTERVAL_TIME) between trunc(sysdate-1) and trunc(sysdate-1 )
             group by sql_id
             order by sum(buffer_gets_delta) desc)
       where rownum < 16)
    select sql_id , count(*)
    from (select sql_id from reads union all
          select sql_id from gets)
    group by sql_id
    order by 2 desc;
    

    Each as block is actually a view online, to separate from the main logic of the request for clarity (personal or lifestyle preference :-)))

    You could also easily do without the with as:

    select sql_id , count(*)
    from (select *
          from (select sql_id
                from dba_maint.DB_HIST_SQLSTATS
                where PARSING_SCHEMA_NAME in ('GLOGDBA','SNIOTM','OEM_READ') and
                      trunc(BEGIN_INTERVAL_TIME) between trunc(sysdate-1) and trunc(sysdate-1 )
                group by sql_id
                order by sum(disk_reads_delta) desc)
          where rownum < 16
          union all
          select *
          from (select sql_id
                from dba_maint.DB_HIST_SQLSTATS
                where PARSING_SCHEMA_NAME in ('GLOGDBA','SNIOTM','OEM_READ') and
                      trunc(BEGIN_INTERVAL_TIME) between trunc(sysdate-1) and trunc(sysdate-1 )
                group by sql_id
                order by sum(buffer_gets_delta) desc)
          where rownum < 16)
    group by sql_id
    order by 2 desc;
    

    John

  • SQL Script question

    I use the SQL below in the event AftExportToDat script, and I get a message (2147467259) data access error. The error log shows ORA-00936 - missing Expression.

    strSQL = "SELECT PartLastExpFile FROM tPOVPartition WHERE the PartName =" & strLoc

    If I hard code the name of the location, then the SQL code works

    strSQL = "SELECT PartLastExpFile FROM tPOVPartition WHERE PartName ="LOC1""»

    Can someone point out my error?
    Thank you

    OK, so your SQL statement should look exactly like this:

    strSQL = "SELECT PartLastExpFile FROM tPOVPartition WHERE the PartName ='" & RES. PstrLoc & "'."

    Is this correct?

  • SQL/shell question

    DB version: 10g and 11 g 2
    OS: RHEL 5

    I have the below sql script and when I run manually and email, it does not include the query output, but when I run the same, call this sql from a shell script it places the application in the output.how remove the select statement of the output

    any help is very appreciated

    Orders.SQL
    =======
    set termout off
    set echo off
    set feed off markup html on spool on
    spool /u02/test2.xls
    select * from orders where trunc(order_date) >='27-FEB-2012';
    spool off
    set markup html off spool off
    exit
    Orders.sh
    =======
    #!/bin/ksh
    # set -xv
    
    .bash_profile
    
    export UTILS=/u01/UTILS
    export pass=`grep -i scott $UTILS/pwdfile | awk -F":" '{ print $2 }'`
    
    sqlplus scott/${pass} < /u02/orders.sql
    
    mutt -s "Weekly orders  Report" -a /u02/test2.xls [email protected] < /dev/null
    Thank you

    Place the silent flag "-s" on the sqlplus line.

    sqlplus scott s / ${col}<>

Maybe you are looking for

  • Can not go on the internet when everything seems to be OK.

    It is a mini Ipad. Was on the internet for a long time, then suddenly will not go on the internet. Everything seems to be correct. The checkbox to the left of the network and internet icon appears to the right of the network, but it will not go on th

  • HPLJ P1102w: P1102w HPLJ two of the three

    Easily set up on laptop (Windows 7), new desktop PC (Windows 10), on the included USB2 of CD port."Improved" Windows 10 laptop. Could not install the file copied from CD. Using CD, endless waitingfor "connect the cable" even if connected. Required wi

  • How the buffering is the USB-6008/6009 has?

    How many readings can be stored internally until the unit overflows.  Pointers to info that describes this would be appreciated. Thank you.

  • Counterfeiting of Windows operating system

    I got a built-in computer, with what I believe to be a fake Windows operating system, can I download the one I have on this subject? How can I fix it?

  • Network connection, re-directed through microsft

    In network connections, it is said, I am not connected to the internet, but I am. In the taskbar notifications, I right click on the connection icon, and then click on diagnose and repair. It indicates that the connection is routed through another We