Why DDL is SQL?

Even though any of the DDL or DML commands do not query to the database, why are they considered as a part of SQL (Structured Query Language). I tried to find the answer at many a locations, but could not find it. Kindly Help
Thanks,
Ram

Kiran wrote:
SQL is not only data retreival language.
This sql is separates into multi parts
DDL - which requests db create objects /alter/ drop objects...
DML - which request db to manipulate the data
DRL - Data retrieval - what you are looking for..
TCL - transaction control language - request db to save the chagnes
... So SQL is language used to request db for different operations in proper way.Surely DRL (never heard of it) and DML are just normal standard SQL as defined
by the ANSI standard?
And would not a better definition of TCL be "determines the visibility of different users' data to each
other in a multi-user system?
I think for most people "SQL" is what you call DRL and DML?
Another difference would be that only DBAs use DDL, whereas users (end-users or programmers) use SQL + TCL.
Obviously though, senior programmers may use DDL and with XE, anyone can use it to test proof of concept stuff
without messing up a test server for anyone else?
Interesting question - it's only when you're forced to actually think about these things that they become clearer - IMHO,
the best way to understand something is to have to teach it to a class.
Paul...
Edited by: Paulie on 26-Apr-2012 13:50

Similar Messages

  • Why to use SQL Server's native backup facilities, not other backup solution?

    I've been asked in my company: why to use SQL Server’s native backup facilities? Instead, they currently rely on other backup software, like Backup Exec, BrightStor, or even Microsoft System Center Data Protection Manager. Those solutions let the
    company manage all of its backups—including SQL Server—in a single place, whereas SQL Server’s native backup abilities only apply to SQL Server.
    So what does SQL Server native backup facility give us more to be forced to use it?

    Satish and Pawan ... thanks but, a backup solution is just there. they don't need to pay anything. even though, having a backup solution that backup everything on the server, like files, software.. etc is needed regardless if you have SQL Server databases
    or not, and if it does database backup it would be even better and more complete as a backup solution. So sorry your answer is not an enough reason that will force me to leave that complete backup solution and use the SQL Server backup tools specifically to
    backup databases.  
    Olaf ... thanks as well. But I was just counting a number of solutions that i think they are related to backup things. yet I believe that Symantec backup exec does backup for SQL Server database, ain't?! what I understood from the link that you gave me,
    that some backup applications (if not all) use SQL Server backup facilities to do database backup, is what I understood correct? if yes then the question will be, is there any situation or reasons that force me to use SQL Server backup tools even if I have
    those backup solution (that some of them in the backgroud they are using SQL Server backup facilities)? does SQL Server backup tool give me more capabilities in backing up databases than what I find in backup solutions?
    The answer is NO, as of now you get all these features in 3rd party native backups...
    So in nutshell Microsoft never forces you to use SQL Servers Native backup -----The only reason why you get native backup featues is since SQL Server is an Enterprise Solution MS provide you all features in-built within the bundle so that you don't have
    to purchase any other license (incase you\your company doesn't have one already)
    Sarabpreet Singh Anand
    SQL Server MVP Blog ,
    Personal website
    This posting is provided , "AS IS" with no warranties, and confers no rights.
    Please remember to click "Mark as Answer" and "Vote as Helpful" on posts that help you. This can be beneficial to other community members reading the thread.

  • Why below MERGE sql statement is throwing error  on 10g?

    Version: Ora 10g R2
    Why below MERGE sql statement is throwing error on 10g?
    SQL> merge into sess_stats
    using
    select a.name, b.value from v$statname a, v$sesstat b where a.statistic#=b.statistic# and b.sid=:sid  and (a.name like '%ga %' or a.name like '%direct temp%')
    ) curr_stats
    on (sess_stats.name=curr_stats.name)
    when matched then
         update set diff=curr_stats.value-sess_stats.value, value=curr_stats.value
    when not matched then
         insert (name, value, diff) values (curr_stats.name, curr_stats.value, null)  2    3    4    5    6    7    8  SQL> SP2-0734: unknown command beginning "on (sess_s..." - rest of line ignored.
    SQL> SP2-0734: unknown command beginning "when match..." - rest of line ignored.
    SQL>   2    3

    First of all, thank you all for your feedback!
    first, I try remove the blank lines at those two places ( before curr_stats and after on) and it works.
    then, again I try to set sqlblanklines on, and it works as well!
    Edited by: PhoenixBai on Nov 10, 2009 10:54 PM

  • Why DDL during SELECT is possible. Or why SELECT does not put a table lock?

    This is a question to people who really knows Oracle internals or/and RDB theory.
    (The question is relocated from another thread for not hijacking on that's original question.)
    Why DDL during SELECT is possible? Or why SELECT does not put TM 2 Row Shared lock on table(s)?
    This not locking causes a possibility while one session is running a long select, another can truncate and even drop table(s) that are being read by the first session.
    I think, humbly assume, that Oracle does not put TM 2 lock on tables, that are being simply SELECTed, by some significant technical reason. But I do not know this reason. If somebody knows please shed a light.
    Also, if you know that this behavior is totally correct from perspective of RDB theory, please explain me.
    I'll try to explain my point.
    It is a matter of data consistency and integrity that is supported in Oracle everywhere except this place.
    a) If one session is reading data from moment T and other session changes data on its way at moment T1, the first session wont read that changed data, it will read the data that was there on moment T.
    This is declared as Read Consistency principle.
    b) If one session is changing data, and another session tries to truncate or drop table - the second session will fail with error ORA-00054: resource busy and acquire with NOWAIT specified.
    This is declared as Data Integrity principle.
    c) But why not to follow the above principles in case when one session reads data and another session tries to truncate or drop table (or do other DDL operations)?
    It is counter-intuitive. Why not to put TM 2 (SS) lock during SELECT execution that would prevent DDLs on this table?
    What I only can assume is that this is only because some technical difficulty or limitation.
    What is this limitation or other reason in favor of which Oracle sacrificed consistency in this case?

    user11181920 wrote:
    Aman,
    There was no need to clarify how DML lock works, I know that.
    Also I know that in Oracle a Select does not lock neither table rows nor table itself.
    The reason I mentioned it because you brought up the word change which is far better suited for DML's than DDL's as the former has a requirement to have its Undo preserved.
    Again, my question was why Select does not protect itself by locking table(s), partitions and indexes?Protect from what? There is nothing wrong with doing a select. What would happen with a select doing a lock on the table before being executed in its entirety (forget DDL and DML altogether for a moment) ? State one good reason that there should be a lock for the select. If it has to, it would be always isn't it?
    The keyword here is concurrency and that's what is the best when the number of locks obtained are lesser at non-required operations. A select doesn't change anything that's why in Oracle, there is no read-level lock.I am not saying about row locks while reading. They are not needed because Undo resolves concurrency.Only in the case of DML where the change is still active and the buffers are dirty. With a DDL, its an implicit commit.
    I am asking why Select does not enqueue one, only one lock per object that participates in the Select?Again, my question back to you is, what good you would get from it? What purpose it would solve?
    It is not very expensive, I suppose. But it would protect from DDLs that can destroy the Select's result set. You have seen in your system and in my demo(and that's what the the question was on the other thread also) that the result remains intact and its not a behavior from now. Its the same since the time I have started learning Oracle. Can you explain that why you think that the result of select statement would be wrong for a drop table? I believe, its been stated repeatedly that if the select has no requirement to look back the table, it would get completed. Only if the select needs to access the table again, it would fail. So even if we consider your explanation, there is no wrong result shown at all. Once the session encounters that the table is dropped for the statement, the execution stops right away. So where is the destroyed result?
    Yes, it is less dangerous when Select does not lock table comparing with what would happen with DMLs in such case (that is why DMLs protect themselves by TM 3), it affects only the Select and its consumer, but still ... I don't understand this Oracle's decision. What is a reasoning behind it?.As I said, to improve concurrency.
    Aman....

  • Why is my sql running parallel ?

    Hi,
    NOTE: first, I thought sql developer tool is causing this and I opened a thread on that category, thanks to @rp0428's warnings and advises, I realized that something else is happening. so reopened this thread in that category, I also need an admin to delete other one:
    https://forums.oracle.com/forums/thread.jspa?threadID=2420515&tstart=0
    thanks.
    so my problem is:
    I have table partitioned by range (no subpartition) on a DATE column per months. It has almost 100 partitions. I run a query on that table based on partition column:
      select *
      from   hareket_table
      where islem_tar between to_date('01/05/2012', 'dd/mm/yyyy') and to_date('14/07/2012', 'dd/mm/yyyy') -- ISLEM_TAR is my partition column.so, when I run this query from sql developer, query works parallel. I didnt just get execution plan via sql developer interface, first I used "EXPLAIN PLAN FOR" statement (which I always do, I dont use developer tools interfaces generally) then used developer interface (just to be sure) but I didnt satisfied and then I run the query and and get real execution plan via:
    select * from table(dbms_xplan.display_cursor(sql_id => '7cm8cz0k1y0zc', cursor_child_info =>0, format=>'OUTLINE'));and the same execution plan again with PARALLELISM. so INDEXES and TABLE has no parallelism (DEGREE column in DBA_INDEXES and DBA_TABLES is set to 1).
    as I know, if I'm wrong please correct me, there is no reason to oracle run this query as parallel (I also did not give any hint). so I worried and run the same steps in "plsql developer" and query runs noparallel (inteface, explain plan for, dbms_xplan.display_cursor). sqlplus autotrace was the same( just autotrace, didnt try others dbms_xplan etc.) Based on that, I decided sql developer is causing to this (*edit: but I was wrong TOAD did same thing*).
    so I focused on sql developer and I disabled parallel query using:
    alter session disable parallel query;then run the statement again and there were no Parallelism (expectedly).
    so looked for execution plans:
    I run query twice. one with normal, one with session disabled parallel query. and look for executed execution plan for both. (child 0 and 1)
    -- WHEN PARALLEL QUERY IS ENABLE, SESSION DEFAULT
    -- JUST CONNECTED TO DATABASE
      select * from table(dbms_xplan.display_cursor('7cm8cz0k1y0zc', 0, 'OUTLINE'));
    | Id  | Operation            | Name          | Rows  | Bytes | Cost (%CPU)| Time     | Pstart| Pstop |    TQ  |IN-OUT| PQ Distrib |
    |   0 | SELECT STATEMENT     |               |       |       |  2025 (100)|          |       |       |        |      |            |
    |   1 |  PX COORDINATOR      |               |       |       |            |          |       |       |        |      |            |
    |   2 |   PX SEND QC (RANDOM)| :TQ10000      |  7910K|  1267M|  2025   (2)| 00:00:01 |       |       |  Q1,00 | P->S | QC (RAND)  |
    |   3 |    PX BLOCK ITERATOR |               |  7910K|  1267M|  2025   (2)| 00:00:01 |    90 |    92 |  Q1,00 | PCWC |            |
    |*  4 |     TABLE ACCESS FULL| HAREKET_TABLE |  7910K|  1267M|  2025   (2)| 00:00:01 |    90 |    92 |  Q1,00 | PCWP |            |
    Outline Data
      /*+
          BEGIN_OUTLINE_DATA
          IGNORE_OPTIM_EMBEDDED_HINTS
          OPTIMIZER_FEATURES_ENABLE('11.2.0.2')
          DB_VERSION('11.2.0.2')
          OPT_PARAM('query_rewrite_enabled' 'false')
          OPT_PARAM('optimizer_index_cost_adj' 30)
          OPT_PARAM('optimizer_index_caching' 50)
          OPT_PARAM('optimizer_dynamic_sampling' 6)
          ALL_ROWS
          OUTLINE_LEAF(@"SEL$1")
          FULL(@"SEL$1" "HAREKET_TABLE"@"SEL$1")
          END_OUTLINE_DATA
    Predicate Information (identified by operation id):
       4 - access(:Z>=:Z AND :Z<=:Z)
           filter(("ISLEM_TAR">=TO_DATE(' 2012-05-14 00:00:00', 'syyyy-mm-dd hh24:mi:ss') AND "ISLEM_TAR"<=TO_DATE('
                  2012-07-14 00:00:00', 'syyyy-mm-dd hh24:mi:ss')))
    --WHEN DISABLED PARALLEL QUERY
    --AFTER CONNECTED, EXECUTED "ALTER SESSION DISABLE PARALLEL QUERY"
    select * from table(dbms_xplan.display_cursor('7cm8cz0k1y0zc', 1, 'OUTLINE'));
    | Id  | Operation                | Name          | Rows  | Bytes | Cost (%CPU)| Time     | Pstart| Pstop |
    |   0 | SELECT STATEMENT         |               |       |       | 36504 (100)|          |       |       |
    |   1 |  PARTITION RANGE ITERATOR|               |  7910K|  1267M| 36504   (2)| 00:00:04 |    90 |    92 |
    |*  2 |   TABLE ACCESS FULL      | HAREKET_TABLE |  7910K|  1267M| 36504   (2)| 00:00:04 |    90 |    92 |
    Outline Data
      /*+
          BEGIN_OUTLINE_DATA
          IGNORE_OPTIM_EMBEDDED_HINTS
          OPTIMIZER_FEATURES_ENABLE('11.2.0.2')
          DB_VERSION('11.2.0.2')
          OPT_PARAM('query_rewrite_enabled' 'false')
          OPT_PARAM('optimizer_index_cost_adj' 30)
          OPT_PARAM('optimizer_index_caching' 50)
          ALL_ROWS
          OUTLINE_LEAF(@"SEL$1")
          FULL(@"SEL$1" "HAREKET_TABLE"@"SEL$1")
          END_OUTLINE_DATA
    Predicate Information (identified by operation id):
       2 - filter(("ISLEM_TAR">=TO_DATE(' 2012-05-14 00:00:00', 'syyyy-mm-dd hh24:mi:ss') AND
                  "ISLEM_TAR"<=TO_DATE(' 2012-07-14 00:00:00', 'syyyy-mm-dd hh24:mi:ss')))
    as you can see, when I've just connected to database (no any statements run) OPT_PARAM('optimizer_dynamic_sampling' 6) is in my stats.
    when I disable parallel query on the session, this is not in stats...
    value of optimizer_dynamic_sampling is 2 in DB. so why is that query runs parallel ? I don't want that.
    thanks for answers

    >
    NOTE: first, I thought sql developer tool is causing this and I opened a thread on that category, thanks to @rp0428's warnings and advises, I realized that something else is happening. so reopened this thread in that category, I also need an admin to delete other one:
    https://forums.oracle.com/forums/thread.jspa?threadID=2420515&tstart=0
    as you can see, when I've just connected to database (no any statements run) OPT_PARAM('optimizer_dynamic_sampling' 6) is in my stats.
    when I disable parallel query on the session, this is not in stats...
    value of optimizer_dynamic_sampling is 2 in DB. so why is that query runs parallel ? I don't want that.
    >
    I answered this question in that other thread, that is now gone. I pointed you to, and quoted from, a blog that tells you EXACTLY why that is happening. And I also gave you a link to an article by Oracle ACE and noted author Jonathan Lewis. You either didn't see the links or didn't read them.
    Maria Colgan is an Oracle developer and a member of the optimizer developer team. She has many article on the net that talk about the optimizer, how it works, how to use it.
    The one I pointed you to, and quoted from, is titled 'Dynamic sampling and its impact on the Optimizer'
    https://blogs.oracle.com/optimizer/entry/dynamic_sampling_and_its_impact_on_the_optimizer
    >
    For serial SQL statements the dynamic sampling level will depend on the value of the OPTIMIZER_DYNAMIC_SAMPLING parameter and will not be triggered automatically by the optimizer. The reason for this is that serial statements are typically short running and any overhead at compile time could have a huge impact on their performance. Where as we expect parallel statements to be more resource intensive, so the additional overhead at compile time is worth it to ensure we can be best execution plan.
    In our original example the SQL statement is serial, which is why we needed to manual set the value for OPTIMIZER_DYNAMIC_SAMPLING parameter. If we were to issue a similar style of query against a larger table that had the parallel attribute set we can see the dynamic sampling kicking in.
    You should also note that setting OPTIMIZER_FEATURES_ENABLE to 9.2.0 or earlier will disable dynamic sampling all together.
    When should you use dynamic sampling? DS is typically recommended when you know you are getting a bad execution plan due to complex predicates. However, you should try and use an alter session statement to set the value for OPTIMIZER_DYNAMIC_SAMPLING parameter as it can be extremely difficult to come up with a system-wide setting.
    When is it not a good idea to use dynamic sampling? If the queries compile times need to be as fast as possible, for example, unrepeated OLTP queries where you can't amortize the additional cost of compilation over many executions.
    >
    If you read the article and particularly the first two paragraphs above Maria expalins why dynamic sampling was used in your case. And for a table with as many partitions as yours Oracle chose to use sampling level six (256 blocks, see article); a level of two would only sample 64 blocks and you have 90+ partitions. Oracle needs a good sample of partitions.
    The Jonathan Lewis article is titled 'Dynamic Sampling'
    http://jonathanlewis.wordpress.com/2010/02/23/dynamic-sampling/
    This article can also shed light on sampling as he shows how it appears that sampling isn't being used and then shows that it actually is
    >
    We can see that we have statistics.
    We can see that we delete 9002 rows
    We can see that we have 998 rows left
    We can see that the plan (and especially the cardinality of the full tablescan) doesn’t change even though we included a table-level hint to do dynamic sampling.
    Moreoever – we can’t see the usual note that you get when the plan is dependent on a dynamic sample (” – dynamic sampling used for this statement”).
    It looks as if dynamic sampling hasn’t happened.
    However, I “know” that dynamic sampling is supposed to happen unconditionally when you use a table-level hint – so I’m not going to stop at this point. There are cases where you just have to move on from explain plan (or autotrace) and look at the 10053 trace.
    So the optimizer did do dynamic sampling, but then decided that it wasn’t going to use the results for this query.

  • Why does Oracle SQL query returning a date field without the time component

    Hi,
    I'm a novice SQL user & hv just installed Oracle SQL developer (Version 3.0.04, Build MAIN-04.34).
    I made the same SQL query using "Oracle SQL developer" & "TOAD for Oracle 9.0.1" but I got 2 different format on the same date field:
    On TOAD, I get the date field extracted as *04/26/2011 23:12:58*
    On Oracle, I get the date field extracted as *26/APR/11*
    Why is the Oracle result in a different format & missing the time component?
    Is there any option/preference that I need to set in Oracle SQL developer to get the full date/time format displayed?
    I've tried to set my the date format to DD/MON/RR HH12:MI:SSXFF AM under the preference -> database NLS but I still get the same format!
    Plse help!

    hokim wrote:
    Hi,
    I'm a novice SQL user & hv just installed Oracle SQL developer (Version 3.0.04, Build MAIN-04.34).
    I made the same SQL query using "Oracle SQL developer" & "TOAD for Oracle 9.0.1" but I got 2 different format on the same date field:
    On TOAD, I get the date field extracted as *04/26/2011 23:12:58*
    On Oracle, I get the date field extracted as *26/APR/11*
    Why is the Oracle result in a different format & missing the time component?
    Is there any option/preference that I need to set in Oracle SQL developer to get the full date/time format displayed?
    I've tried to set my the date format to DD/MON/RR HH12:MI:SSXFF AM under the preference -> database NLS but I still get the same format!
    Plse help!http://edstevensdba.wordpress.com/category/nls_date_format/

  • Why is my SQL not using an index?

    I have a small SQL query (10g) where I join to basic table together on a customer_id column.
    select *
    from customer c
    inner join work_item sp1 ON sp1.customer_id = c.customer_id
    and I am using TOAD, which tells me (in the Explain Plan area), that I'm doing a "TABLE ACCESS FULL" scan on the customer table.
    But when I look at the details of BOTH tables, I can clearly see that they both have an index on the customer field, and they are both the same data types...
    The interesting thing, is that if I change the query to only select data from the work_item table,
    select sp1.*
    from customer c
    inner join work_item sp1 ON sp1.customer_id = c.customer_id
    I can see that the indexes are being used...
    Why is this? I must be able to select certain columns from the customer table, but why would it not use an index when I do?
    Thanks!

    If I understand correctly, below is a simple test case.
    I created a small table and indexed "object_id" column.
    When I issue "Select * from t" optimizer goes with FULL TABLE SCAN, whereas wehn "select OBJECT_ID from t" is issued, optimizer chooses to read from the index instead of accessing the table. This is because FAST FULL SCAN is far cheaper than a FTS in this case.
    SQL> create table t as select object_id, object_name from all_objects;
    Table created.
    SQL> exec dbms_stats.gather_table_stats(user, 't');
    PL/SQL procedure successfully completed.
    SQL> create index t_idx1 on t(object_id);
    Index created.
    SQL> set autotrace traceonly exp
    SQL> select * from t;
    Execution Plan
    Plan hash value: 1601196873
    | Id  | Operation         | Name | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT  |      | 37932 |  1074K|    55   (2)| 00:00:01 |
    | 1 | TABLE ACCESS FULL| T | 37932 | 1074K| 55 (2)| 00:00:01 |
    SQL> select object_id from t;
    Execution Plan
    Plan hash value: 3958994525
    | Id  | Operation            | Name   | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT     |        | 37932 |   185K|    25   (0)| 00:00:01 |
    | 1 | INDEX FAST FULL SCAN| T_IDX1 | 37932 | 185K| 25 (0)| 00:00:01 |
    SQL>

  • Creating the DDL -- the SQL is the same regardless if the 1 side of the 1:M

    is optional or not.
    Example:
    Entity STUDENT has Student_ID as UID and a Student_Name. Entity LOCKER has LOCKER_ID as its UID and a location.
    I created a sample 1:M relation between STUDENT and LOCKER where each STUDENT may have zero or more LOCKERs and each LOCKER may be owned by one STUDENT.
    The logical model in the data modeler looks like this: STUDENT - - - - - <-LOCKER.
    The DDL generation in the data modeler created this SQL:
    CREATE TABLE Locker
    LockerID NUMBER NOT NULL ,
    LockerLocation VARCHAR2 ,
    Student_ID NUMBER
    ALTER TABLE Locker
    ADD CONSTRAINT Locker_PK PRIMARY KEY ( LockerID ) ;
    CREATE TABLE Student
    Student_ID NUMBER NOT NULL ,
    StudentName VARCHAR2 (20)
    ALTER TABLE Student
    ADD CONSTRAINT Student_PK PRIMARY KEY ( Student_ID ) ;
    ALTER TABLE Locker
    ADD CONSTRAINT Relation_6 FOREIGN KEY
    Student_ID
    REFERENCES Student
    Student_ID
    ON DELETE SET NULL
    I modified the relationship so that each STUDENT MUST have one or more LOCKERs so the logical model now looks like this: STUDENT--- - - - <- LOCKER but the DDL generated the exact same SQL.
    Is this correct or did I forget something in the model?
    Edited by: user2014134 on Jan 16, 2011 11:37 PM

    I tried both version 2 and version 3 of the Oracle data modeler with the same results.
    I'm using the Barker notation for the logical model in case you were thinking that was an arrow pointing to student -- it's actually crow's feet.
    The logical model looks like this when the relationship is not mandatory (e.g. a student may or may not have one or more lockers)
    STUDENT - - - - - - - - - - <- LOCKER
    and the logical model looks like this when the relationship is mandatory (e.g. a student must have one or more lockers)
    STUDENT -- (solid line) -- - - - - - - - - - <- LOCKER
    Should I expect the relational model to be different for both of these? And the DDL as well? The data modeler is showing me the same thing for either (in versions 2 and 3).

  • Why's the SQL format different for the same report on different PCs?

    I have 2 PCs running the same version of Crystal Reports (11.0.0.1994) using an identically configured system DSN with the exact same driver. When I view the SQL that CR is using on PC 1, part of it looks like this:
    " FROM   {oj (("PUB"."LOQEstimate" "LOQEstimate1" LEFT OUTER JOIN "PUB"."LOQComponent" "LOQComponent1" ON ("LOQEstimate1"."Estimate-ID"="LOQComponent1"."Estimate-ID") AND"
    On PC 2 it looks like this:
    "FROM   "PUB"."LOQEstimate" "LOQEstimate1", "PUB"."LOQComponent" "LOQComponent1", "PUB"."CustContact" "CustContact1", "PUB"."LOQSegment" "LOQSegment1"
    WHERE"
    It's the exact same report. Can someone tell me why the SQL is different?
    TIA for the help.

    Thanks for the reply, Patrick. Here are the answers you requested:
    1. Verify you are indeed using the same driver, and they are of the same version
    The driver on both PCs is the Progress OpenEdge 10.1A driver. The file is pgoe1021.dll, version 05.10.0037.
    2. Verify if you have the same database client install on both computer.
    Both use prowin32.exe, v10.1.1.1326
    If everything is the same, then it might be a registry key, and in this case, can you provide the following information:
    1. What database are you connecting to? ( Oracle, DB2, ... )
    Progress OpenEdge 10 RDMS (/community [original link is broken])
    2. What is the version of the database?
    10.1A
    3. What is the version of the database client?
    v10.1.1.1326
    4. How are you connecting to your database? ( Native, ODBC, OLEDB,... )
    ODBC
    5. If you are connecting via ODBC, what is the name of the driver used and it's version?
    The driver is the Progress OpenEdge 10.1A driver. The file is pgoe1021.dll, version 05.10.0037.
    6. What is the SQL query syntax do you prefer? ( PC 1, or the one generated on PC 2 )
    The SQL generated on PC1 doesn't return any records. The SQL generated on PC2 does. Records are preferable ;o)

  • Subject: Why creation of sql profiles take forever

    I am on Oracle 10.2.0.4 on HP UNIX 11i. I am creating sql profiles using following logic. Sometimes sql profile is generated in 1-2 minutes. Many times , even after an hour, no sql profile is created and I get timeout errors . I increased time limit from 3600 (1 hr) to 7200 (2 hrs), still timeout error, why?
    -- Tuning task created for specific a statement from the AWR.
    DECLARE
    l_sql_tune_task_id VARCHAR2(100);
    BEGIN
    l_sql_tune_task_id := DBMS_SQLTUNE.create_tuning_task ( sql_id => '$SQLSTMTID', scope =
    DBMS_SQLTUNE.scope_comprehensive, time_limit => 3600, task_name => '${SQLSTMTID}_AWR_tuning_task', description => 'Tuning task for statement ${SQLSTMTID} in AWR.');
    --DBMS_OUTPUT.put_line('l_sql_tune_task_id: ' || l_sql_tune_task_id);
    END;
    EXEC DBMS_SQLTUNE.execute_tuning_task(task_name => '${SQLSTMTID}_AWR_tuning_task');

    Depending on the complexity of the statement and the underlying objects, the sql tuning advisor will have differing amounts of work to do working through "statistical checks, access path analysis, SQL structure analysis and sql profiling".
    Perhaps see V$ADVISOR_PROGRESS?

  • Why is OEM SQL Monitoring showing parallel on almost every statement

    I'm confused here.
    I'm running Oracle EE 11.2.0.2 and when I look in OEM SQL Monitoring, it shows nearly every sql statement running with a degree of parallelism of *2*.
    I've checked dba_tables and the 'degree' for all tables is only 1.
    I look at the actual sql statement, and there are no hints to tell it to use parallelism.
    So why and how is the database using parallelism?
    I do see that parallel_threads_per_cpu is set to 2, but this is default for our Solaris 10 operating system.
    REF: (for 11.2)
    ===========
    PARALLEL_THREADS_PER_CPU specifies the default degree of parallelism for the instance and determines the parallel adaptive and load balancing algorithms. The parameter describes the number of parallel execution processes or threads that a CPU can handle during parallel execution.
    The default is platform-dependent and is adequate in most cases. You should decrease the value of this parameter if the machine appears to be overloaded when a representative parallel query is executed. You should increase the value if the system is I/O bound.
    I guess the next question here is how to tell if my database is actually IO bound or not?

    Hi John. Thanks for your reply.
    NAME                                 TYPE                             VALUE
    parallel_degree_policy               string                           MANUALAnd so, the more I read about PARALLEL_THREADS_PER_CPU, the more I wonder if I should increase this value.
    But first, I want to understand why I'm seeing parallelism in OEM set to 2 for almost everything that runs in the database, but note, NOT ALL.
    Some queries, especially those running from Crystal Reports, are not using parallelism at all.
    Is it possible to set a parameter at the session level that runs parallelism, and perhaps this is being done by the application?
    I'm going to try increasing my PARALLEL_THREADS_PER_CPU to 4 and see if this changes the parallelism in OEM, (but I doubt it).
    I should note that my most recent AWR report shows my db_file_sequential_read in the top 5 wait events.
    This would imply my index reads and table reads by ROWID are waiting for disk - possibly I/O bound.
    Edited by: 974632 on Jan 28, 2013 10:25 AM

  • Generating DDL from SQL Workshop

    I'm using the Database Cloud Service and am trying to see how I can generate DDL for my tables.
    I looked into the online help, which led me to this:
    http://docs.oracle.com/cd/E37097_01/doc/doc.42/e35128/sql_utl.htm#AEUTL256
    Says to click SQL Workshop -> Utilities -> Generate DDL, but there is no Generate DDL option.  Has the option moved or the name changed?
    Thanks,
    Rick

    Hello Rick -
    The easiest way to get DDL for the tables in your Database Cloud Service is to go to the Cloud Management UI for your Service and click on the Data  Export tab. Click on the Export Data button and just do not check the box for exporting data.  This will give you DDL for your Service.
    Hope this helps.
    - Rick Greenwald

  • Why does PL/SQL not support 0 length strings?

    Why does Trim(' ') return null instead of an empty string?
    Why does '' return null instead of an empty string?
    Because of this, LENGTH(Trim(' ')) returns null. And I want zero.
    I ask because I'm cutting up a string and in other languages (even ones that support Null) when these techniques are used, I get a valid empty string.
    Am I wrong in feeling that an empty string is the equivilent to a 0 in a numeric field and that null in a string is equivilent to null in a numeric field?
    Andy

    For Oracle, by definition, a null string is a string of length 0 since at least Oracle 5.0 (i do not know the previous ones).
    use NVL
    Why does Trim(' ') return null instead of an empty string?
    Why does '' return null instead of an empty string?
    Because of this, LENGTH(Trim(' ')) returns null. And I want zero.
    I ask because I'm cutting up a string and in other languages (even ones that support Null) when these techniques are used, I get a valid empty string.
    Am I wrong in feeling that an empty string is the equivilent to a 0 in a numeric field and that null in a string is equivilent to null in a numeric field?
    Andy

  • Why is the SQL job failing on weekends while it successfully runs in weekdays?

    I wrote a job to create a backup. But this seems to work fine in weekdays. After weekends I can't find any backups. History viewer shows only 1 day of history and therefore I can't see what happened to the job in weekends. How can I increase the amount
    of history information from Job activity monitor? And is there a way to trace what happened in weekends? Please advice.
    mayooran99

    Have you checked the job current schedule ? is this scheduled for daily ? have you checked the backup location ? how many day backups are exist? is there any recent backups ?
    backup details :
    http://www.mssqltips.com/sqlservertip/1601/script-to-retrieve-sql-server-database-backup-history-and-no-backups/
    Change sql agent jobs history retenions :
    --Set new Limit size of job history
    EXEC msdb.dbo.sp_set_sqlagent_properties @jobhistory_max_rows=-1,@jobhistory_max_rows_per_job=-1
    --delete jobhistory older than 7 days and schedule following as a job or use gui
    DECLARE @oldest_date DATETIME
    SET @oldest_date = DATEADD(DAY,-7,GETDATE())
    PRINT @oldest_date
    EXEC msdb..sp_purge_jobhistory NULL,NULL,@oldest_date
    OR
    Rightclick on SQL Server Agent, properties-> History, You can increase the history log size(in rows) and max Job history rows per job .
    OR
    USE[msdb]
    GO
    EXEC[dbo].[sp_set_sqlagent_properties]
    @jobhistory_max_rows=10000,
    @jobhistory_max_rows_per_job=1000
    GOReference :http://msdn.microsoft.com/en-us/library/ms189683.aspxhttp://sqlserverplanet.com/dba/increase-job-history
    Raju Rasagounder Sr MSSQL DBA

  • Why are these SQL Exceptions coming?

    I have developed a web based application in which I am experiencing two exceptions coming after a periodic time.
    1)Exception : java.sql.SQLException: ORA-01000: maximum open cursors exceeded
    2)Exception : java.sql.SQLException: The url cannot be null
    The applications works fine when the webserver is restarted. What can be the probable reasons for these exceptions?

    Wrong forum... JDBC Forum: http://forum.java.sun.com/forum.jsp?forum=48
    1)Exception : java.sql.SQLException: ORA-01000: maximum open cursors exceededYou are not closing ur statments / prepared statments / callable statments after use.
    e.g.
    Statement st = connection.createStatement();
    try
      //execute some qwerys / do some updates
    catch( SQLException sqe )
      //handle exception
    finally
      st.close();
    } 2)Exception : java.sql.SQLException: The url cannot be nullI am guessing that the URL is null... where is the exception occouring????

Maybe you are looking for