Differenze tra le versioni di "IBM DB2"

Da WikiSitech.
Vai alla navigazioneVai alla ricerca
 
(2 versioni intermedie di uno stesso utente non sono mostrate)
Riga 2: Riga 2:
 
Guida di riferimento della versione [http://www-01.ibm.com/support/knowledgecenter/SSEPGG_10.1.0/com.ibm.db2.luw.kc.doc/welcome.html 10.1]<br>
 
Guida di riferimento della versione [http://www-01.ibm.com/support/knowledgecenter/SSEPGG_10.1.0/com.ibm.db2.luw.kc.doc/welcome.html 10.1]<br>
 
Guida di riferimento della versione [http://www-01.ibm.com/support/knowledgecenter/SSEPGG_10.5.0/com.ibm.db2.luw.kc.doc/welcome.html 10.5]
 
Guida di riferimento della versione [http://www-01.ibm.com/support/knowledgecenter/SSEPGG_10.5.0/com.ibm.db2.luw.kc.doc/welcome.html 10.5]
 +
== Installazione ==
 +
DB2 10.5 install (Ubuntu 14.04) in text mode
 +
 +
 +
=== PREPARATION ===
 +
 +
j@linux:~/install$ uname -a
 +
Linux linux-BPM857-x64 4.4.0-31-generic #50~14.04.1-Ubuntu SMP Wed Jul 13 01:07:32 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
 +
 +
Unpack setup file then change directory to '''server''' folder.<br>
 +
 +
j@linux:~/install$ cd server/
 +
 +
First of all – we need to pass whole prerequisities requirements.
 +
 +
j@linux:~/install/server$ ./db2prereqcheck
 +
 +
Don´t be scared from many output lines (512+). This utility is generic for testing requirements from DB2 9.8 – DB2 10.5, including subversions. We´re interested in 10.5 installation process = first lines are important for us:
 +
 +
libstdc++.so.6 is installed in 64-bit, not installed in 32-bit. I bet this wouldn´t be a problem, anyway:
 +
 +
root@linux:~# apt-get install lib32stdc++6
 +
 +
Running again db2prereqcheck is verifying our action:
 +
 +
Validating „32 bit version of „libstdc++.so.6″ “ …
 +
  Found the 64 bit „/usr/lib/x86_64-linux-gnu/libstdc++.so.6“ in the following directory „/usr/lib/x86_64-linux-gnu“.
 +
  Found the 32 bit „/usr/lib32/libstdc++.so.6“ in the following directory „/usr/lib32“.
 +
  Requirement matched.
 +
 +
Done.
 +
 +
Validating „/lib/libpam.so*“ …
 +
  DBT3514W  The db2prereqcheck utility failed to find the following 32-bit library file: „/lib/libpam.so*“.
 +
  WARNING : Requirement not matched.
 +
 +
is more tricky :-) It´s always when you are trying to do anything with 32-bit library inside 64-bit OS during installation 64-bit software 😉
 +
 +
=== INSTALLATION ===
 +
 +
root@linux:/home/j/install/server# ./db2_install
 +
Requirement not matched for DB2 database „Server“ . Version: „10.5.0.0“.
 +
Summary of prerequisites that are not met on the current system:
 +
  DBT3514W  The db2prereqcheck utility failed to find the following 32-bit library file: „/lib/libpam.so*“.
 +
 +
DBI1324W  Support of the db2_install command is deprecated. For
 +
      more information, see the DB2 Information Center.
 +
 +
 +
Default directory for installation of products – /opt/ibm/db2/V10.5
 +
 +
***********************************************************
 +
Install into default directory (/opt/ibm/db2/V10.5) ? [yes/no]
 +
 +
Select '''yes'''
 +
 +
 +
Specify one of the following keywords to install DB2 products.
 +
 +
  SERVER
 +
  CONSV
 +
  EXP
 +
  CLIENT
 +
  RTCL
 +
 +
Select '''SERVER'''
 +
 +
***********************************************************
 +
Do you want to install the DB2 pureScale Feature? [yes/no]
 +
 +
Select '''no'''
 +
 +
Requirement not matched for DB2 database „Server“ . Version: „10.5.0.0“.
 +
Summary of prerequisites that are not met on the current system:
 +
  DBT3514W  The db2prereqcheck utility failed to find the following 32-bit library file: „/lib/libpam.so*“.
 +
 +
DB2 installation is being initialized.
 +
 +
Total number of tasks to be performed: 46
 +
Total estimated time for all tasks to be performed: 1521 second(s)
 +
 +
...
 +
 +
The execution completed successfully.
 +
 +
For more information see the DB2 installation log at /tmp/db2_install.log.7525“.
 +
 +
Installation is done.
 +
 +
=== CONFIGURATION ===
 +
 +
root@linux:/home/j/install/server# groupadd -g 999 db2iadm1
 +
root@linux:/home/j/install/server# groupadd -g 998 db2fadm1
 +
root@linux:/home/j/install/server# groupadd -g 997 dasadm1
 +
root@linux:/home/j/install/server# useradd -u 1004 -g db2iadm1 -m -d /home/db2inst1 db2inst1
 +
root@linux:/home/j/install/server# useradd -u 1003 -g db2fadm1 -m -d /home/db2fenc1 db2fenc1
 +
root@linux:/home/j/install/server# useradd -u 1002 -g dasadm1 -m -d /home/dasusr1 dasusr1
 +
 +
root@linux:/home/j/install/server#  passwd db2inst1
 +
Enter new UNIX password:
 +
Retype new UNIX password:
 +
passwd: password updated successfully
 +
 +
root@linux:/home/j/install/server# passwd db2fenc1
 +
Enter new UNIX password:
 +
Retype new UNIX password:
 +
passwd: password updated successfully
 +
 +
root@linux:/home/j/install/server# passwd dasusr1
 +
Enter new UNIX password:
 +
Retype new UNIX password:
 +
passwd: password updated successfully
 +
 +
DAS creating:
 +
 +
root@linux:/opt/ibm/db2/V10.5/instance# ./dascrt -u dasusr1
 +
DBI1070I  Program dascrt completed successfully.
 +
 +
root@linux:/home/j/install/server# cd /opt/ibm/db2/V10.5/instance
 +
root@linux:/opt/ibm/db2/V10.5/instance# ./db2icrt -a server -u db2fenc1 db2inst1
 +
DBI1446I  The db2icrt command is running.
 +
 +
DB2 installation is being initialized.
 +
 +
Total number of tasks to be performed: 4
 +
Total estimated time for all tasks to be performed: 309 second(s)
 +
 +
Ok, we have created database instance db2inst1. Time for start database manager + create sample database called SAMPLE :-) Beware to use bash as shell…
 +
 +
db2inst1@linux:/home/j$ db2start
 +
db2start: error while loading shared libraries: libaio.so.1: cannot open shared object file: No such file or directory
 +
 +
Well, can happen – we need to install libaio library….
 +
 +
root@debian:~# apt-get install libaio-dev
 +
 +
And now
 +
 +
db2inst1@debian:/home/j$ db2start
 +
01/28/2014 11:28:39    0  0  SQL1063N  DB2START processing was successful.
 +
SQL1063N  DB2START processing was successful.
 +
 
== Gestione delle istanze del DB ==
 
== Gestione delle istanze del DB ==
  
Riga 43: Riga 185:
 
* Creazione dei bufferpool aggiuntivi
 
* Creazione dei bufferpool aggiuntivi
 
: In caso di errori che richiedano bufferpool aggiuntivi per pagine di dimensioni diverse dal default (4K), eseguire i seguenti comandi:
 
: In caso di errori che richiedano bufferpool aggiuntivi per pagine di dimensioni diverse dal default (4K), eseguire i seguenti comandi:
<code sql>
+
CREATE BUFFERPOOL BUFFERPOOL_8K IMMEDIATE ALL DBPARTITIONNUMS SIZE 1000 AUTOMATIC PAGESIZE 8192;
CREATE BUFFERPOOL BUFFERPOOL_8K IMMEDIATE ALL DBPARTITIONNUMS SIZE 1000 AUTOMATIC PAGESIZE 8192;
+
CREATE BUFFERPOOL BUFFERPOOL_16K IMMEDIATE ALL DBPARTITIONNUMS SIZE 1000 AUTOMATIC PAGESIZE 16384;
CREATE BUFFERPOOL BUFFERPOOL_16K IMMEDIATE ALL DBPARTITIONNUMS SIZE 1000 AUTOMATIC PAGESIZE 16384;
+
CREATE BUFFERPOOL BUFFERPOOL_32K IMMEDIATE ALL DBPARTITIONNUMS SIZE 1000 AUTOMATIC PAGESIZE 32768;
CREATE BUFFERPOOL BUFFERPOOL_32K IMMEDIATE ALL DBPARTITIONNUMS SIZE 1000 AUTOMATIC PAGESIZE 32768;
 
</code>
 
 
<br>
 
<br>
 
* Creazione di tablespace utente
 
* Creazione di tablespace utente
 
: In caso di errore SQLCODE=-286, SQLSTATE=42727, è necessario creare i tablespace di database aggiuntivi per le dimensioni di pagina mancanti (di default viene creata solo quella da 4K). Prima di procedere è necessario che i BUFFERPOOL corrispondenti siano disponibili. I comandi da eseguire sono i seguenti:
 
: In caso di errore SQLCODE=-286, SQLSTATE=42727, è necessario creare i tablespace di database aggiuntivi per le dimensioni di pagina mancanti (di default viene creata solo quella da 4K). Prima di procedere è necessario che i BUFFERPOOL corrispondenti siano disponibili. I comandi da eseguire sono i seguenti:
  
<code sql>
+
CREATE TABLESPACE USERSPACE2 PAGESIZE 8192 MANAGED BY SYSTEM USING ('<path-to-userspace>') BUFFERPOOL BUFFERPOOL_8K;
CREATE TABLESPACE USERSPACE2 PAGESIZE 8192 MANAGED BY SYSTEM USING ('<path-to-userspace>') BUFFERPOOL BUFFERPOOL_8K;
+
CREATE TABLESPACE USERSPACE3 PAGESIZE 16384 MANAGED BY SYSTEM USING ('<path-to-userspace>') BUFFERPOOL BUFFERPOOL_16K;
CREATE TABLESPACE USERSPACE3 PAGESIZE 16384 MANAGED BY SYSTEM USING ('<path-to-userspace>') BUFFERPOOL BUFFERPOOL_16K;
+
CREATE TABLESPACE USERSPACE4 PAGESIZE 32768 MANAGED BY SYSTEM USING ('<path-to-userspace>') BUFFERPOOL BUFFERPOOL_32K;
CREATE TABLESPACE USERSPACE4 PAGESIZE 32768 MANAGED BY SYSTEM USING ('<path-to-userspace>') BUFFERPOOL BUFFERPOOL_32K;
 
</code>
 
 
<br>
 
<br>
 
* Creazione di tablespace di sistema
 
* Creazione di tablespace di sistema
 
: In caso di errore SQLCODE=-1585, SQLSTATE=54048, in base all'articolo della [https://www-304.ibm.com/support/docview.wss?uid=swg21529563 KB IBM], è necessario creare i Tablespace di sistema aggiuntivi per le dimensioni di pagina mancanti (di default viene creata solo quella da 4K). Prima di procedere è necessario che i BUFFERPOOL corrispondenti siano disponibili. I comandi da eseguire sono i seguenti:
 
: In caso di errore SQLCODE=-1585, SQLSTATE=54048, in base all'articolo della [https://www-304.ibm.com/support/docview.wss?uid=swg21529563 KB IBM], è necessario creare i Tablespace di sistema aggiuntivi per le dimensioni di pagina mancanti (di default viene creata solo quella da 4K). Prima di procedere è necessario che i BUFFERPOOL corrispondenti siano disponibili. I comandi da eseguire sono i seguenti:
<sql>
+
 
CREATE SYSTEM TEMPORARY TABLESPACE STB_8 IN DATABASE PARTITION GROUP IBMTEMPGROUP PAGESIZE 8192 MANAGED BY AUTOMATIC STORAGE USING STOGROUP IBMSTOGROUP BUFFERPOOL BUFFERPOOL_8K
+
CREATE SYSTEM TEMPORARY TABLESPACE STB_8 IN DATABASE PARTITION GROUP IBMTEMPGROUP PAGESIZE 8192 MANAGED BY AUTOMATIC STORAGE USING STOGROUP IBMSTOGROUP BUFFERPOOL BUFFERPOOL_8K
CREATE SYSTEM TEMPORARY TABLESPACE STB_16 IN DATABASE PARTITION GROUP IBMTEMPGROUP PAGESIZE 16384 MANAGED BY AUTOMATIC STORAGE USING STOGROUP IBMSTOGROUP BUFFERPOOL BUFFERPOOL_16K
+
CREATE SYSTEM TEMPORARY TABLESPACE STB_16 IN DATABASE PARTITION GROUP IBMTEMPGROUP PAGESIZE 16384 MANAGED BY AUTOMATIC STORAGE USING STOGROUP IBMSTOGROUP BUFFERPOOL BUFFERPOOL_16K
CREATE SYSTEM TEMPORARY TABLESPACE STB_32 IN DATABASE PARTITION GROUP IBMTEMPGROUP PAGESIZE 32768 MANAGED BY AUTOMATIC STORAGE USING STOGROUP IBMSTOGROUP BUFFERPOOL BUFFERPOOL_32K
+
CREATE SYSTEM TEMPORARY TABLESPACE STB_32 IN DATABASE PARTITION GROUP IBMTEMPGROUP PAGESIZE 32768 MANAGED BY AUTOMATIC STORAGE USING STOGROUP IBMSTOGROUP BUFFERPOOL BUFFERPOOL_32K
</sql>
 
 
[[Category:IBMDB2]]
 
[[Category:IBMDB2]]

Versione attuale delle 18:50, 12 dic 2016

DB2 Database Server - Appunti di gestione

Guida di riferimento della versione 10.1
Guida di riferimento della versione 10.5

Installazione

DB2 10.5 install (Ubuntu 14.04) in text mode


PREPARATION

j@linux:~/install$ uname -a

Linux linux-BPM857-x64 4.4.0-31-generic #50~14.04.1-Ubuntu SMP Wed Jul 13 01:07:32 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux

Unpack setup file then change directory to server folder.

j@linux:~/install$ cd server/
First of all – we need to pass whole prerequisities requirements.
j@linux:~/install/server$ ./db2prereqcheck

Don´t be scared from many output lines (512+). This utility is generic for testing requirements from DB2 9.8 – DB2 10.5, including subversions. We´re interested in 10.5 installation process = first lines are important for us:

libstdc++.so.6 is installed in 64-bit, not installed in 32-bit. I bet this wouldn´t be a problem, anyway:

root@linux:~# apt-get install lib32stdc++6

Running again db2prereqcheck is verifying our action:

Validating „32 bit version of „libstdc++.so.6″ “ … 
  Found the 64 bit „/usr/lib/x86_64-linux-gnu/libstdc++.so.6“ in the following directory „/usr/lib/x86_64-linux-gnu“. 
  Found the 32 bit „/usr/lib32/libstdc++.so.6“ in the following directory „/usr/lib32“. 
  Requirement matched.
Done.
Validating „/lib/libpam.so*“ … 
  DBT3514W  The db2prereqcheck utility failed to find the following 32-bit library file: „/lib/libpam.so*“. 
  WARNING : Requirement not matched.

is more tricky :-) It´s always when you are trying to do anything with 32-bit library inside 64-bit OS during installation 64-bit software 😉

INSTALLATION

root@linux:/home/j/install/server# ./db2_install

Requirement not matched for DB2 database „Server“ . Version: „10.5.0.0“. 
Summary of prerequisites that are not met on the current system: 
  DBT3514W  The db2prereqcheck utility failed to find the following 32-bit library file: „/lib/libpam.so*“.
DBI1324W  Support of the db2_install command is deprecated. For
     more information, see the DB2 Information Center.


Default directory for installation of products – /opt/ibm/db2/V10.5

***********************************************************
Install into default directory (/opt/ibm/db2/V10.5) ? [yes/no]

Select yes


Specify one of the following keywords to install DB2 products.

 SERVER 
 CONSV 
 EXP 
 CLIENT 
 RTCL 

Select SERVER

***********************************************************
Do you want to install the DB2 pureScale Feature? [yes/no]

Select no

Requirement not matched for DB2 database „Server“ . Version: „10.5.0.0“. 
Summary of prerequisites that are not met on the current system: 
  DBT3514W  The db2prereqcheck utility failed to find the following 32-bit library file: „/lib/libpam.so*“.
DB2 installation is being initialized.
Total number of tasks to be performed: 46 
Total estimated time for all tasks to be performed: 1521 second(s)
...
The execution completed successfully.
For more information see the DB2 installation log at /tmp/db2_install.log.7525“.
Installation is done.

CONFIGURATION

root@linux:/home/j/install/server# groupadd -g 999 db2iadm1
root@linux:/home/j/install/server# groupadd -g 998 db2fadm1
root@linux:/home/j/install/server# groupadd -g 997 dasadm1
root@linux:/home/j/install/server# useradd -u 1004 -g db2iadm1 -m -d /home/db2inst1 db2inst1 
root@linux:/home/j/install/server# useradd -u 1003 -g db2fadm1 -m -d /home/db2fenc1 db2fenc1
root@linux:/home/j/install/server# useradd -u 1002 -g dasadm1 -m -d /home/dasusr1 dasusr1
root@linux:/home/j/install/server#  passwd db2inst1
Enter new UNIX password: 
Retype new UNIX password: 
passwd: password updated successfully
root@linux:/home/j/install/server# passwd db2fenc1
Enter new UNIX password: 
Retype new UNIX password: 
passwd: password updated successfully
root@linux:/home/j/install/server# passwd dasusr1
Enter new UNIX password: 
Retype new UNIX password: 
passwd: password updated successfully

DAS creating:

root@linux:/opt/ibm/db2/V10.5/instance# ./dascrt -u dasusr1
DBI1070I  Program dascrt completed successfully.
root@linux:/home/j/install/server# cd /opt/ibm/db2/V10.5/instance 
root@linux:/opt/ibm/db2/V10.5/instance# ./db2icrt -a server -u db2fenc1 db2inst1
DBI1446I  The db2icrt command is running.
DB2 installation is being initialized.
Total number of tasks to be performed: 4 
Total estimated time for all tasks to be performed: 309 second(s)
Ok, we have created database instance db2inst1. Time for start database manager + create sample database called SAMPLE :-) Beware to use bash as shell…
db2inst1@linux:/home/j$ db2start
db2start: error while loading shared libraries: libaio.so.1: cannot open shared object file: No such file or directory

