IBM DB2 Daily Maintenance Summary (vi) _DB2

Source: Internet
Author: User
Tags db2 db2 port error code ibm db2 table definition
The DB2 tutorial you are looking at is: IBM DB2 Daily Maintenance Summary (vi). 91. How do I create a DB2 summary table?
DB2 's summary table functionality is similar to the materialized view of Oracle!
The syntax is:
Createsummarytabletable_nameas (fullselect) ...
For example:
Define a summary table that can be refreshed:
Createsummarytabletable_nameas (select*fromtable_name1wherecol1= ' AAA ')
Datainitiallydeferredrefreshdeferred
Where datainitiallydeferred stipulates that data cannot be inserted into a table as part of a createtable statement.
Refreshdeferred specify that the data in the table can be refreshed at any time when the refreshtable statement is used!
  
92. How do I refresh the summary table?
Refreshtablesum_table
Where sum_table is a summary table.
  
93. How do I modify the summary table?
Altertablesum_table ...
  
94. How do I create a temporary table?
Grammar:
Declareglobaltemporarytabletable_name
As (Fullselect) definitiononly
Excludingidentitycolumnattributes
Oncommitdeleterows
Notlogged
The first line stipulates the name of the temporary table.
The second row defines the columns of the temporary table.
The third line stipulates that the identity column is not replicated from the source result table definition.
Line four stipulates that if you do not open the Withgold cursor, all rows of the table will be deleted.
Line five provides no record of changes to the table.
For example:
Declareglobaltemporarytabledec_bsempms
As (SELECT*FROMBSEMPMS) definitiononly
Excludingidentitycolumnattributes
Oncommitdeleterows
Notlogged
  
95. Management of views?
How to create a view:
Createviewview_nameasselect*fromtable_namewhere ...
To delete a view:
Dropviewview_name
  
96. How do I know what the view definition is?
Select*fromsyscat. Text column in the views.
  
97. How do I create an alias?
Createaliasalias_nameforpro_name
The pro_name in the back can be table,view,alias,nickname and so on.
  
98. How do I create a sequence?
For example:
Createsequencesequence_name
Startwithstart_number
INCREMENTBYVALUE1
Nomaxvalue
Nocycle
Cachemaximumnumberofsequencevalues
The first line prescribes the name of the sequence.
The second line sets the starting value of the sequence.
The third line sets the range of the new each time.
There is no maximum numerical limit for the four-line rule.
Line five provides maximum numerical limit.

99. How do I change the sequence?
Altersequencesequence_name ...
Parameters that can be modified
Startwith's Start_number
Increment's VALUE1
Number of Nomaxvalue
Nocycle Property
Maximumnumberofsequencevalues Maximum Value
  
100. How do I delete a sequence?
Dropsequencesequence_name
  
101.DB2 the file format that supports importing (import) has?
There are: del,asc,ixf,wsf, etc.

102.DB2 the file format that supports exporting (export) has?
There are: Del,ixf,wsf and so on.
The ASC format is not supported.
  
103.DB2 support Load (load) file formats are available?
There are: DEL,ASC,IXF and so on.
WSF format is not supported.
  
104.DB2 support for Db2move file format?
There are: IXF and so on.
ASC,DEL,WSF format is not supported.
  
105.DB2 the two components of database monitoring?
Snapshot monitoring (Snapshotmonitor) returns a snapshot of the database activity at a specific point in time.
Event Monitoring (Eventmonitor) records the data in which the event occurred.
  
106. What types of data elements are monitored by the system?
Counter (COUNTER) to record the number of times the activity occurred.
Measure (gauge) The current value of a measure entry.
Watermark (watermark) The maximum or minimum number of elements reached from the monitor.
Information (information) monitors the details of the activity's reference type.
Date time that the Point-in-time (TIMESTAMP) activity occurred.
Time returns the time that an activity took.
  
107. How do I know the number of pages required for the monitoring heap?
(numberofmonitoringapplications+1) * (numberofdatabases* 800+ (numberoftables
  
ACCESSED*20) + ((numberofapplicationsconnected+1) * (200+ numberoftable
  
spaces*100)))/4096
Its size is controlled by the parameter MON_HEAD_SZ.
  
