Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What is the process of building a db2 database?

2025-04-05 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)05/31 Report--

Db2 database building process is how, many novices are not very clear about this, in order to help you solve this problem, the following editor will explain in detail for you, people with this need can come to learn, I hope you can gain something.

Start building the library

1. Set up a user group AIX

Mkgroup db2iadm1 (the group where the instance is placed) mkgroup db2fadm1

Mkgroup dasadm1 (dasadm needs to set up a group if required, usually not)

LINUX

/ usr/sbin/groupadd db2iadm1 / usr/sbin/groupadd db2fadm1

/ usr/sbin/groupadd dasadm1 (not required, usually not built)

two。 Create a user and set the password AIX

Mkuser groups=db2iadm1 home=/home/snuaasit db2inst1 (instance user)

Mkuser groups=db2fadm1 home=/home/db2fenc1 db2fenc1 (protected users) mkuser groups=dasadm1 home=/home/dasusr1 dasusr1 (generally not built by das users)

Mkuser groups=staff home=/home/db2admin db2admin (data source user)

/ usr/sbin/groupdel db2adm1 (delete group)

Passwd db2inst1 passwd db2fenc1

Passwd dasusr1 (change password command: passwd user name (prompt to change password))

Passwd db2admin (need su-any user, and then su-return the user who needs to change the password to confirm so that the password will not be prompted for error)

LINUX

/ usr/sbin/useradd-m-g db2iadm1-d / home/db2inst1 db2inst1 / usr/sbin/useradd-m-g db2fadm1-d / home/db2fenc1 db2fenc1 / usr/sbin/useradd-m-g staff-d / home/db2admin db2admin

/ usr/sbin/userdel-m-g staff-d / home/db2admin db2admin (delete user) rm-rf db2inst (user name)

Passwd db2inst1

Passwd db2fenc1 (change password command: passwd user name (prompt to change password))

Passwd db2admin (need su-any user, and then su-return the user who needs to change the password to confirm so that the password will not be prompted for error)

3. Create an instance and modify the necessary parameters AIX

Cd / opt/IBM/db2/V9.7/instance (enter the / opt/ibm/db2/V9.7/instance directory to execute the command). / db2icrt-a server-u db2fenc1 db2inst1

. / dascrt-u dasusr1

LINUX

Cd / opt/ibm/db2/V9.7/instance

. / db2icrt-a server-u db2fenc1 db2inst1

. / dascrt-u dasusr1

AIX and LINUX (MUST)

Su-db2inst1

Db2set DB2COMM=TCPIP (modify TCP/IP variable) db2 get dbm cfg | grep-I svcename (modify the port number of instance parameter)

Cat / etc/services (check the port number automatically assigned by the instance and modify it with the following statement)

Db2 update dbm cfg using svcename xxxxxx

4. Change the parameters of the database construction mode

Chown db2admin:staff / db2data (add instance access rights ps: need to be executed under root user, otherwise there may be no permissions if there is any error in the database building statement) chown db2inst1:db2iadm1 / db2data/

Chown db2inst1:db2iadm1 / db2data/db2log chown db2inst1:db2iadm1 / db2data/db2arch

Db2 "create database dbname AUTOMATIC STORAGE YES ON / db2data (data file directory, usually placed in a mounted directory with a large capacity) DBPATH ON / db2data (database directory) USING CODESET UTF-8 TERRITORY CN COLLATE USING SYSTEM"

Db2 create schema db2inst1 authorization yunwei (created the db2inst1 schema and authorized it to yunwei)

Db2 update db cfg for dbname using LOCKTIMEOUT 15 (usually 15 when changing the lock)

Db2 update db cfg for suning using NEWLOGPATH / db2data/db2log (modify the log path, set it if required, default if not required)

Db2 update db cfg for UIMGDB using logarchmeth2 disk:/db2data/db2arch (modify the archive log, you'd better change the path of the production library, don't OFF)

Db2 backup db SAMDB to / dev/null (initial backup, execution of the above sentence must be accompanied by the following sentence, otherwise an error SQL1116N will be reported)

Db2 update dbm cfg using INSTANCE_MEMORY 9751750 (80% of physical memory)

Db2 update db cfg for SAMDB using DATABASE_MEMORY 6826220 (70% of instance memory)

Db2 "SELECT * FROM SYSCAT.BUFFERPOOLS"

Db2 "alter bufferpool IBMDEFAULTBP size 3413100" (50% of database size)

Db2 grant dbadm on database to user db2admin (permissions assigned by data source users)

(here is a small method of assigning query permissions to operation and maintenance users.) vi test.ddl (create a .ddl file to hold the following statement)

Select 'grant select on table' | | rtrim (tabschema) | |'. "| tabname | |'" to user yunwei;' from syscat.tables; (build query and weighting statements are merged, and query permissions for building all tables are granted to yunwei users)

Db2-txf test.ddl > test.sql

Db2-tvf test.sql > test.out

Is it helpful for you to read the above content? If you want to know more about the relevant knowledge or read more related articles, please follow the industry information channel, thank you for your support.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report