Well, can happen – we need to install libaio library….

root@debian:~# apt-get install libaio-dev

And now

db2inst1@debian:/home/j$ db2start
01/28/2014 11:28:39     0   0   SQL1063N  DB2START processing was successful.
SQL1063N  DB2START processing was successful.

Gestione delle istanze del DB

  • Elenco delle istanze
db2ilist

oppure dall'ambiente DB2 (db2cmd)

DB2 GET INSTANCE
  • Per cambiare l'istanza corrente
SET DB2INSTANCE=<nome_istanza>
  • Configurazione della istanza corrente
DB2 GET DBM CFG
  • Elenco dei database contenuti nell'istanza corrente
DB2 LIST DB DIRECTORY
  • Creazione di una nuova istanza
DB2ICRT <nome-istanza>

dopo la creazione l'istanza va avviata tramite il comando:

DB2START
  • Eliminazione di una istanza
DB2IDROP <nome-istanza>

Gestione dei database

  • Elenco dei database contenuti nell'istanza corrente
DB2 LIST DB DIRECTORY
  • Creazione di un nuovo database
DB2 CREATE DB <nomeDB> ON <nome_unita>

esempio:

DB2 CREATE DB SAMPLE ON D:
  • Aggiunta di un utente
GRANT CONNECT ON DATABASE TO USER <nome-utente>
  • Revoca ad un utente dei diritti di accesso
