How to present Oracle's relative functions in DB2 (III.)

Source: Internet
Author: User
Tags continue db2 insert relative
Oracle
How to present Oracle's relative functions in DB2 (III.)
Author:ccbzzp
In reality, you may often encounter some of the functions of Oracle in DB2,
Here I simply conclude that there may be many ways in which a function can be found, not all of which are listed here,
Welcome to all of you to continue, in order to share with you, to explore together, common approach! (the following are mainly Oracle
8i,9i and DB2 7.X for example).
1. How to find out how many examples of Oracle and DB2 write
Oracle can actually do this:
Sql>select * from V$instance;
DB2 can actually do this:
To perform db2ilist in a command window
2. How to find out how many tables Oracle and DB2 are written in the data library
Oracle can actually do this:
Sql>select * from All_tables;
DB2 can actually do this:
Execute at command center.
SELECT * from Syscat.tables;
3. How to know the situation of the table lock the Oracle and DB2 write method
Oracle can actually do this:
Sql>select S.sid session_id, S.username, DECODE (lmode, 0, ' None ', 1, ' Null ', 2, ' Row-s (SS) ', 3, ' Row-x (SX) ', 4, ' S Hare ', 5, ' S/row-x (SSX) ', 6, ' Exclusive ', To_char (Lmode)) Mode_held, DECODE (REQUEST, 0, ' None ', 1, ' Null ', 2, ' Row-s (S) S) ', 3, ' Row-x (SX) ', 4, ' Share ', 5, ' S/row-x (SSX) ', 6, ' Exclusive ', To_char (REQUEST)) mode_requested, o.owner| | | o.object_name| | ' ('|| o.object_type| | ') ', S.type Lock_type, L.id1 lock_id1, L.id2 lock_id2 from V$lock L, SYS. Dba_objects O, v$session S WHERE l.sid = s.sid and l.id1 = o.object_id
DB2 can actually do this:
Before you execute your stored procedure, perform commands to unlock the monitor
DB2 Update monisor switches using lock on;
Then execute your stored procedure and use the command during the execution of the stored procedure
DB2 get snapshot to locks on yourdatdabasename;
You can see the lock.
4. How to unlock the lock of the table of Oracle and DB2 write method
Oracle can actually do this:
Sql>alter system kill session ' sid,service# ';
DB2 can actually do this:
DB2 force application All;
DB2 terminate;
5. Oracle and DB2 notation used to test SQL language sentences
Oracle can actually do this:
Sql>set timing on;
Sql>select * FROM TableName;
DB2 can actually do this:
DB2BATCH-D Library name-F contains the file name of the SQL statement;
6. How to configure the sequence Oracle and DB2 write method
Oracle can actually do this:
Jian sequence Seq_custid
Create sequence Seq_custid start 1 incrememt by 1;
When building a table:
CREATE TABLE Cust
{cust_id smallint NOT NULL,
...}
When insert:
INSERT INTO Table Cust
VALUES (Seq_cust.nextval, ...)
DB2 can actually do this:
Identity Field Property Usage:
When CREATE table
cust_id smallint NOT NULL generated always as indentity (start with
1 Increment by 1)
When insert:
INSERT INTO Table cust (cust_id, ...)
VALUES (default, ...)

To continue ...







Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.