108. How to build Event monitor?
Createeventmonitortablemonfortableswritetofile ' D:\TEMP '
  
109. How do I activate the event monitor?
SETEVENTMONITORTABLEMONSTATE1
  
110. How do I stop the event monitor?
SETEVENTMONITORTABLEMONSTATE0
  
111. How to query the status of the monitor?
Selectevmonname,event_mon_state (Evmonname) fromsyscat. Eventmonitors

112. How do I remove the event monitor?
Dropeventmonitortablemon
  
113.UNIX the difference between creating a pipe event monitor (pipe evnt see Monitor) on Windows?
First step: Define Event Monitor
Unix:
Connecttosample
Createeventmonitorstmb2forstatementswritetopipe '/tmp/evpipe1 '
Windows:
Connecttosample
Createeventmonitorstmb2forstatementswritetopipe ' \\.\tmp\evpipe1 '

Step two: Establish Named pipes
Unix:
You can use the Mkfifo () function or the Mkfifo command.
Windows:
You can use the CreateNamedPipe () function, which has the same pipe name as the Createeventmonitor rule name.
  
Step three: Open Named pipes
Unix:
Use the open () function.
Windows:
Use the Connectnamedpipe () function.
You can also use the Db2evmon command, such as:
Db2evmon-dbsample-evmstmb2
  
Step Fourth: Activate the named pipe Event Monitor
Unless the named pipe Event Monitor is activated automatically,
Seteventmonitorstmb2state1

Step Fifth: Read data from Named pipes
Unix:
You can use the Read () function.
Windows:
You can use the ReadFile () function.

Step Sixth: Stop the event monitor
Seteventmonitorstmb2state0
  
Step seventh: Close the named pipe
Unix:
You can use the close (

[1] [2] Next page

The DB2 tutorial you are looking at is: IBM DB2 Daily Maintenance Summary (vi). function.
Windows:
You can use the Disconnectnamedpipe () function.
  
Step eighth: Delete Named pipes
Unix:
You can use the unlink () function.
Windows:
You can use the CloseHandle () function.
  
Categories of SQL statements for 114.DB2
DCL: A Data Control language that provides access to database objects.
DDL: Data definition language, creating, modifying, and deleting database objects.
DML: A data manipulation language used to insert, update, and delete data.

What are the 115.DCL permissions?
CONTROL permission: If a user creates an object, the user is able to access the object completely.
The GRANT statement grants permissions to the user.
The REVOKE statement revokes the permissions of a user.

What are the 116.DDL?
CREATE
DECLARE
Alter
DROP
Wait

What are the 117.DML?
INSERT
SELECT
UPDATE
DELETE
Wait
  
Is there a Boolean type 118.db2?
No
  
119. How to query DB2 's built-in functions?
Self-contained document Administion-->sqlreference-->functions

120. How do I execute a DB2 script file?
Db2-vtffilename
  
The rownum () of 121.DB2 as Oracle is?
Row_number () over ()
  
122.db2 How do I get a description of the error code?
DB2? SQLCODE

varchar in 123.DB2 is converted to integer function?
CAST ()
  
The integer in the 124.DB2 is converted to the varchar function.
CHAR ()
  
125.DB2 the varchar converted to date is a function of
DATE ()
  
126.DB2 the date in the varchar is converted to a function of?
CHAR ()
  
Can the trigger in 127.DB2 be modified?
No, you can only delete the rebuild
  
128.WINDOWS how to know the DB2 port number?
\winnt\system32\drivers\etc\services
  
129.db2 How do I execute a stored procedure?
Can Db2callprocedure_name
  
130. How to enter the DB2 DOS command mode?
Db2cmd
  
131. How do I get the DB2 process number?
Db2listapplications
  
132. How to kill the DB2 process?
Forceapplication (ID)
  
133.A User installs DB2, how to start database with B user?
Add in. Profile under B user
./home/db2inst/sqllib/db2profile
  
Oracle-like snapshots in 134.DB2?
Summarytable

prev [1] [2]

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.