REVOKE CONNECT ON DATABASE FROM USER <nome-utente>
  • Creazione dei bufferpool aggiuntivi
In caso di errori che richiedano bufferpool aggiuntivi per pagine di dimensioni diverse dal default (4K), eseguire i seguenti comandi:
CREATE BUFFERPOOL BUFFERPOOL_8K IMMEDIATE ALL DBPARTITIONNUMS SIZE 1000 AUTOMATIC PAGESIZE 8192;
CREATE BUFFERPOOL BUFFERPOOL_16K IMMEDIATE ALL DBPARTITIONNUMS SIZE 1000 AUTOMATIC PAGESIZE 16384;
CREATE BUFFERPOOL BUFFERPOOL_32K IMMEDIATE ALL DBPARTITIONNUMS SIZE 1000 AUTOMATIC PAGESIZE 32768;


  • Creazione di tablespace utente
In caso di errore SQLCODE=-286, SQLSTATE=42727, è necessario creare i tablespace di database aggiuntivi per le dimensioni di pagina mancanti (di default viene creata solo quella da 4K). Prima di procedere è necessario che i BUFFERPOOL corrispondenti siano disponibili. I comandi da eseguire sono i seguenti:
CREATE TABLESPACE USERSPACE2 PAGESIZE 8192 MANAGED BY SYSTEM USING ('<path-to-userspace>') BUFFERPOOL BUFFERPOOL_8K;
CREATE TABLESPACE USERSPACE3 PAGESIZE 16384 MANAGED BY SYSTEM USING ('<path-to-userspace>') BUFFERPOOL BUFFERPOOL_16K;
CREATE TABLESPACE USERSPACE4 PAGESIZE 32768 MANAGED BY SYSTEM USING ('<path-to-userspace>') BUFFERPOOL BUFFERPOOL_32K;


  • Creazione di tablespace di sistema
