Pages

Search

Monday, July 13, 2009

Steps In Creating Instance and Database in IBM DB2

01. Click Start on the Windows Toolbar

02. Click Run...

03. Type db2cw on the Open combo box and click OK button

=== please wait until DOS Prompt appears

04. On the DB2 Command Window, type the following commands and press Enter key for each line of command:

db2icrt DEV

db2 CATALOG LOCAL NODE DEV INSTANCE DEV SYSTEM OSTYPE WIN WITH 'Instance for OIS'

=== Substitute with the full computer name of the computer
=== You can see the full computer name by: right-click My Computer, Select Properties and Click Network Identification

05. Start DB2 - DEV instance on Services

=== make it automatic
=== Select This account on Log On tab
=== User name .\db2admin
=== Password password
=== Confirm password password

06. Start DB2 Governor on Services

=== make it automatic

07. On the DB2 Command Window, type the following commands and press Enter key for each line of command:

db2 ATTACH TO DEV

db2 CREATE DATABASE OIS ON C: WITH 'Database for OIS'

=== please wait until DOS Prompt appears

exit

08. Click Start on the Windows Toolbar

09. Click Run...

10. Type db2ca on the Open combo box and click OK button

=== please wait until Configuration Assitant appears

11. On the pane, right-click OIS and click Change Database...

=== please wait until Change Database Wizard appears

12. Click Database

13. Type S_OIS on Database alias text box and click Next button

14. Enter the following parameters:

Register this database for ODBC checked
As system data source selected
As user data source unselected
As file data source unselected
Data source name S_OIS
Optimize for application None

15. Click Finish button

16. Close the Configuration Assistant.

17. Open Data Sources (ODBC) on Administrative Tools

18. On System DSN tab, select S_OIS and click Configure button

19. Enter the following parameters:

Data source anme S_OIS
Description
User ID db2admin
Password password
Save Password checked (click OK button on the DB2 Message)

20. Click Connect button

=== DB2 Message must be "Connection tested successfully"
(click OK button on the DB2 Message)

21. Click Bind CLI/ODBC support utilities button

=== There must be result and click OK button

22. Click OK button

23. Click OK button

24. Click Start on the Windows Toolbar

25. Click Run...

26. Type db2cc on the Open combo box and click OK button

=== please wait until Control Center appears

27. On the Object View pane, click nodes of All Systems, , Instances until DEV instance OISplayed

28. Richt-click DEV instance and click Setup communications

29. Enter the following parameters:

NetBIOS unchecked
TCP/IP checked
NPIPE unchecked


30. Click Properties(2) button

31. Enter the following parameters:

Host name
Service name applctn
Port number 50001

32. Click OK button

=== message will appear

33. Click Close button

33. Click OK button

=== message will appear

34. Click Close button

35. Richt-click DEV instance and click Stop

36. Click OK button

=== message will appear

37. Click Close button

38. Richt-click DEV instance and click Start

=== message will appear

39. Click Close button

40. Close the Control Center.

How To Reseed Table Identity on SQL

To reseed table identity in SQL we will going to use the function DBCC CHECKIDENT

Syntax

DBCC CHECKIDENT
( 'table_name'
[ , { NORESEED
| { RESEED [ , new_reseed_value ] }
}
]
)

Arguments

'table_name'

Is the name of the table for which to check the current identity value. Table names must conform to the rules for identifiers. For more information, see Using Identifiers. The table specified must contain an identity column.

NORESEED

Specifies that the current identity value should not be corrected.

RESEED

Specifies that the current identity value should be corrected.

new_reseed_value

Is the value to use in reseeding the identity column.


Example:

DBCC CHECKIDENT (My_Table, reseed, 0)

This example will reseed table My_Table, and the identity seed will start 1 again