In caso di errore SQLCODE=-1585, SQLSTATE=54048, in base all'articolo della KB IBM, è necessario creare i Tablespace di sistema aggiuntivi per le dimensioni di pagina mancanti (di default viene creata solo quella da 4K). Prima di procedere è necessario che i BUFFERPOOL corrispondenti siano disponibili. I comandi da eseguire sono i seguenti:
CREATE SYSTEM TEMPORARY TABLESPACE STB_8 IN DATABASE PARTITION GROUP IBMTEMPGROUP PAGESIZE 8192 MANAGED BY AUTOMATIC STORAGE USING STOGROUP IBMSTOGROUP BUFFERPOOL BUFFERPOOL_8K
CREATE SYSTEM TEMPORARY TABLESPACE STB_16 IN DATABASE PARTITION GROUP IBMTEMPGROUP PAGESIZE 16384 MANAGED BY AUTOMATIC STORAGE USING STOGROUP IBMSTOGROUP BUFFERPOOL BUFFERPOOL_16K
CREATE SYSTEM TEMPORARY TABLESPACE STB_32 IN DATABASE PARTITION GROUP IBMTEMPGROUP PAGESIZE 32768 MANAGED BY AUTOMATIC STORAGE USING STOGROUP IBMSTOGROUP BUFFERPOOL BUFFERPOOL_32K