[root@localhost etc]# cat issue Asianux Server 4 (Hiranya) Kernel \r on an \m [root@localhost ~]$ cat /etc/redhat-release Red Hat Enterprise Linux Server release 6.0 (Santiago) [root@localhost ~]# mkdir /db2 [root@localhost ~]# ll total 776872 -rw-------. 1 root root 3326 Oct 21 14:21 anaconda-ks.cfg drwxr-xr-x. 2 root root 4096 Oct 21 14:22 Desktop drwxr-xr-x. 2 root root 4096 Oct 21 14:22 Documents drwxr-xr-x. 2 root root 4096 Oct 21 14:22 Downloads -rw-r--r--. 1 root root 37827 Oct 21 14:21 install.log -rw-r--r--. 1 root root 9043 Oct 21 14:20 install.log.syslog drwxr-xr-x. 2 root root 4096 Oct 21 14:22 Music drwxr-xr-x. 2 root root 4096 Oct 21 14:22 Pictures drwxr-xr-x. 2 root root 4096 Oct 21 14:22 Public drwxr-xr-x. 2 root root 4096 Oct 21 14:22 Templates -rw-r--r--. 1 root root 795416454 Oct 21 03:29 v9.7_linuxx64_server.tar.gz drwxr-xr-x. 2 root root 4096 Oct 21 14:22 Videos [root@localhost ~]# tar -zxvf v9.7_linuxx64_server.tar.gz -C /db2 ....... [root@localhost ~]# cd /db2/ [root@localhost db2]# ll total 4 drwxr-xr-x. 4 root root 4096 May 31 2009 server [root@localhost db2]# cd server/ [root@localhost server]# ll total 56 drwxr-xr-x. 6 bin bin 4096 May 31 2009 db2 -r-xr-xr-x. 1 bin bin 5293 May 31 2009 db2_deinstall -r-xr-xr-x. 1 bin bin 5163 May 31 2009 db2_install -r-xr-xr-x. 1 bin bin 5127 May 31 2009 db2ls -r-xr-xr-x. 1 bin bin 5145 May 31 2009 db2prereqcheck -r-xr-xr-x. 1 bin bin 5145 May 31 2009 db2setup drwxr-xr-x. 15 bin bin 4096 May 31 2009 doc -r-xr-xr-x. 1 bin bin 5181 May 31 2009 installFixPack [root@localhost server]# ./db2setup WARNING: The 32 bit library file libstdc++.so.6 is not found on the system. 32-bit applications may be affected. DBI1190I db2setup is preparing the DB2 Setup wizard which will guide you through the program setup process. Please wait.
[root@localhost server]# cat /etc/passwd root:x:0:0:root:/root:/bin/bash bin:x:1:1:bin:/bin:/sbin/nologin daemon:x:2:2:daemon:/sbin:/sbin/nologin adm:x:3:4:adm:/var/adm:/sbin/nologin lp:x:4:7:lp:/var/spool/lpd:/sbin/nologin sync:x:5:0:sync:/sbin:/bin/sync shutdown:x:6:0:shutdown:/sbin:/sbin/shutdown halt:x:7:0:halt:/sbin:/sbin/halt mail:x:8:12:mail:/var/spool/mail:/sbin/nologin uucp:x:10:14:uucp:/var/spool/uucp:/sbin/nologin operator:x:11:0:operator:/root:/sbin/nologin games:x:12:100:games:/usr/games:/sbin/nologin gopher:x:13:30:gopher:/var/gopher:/sbin/nologin ftp:x:14:50:FTP User:/var/ftp:/sbin/nologin nobody:x:99:99:Nobody:/:/sbin/nologin dbus:x:81:81:System message bus:/:/sbin/nologin usbmuxd:x:113:113:usbmuxd user:/:/sbin/nologin avahi-autoipd:x:170:170:Avahi IPv4LL Stack:/var/lib/avahi-autoipd:/sbin/nologin vcsa:x:69:69:virtual console memory owner:/dev:/sbin/nologin rtkit:x:499:499:RealtimeKit:/proc:/sbin/nologin abrt:x:498:498::/etc/abrt:/sbin/nologin saslauth:x:497:497:"Saslauthd user":/var/empty/saslauth:/sbin/nologin postfix:x:89:89::/var/spool/postfix:/sbin/nologin avahi:x:70:70:Avahi mDNS/DNS-SD Stack:/var/run/avahi-daemon:/sbin/nologin ntp:x:38:38::/etc/ntp:/sbin/nologin apache:x:48:48:Apache:/var/www:/sbin/nologin haldaemon:x:68:68:HAL daemon:/:/sbin/nologin sshd:x:74:74:Privilege-separated SSH:/var/empty/sshd:/sbin/nologin tcpdump:x:72:72::/:/sbin/nologin pulse:x:496:494:PulseAudio System Daemon:/var/run/pulse:/sbin/nologin gdm:x:42:42::/var/lib/gdm:/sbin/nologin jyc:x:500:500:jyc:/home/jyc:/bin/bash dasusr1:x:501:101::/home/dasusr1:/bin/bash db2inst1:x:502:102::/home/db2inst1:/bin/bash db2fenc1:x:503:103::/home/db2fenc1:/bin/bash [root@localhost server]# su - db2inst1 [db2inst1@localhost ~]$ id uid=502(db2inst1) gid=102(db2iadm1) groups=102(db2iadm1),101(dasadm1) context=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 [db2inst1@localhost ~]$ db2start 10/21/2020 15:11:23 0 0 SQL1063N DB2START processing was successful. SQL1063N DB2START processing was successful. [db2inst1@localhost ~]$ db2 (c) Copyright IBM Corporation 1993,2007 Command Line Processor for DB2 Client 9.7.0
You can issue database manager commands and SQL statements from the command prompt. For example: db2 => connect to sample db2 => bind sample.bnd
For general help, type: ?. For command help, type: ? command, where command can be the first few keywords of a database manager command. For example: ? CATALOG DATABASE for help on the CATALOG DATABASE command ? CATALOG for help on all of the CATALOG commands.
To exit db2 interactive mode, type QUIT at the command prompt. Outside interactive mode, all commands must be prefixed with 'db2'. To list the current command option settings, type LIST COMMAND OPTIONS.
For more detailed help, refer to the Online Reference Manual.
db2 => list db directory SQL1031N The database directory cannot be found on the indicated file system. SQLSTATE=58031 db2 => exit DB21034E The command was processed as an SQL statement because it was not a valid Command Line Processor command. During SQL processing it returned: SQL1024N A database connection does not exist. SQLSTATE=08003 db2 => quit DB20000I The QUIT command completed successfully. [db2inst1@localhost ~]$ db2 list db directory SQL1031N The database directory cannot be found on the indicated file system. SQLSTATE=58031 [db2inst1@localhost ~]$ which db2 ~/sqllib/bin/db2 [db2inst1@localhost ~]$ exit logout [root@localhost server]# su - db2inst1 [db2inst1@localhost ~]$ db2 (c) Copyright IBM Corporation 1993,2007 Command Line Processor for DB2 Client 9.7.0
You can issue database manager commands and SQL statements from the command prompt. For example: db2 => connect to sample db2 => bind sample.bnd
For general help, type: ?. For command help, type: ? command, where command can be the first few keywords of a database manager command. For example: ? CATALOG DATABASE for help on the CATALOG DATABASE command ? CATALOG for help on all of the CATALOG commands.
To exit db2 interactive mode, type QUIT at the command prompt. Outside interactive mode, all commands must be prefixed with 'db2'. To list the current command option settings, type LIST COMMAND OPTIONS.
For more detailed help, refer to the Online Reference Manual.
db2 => ? ACTIVATE DATABASE GET CONTACTGROUPS RECONCILE ADD CONTACT GET CONTACTS RECOVER ADD CONTACTGROUP GET/UPDATE DB CFG REDISTRIBUTE DB PARTITION ADD DATALINKS MANAGER GET/UPDATE DBM CFG REFRESH LDAP ADD DBPARTITIONNUM GET DBM MONITOR SWITCHES REGISTER LDAP ADD XMLSCHEMA GET DESCRIPTION FOR HEALTH REGISTER XMLSCHEMA ARCHIVE LOG GET NOTIFICATION LIST REGISTER XSROBJECT ATTACH GET HEALTH SNAPSHOT REORG INDEXES/TABLE AUTOCONFIGURE GET INSTANCE REORGCHK BACKUP DATABASE GET MONITOR SWITCHES RESET ADMIN CFG BIND GET RECOMMENDATIONS RESET ALERT CFG CATALOG APPC NODE GET ROUTINE RESET DB CFG CATALOG APPN NODE GET SNAPSHOT RESET DBM CFG CATALOG DATABASE HELP RESET MONITOR CATALOG DCS DATABASE HISTORY RESTART DATABASE CATALOG LDAP DATABASE IMPORT RESTORE DATABASE CATALOG LDAP NODE INITIALIZE TAPE REWIND TAPE CATALOG LOCAL NODE INSPECT ROLLFORWARD DATABASE CATALOG NPIPE NODE LIST ACTIVE DATABASES RUNCMD CATALOG NETBIOS NODE LIST APPLICATIONS RUNSTATS CATALOG ODBC DATA SOURCE LIST COMMAND OPTIONS SET CLIENT CATALOG TCPIP NODE LIST DATABASE DIRECTORY SET RUNTIME DEGREE CHANGE DATABASE COMMENT LIST DB PARTITION GROUPS SET TABLESPACE CONTAINERS CHANGE ISOLATION LEVEL LIST DATALINKS MANAGERS SET TAPE POSITION COMPLETE XMLSCHEMA LIST DBPARTITIONNUMS SET UTIL_IMPACT_PRIORITY CREATE DATABASE LIST DCS APPLICATIONS SET WRITE CREATE TOOLS CATALOG LIST DCS DIRECTORY START DATABASE MANAGER DEACTIVATE DATABASE LIST DRDA INDOUBT START HADR DECOMPOSE XML DOCUMENT LIST HISTORY STOP DATABASE MANAGER DECOMPOSE XML DOCUMENTS LIST INDOUBT TRANSACTIONS STOP HADR DEREGISTER LIST NODE DIRECTORY TAKEOVER HADR DESCRIBE LIST ODBC DATA SOURCES TERMINATE DETACH LIST PACKAGES/TABLES UNCATALOG DATABASE DROP CONTACT LIST TABLESPACE CONTAINERS UNCATALOG DCS DATABASE DROP CONTACTGROUP LIST TABLESPACES UNCATALOG LDAP DATABASE DROP DATABASE LIST UTILITIES UNCATALOG LDAP NODE DROP DATALINKS MANAGER LOAD UNCATALOG NODE DROP DBPARTITIONNUM LOAD QUERY UNCATALOG ODBC DATA DROP TOOLS CATALOG MIGRATE DATABASE UNQUIESCE DATABASE ECHO PING UNQUIESCE INSTANCE EDIT PREP/PRECOMPILE UPDATE ALERT CFG EXPORT PRUNE HISTORY/LOGFILE UPDATE COMMAND OPTIONS FORCE APPLICATION PUT ROUTINE UPDATE CONTACT GET/UPDATE ADMIN CFG QUERY CLIENT UPDATE CONTACTGROUP GET ALERT CFG QUIESCE DATABASE UPDATE NOTIFICATION LIST GET AUTHORIZATIONS QUIESCE INSTANCE UPDATE HISTORY GET/UPDATE CLI CFG QUIESCE TABLESPACES UPDATE LDAP NODE GET CONNECTION STATE QUIT UPDATE MONITOR SWITCHES GET CONTACTGROUP REBIND XQUERY
Note: Some commands are operating system specific and may not be available.
For further help: ? db2-command - help for specified command ? OPTIONS - help for all command options ? HELP - help for reading help screens The preceding three options can be run as db2 <option> from an OS prompt.
!db2ic - DB2 Information Center (Windows only) This command can also be run as db2ic from an OS prompt. db2 => ACTIVATE DATABASE SQL0104N An unexpected token "END-OF-STATEMENT" was found following "DATABASE". Expected tokens may include: "<identifier>". SQLSTATE=42601 db2 => list ACTIVATE DATABASE SQL0104N An unexpected token "ACTIVATE" was found following "LIST". Expected tokens may include: "ACTIVE". SQLSTATE=42601 db2 => LIST TABLESPACES SQL1024N A database connection does not exist. SQLSTATE=08003 db2 => create database his using codeset utf-8 territory CN
DB20000I The CREATE DATABASE command completed successfully. db2 => db2 => LIST DATABASE DIRECTORY
System Database Directory
Number of entries in the directory = 1
Database 1 entry:
Database alias = HIS Database name = HIS Local database directory = /home/db2inst1 Database release level = d.00 Comment = Directory entry type = Indirect Catalog database partition number = 0 Alternate server hostname = Alternate server port number =
db2 => LIST ACTIVE DATABASES SQL1611W No data was returned by Database System Monitor. db2 => connect to his
Database Connection Information
Database server = DB2/LINUXX8664 9.7.0 SQL authorization ID = DB2INST1 Local database alias = HIS
db2 => LIST TABLESPACES
Tablespaces for Current Database
Tablespace ID = 0 Name = SYSCATSPACE Type = Database managed space Contents = All permanent data. Regular table space. State = 0x0000 Detailed explanation: Normal
Tablespace ID = 1 Name = TEMPSPACE1 Type = System managed space Contents = System Temporary data State = 0x0000 Detailed explanation: Normal
Tablespace ID = 2 Name = USERSPACE1 Type = Database managed space Contents = All permanent data. Large table space. State = 0x0000 Detailed explanation: Normal
db2 => quit DB20000I The QUIT command completed successfully. [db2inst1@localhost ~]$ exit logout [root@localhost server]# useradd -g users -d /home/his -s /bin/bash -m his [root@localhost server]# passwd his Changing password for user his. New password: BAD PASSWORD: it is WAY too short BAD PASSWORD: is too simple Retype new password: passwd: all authentication tokens updated successfully. [root@localhost server]# su - db2das su: user db2das does not exist [root@localhost server]# tail -10 /etc/passwd haldaemon:x:68:68:HAL daemon:/:/sbin/nologin sshd:x:74:74:Privilege-separated SSH:/var/empty/sshd:/sbin/nologin tcpdump:x:72:72::/:/sbin/nologin pulse:x:496:494:PulseAudio System Daemon:/var/run/pulse:/sbin/nologin gdm:x:42:42::/var/lib/gdm:/sbin/nologin jyc:x:500:500:jyc:/home/jyc:/bin/bash dasusr1:x:501:101::/home/dasusr1:/bin/bash db2inst1:x:502:102::/home/db2inst1:/bin/bash db2fenc1:x:503:103::/home/db2fenc1:/bin/bash his:x:504:100::/home/his:/bin/bash [root@localhost server]# su - dasusr1 [dasusr1@localhost ~]$ db2admin start SQL4409W The DB2 Administration Server is already active. [dasusr1@localhost ~]$ db2start -bash: db2start: command not found [dasusr1@localhost ~]$ exit logout [root@localhost server]# su - db2inst1 [db2inst1@localhost ~]$ db2 connect to his
Database Connection Information
Database server = DB2/LINUXX8664 9.7.0 SQL authorization ID = DB2INST1 Local database alias = HIS
[db2inst1@localhost ~]$ db2 grant dbadm on database to user his DB20000I The SQL command completed successfully. [db2inst1@localhost ~]$ db2 create schema his authorization his DB20000I The SQL command completed successfully. [db2inst1@localhost ~]$ db2 connect to his
Database Connection Information
Database server = DB2/LINUXX8664 9.7.0 SQL authorization ID = DB2INST1 Local database alias = HIS
[db2inst1@localhost ~]$ exit logout [root@localhost server]# su - his [his@localhost ~]$ db2 connect to his -bash: db2: command not found [his@localhost ~]$ exit logout [root@localhost server]# su - db2inst1 [db2inst1@localhost ~]$ which db2 ~/sqllib/bin/db2 [db2inst1@localhost ~]$ more .bash_profile # .bash_profile
# Get the aliases and functions if [ -f ~/.bashrc ]; then . ~/.bashrc fi
# User specific environment and startup programs
PATH=$PATH:$HOME/bin
export PATH [db2inst1@localhost ~]$ echo $PATH /usr/lib64/qt-3.3/bin:/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin:/home/db2inst1/sqllib/bin:/home/db2inst1/sqllib/adm:/home/db2inst1/sqllib/misc:/home/db2inst1/bin [db2inst1@localhost ~]$ exit logout [root@localhost server]# su - his [his@localhost ~]$ echo $PATH /usr/lib64/qt-3.3/bin:/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin:/home/his/bin [his@localhost ~]$ vi .bash_profile [root@localhost server]# su - db2inst1 [db2inst1@localhost ~]$ db2 connect to his Database Connection Information Database server = DB2/LINUXX8664 9.7.0 SQL authorization ID = DB2INST1 Local database alias = HIS [db2inst1@localhost ~]$ db2 grant dbadm on database to user his DB20000I The SQL command completed successfully. [db2inst1@localhost ~]$ db2 create schema his authorization his DB20000I The SQL command completed successfully. [db2inst1@localhost ~]$ db2 connect to his Database Connection Information Database server = DB2/LINUXX8664 9.7.0 SQL authorization ID = DB2INST1 Local database alias = HIS [db2inst1@localhost ~]$ exit logout [root@localhost server]# su - his [his@localhost ~]$ db2 connect to his -bash: db2: command not found [his@localhost ~]$ exit logout [root@localhost server]# su - db2inst1 [db2inst1@localhost ~]$ which db2 ~/sqllib/bin/db2 [db2inst1@localhost ~]$ more .bash_profile # .bash_profile # Get the aliases and functions if [ -f ~/.bashrc ]; then . ~/.bashrc fi # User specific environment and startup programs PATH=$PATH:$HOME/bin export PATH [db2inst1@localhost ~]$ echo $PATH /usr/lib64/qt-3.3/bin:/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin:/home/db2inst1/sqllib/bin:/home/db2inst1/sqllib/adm:/home/db2inst1/sqllib/misc:/home/db2inst1/bin [db2inst1@localhost ~]$ exit logout [root@localhost server]# su - his [his@localhost ~]$ echo $PATH /usr/lib64/qt-3.3/bin:/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin:/home/his/bin [his@localhost ~]$ vi .bash_profile [his@localhost ~]$ vi .bash_profile [root@localhost server]# su - db2inst1 [db2inst1@localhost ~]$ db2 connect to his Database Connection Information Database server = DB2/LINUXX8664 9.7.0 SQL authorization ID = DB2INST1 Local database alias = HIS [db2inst1@localhost ~]$ db2 grant dbadm on database to user his DB20000I The SQL command completed successfully. [db2inst1@localhost ~]$ db2 create schema his authorization his DB20000I The SQL command completed successfully. [db2inst1@localhost ~]$ db2 connect to his Database Connection Information Database server = DB2/LINUXX8664 9.7.0 SQL authorization ID = DB2INST1 Local database alias = HIS [db2inst1@localhost ~]$ exit logout [root@localhost server]# su - his [his@localhost ~]$ db2 connect to his -bash: db2: command not found [his@localhost ~]$ exit logout [root@localhost server]# su - db2inst1 [db2inst1@localhost ~]$ which db2 ~/sqllib/bin/db2 [db2inst1@localhost ~]$ more .bash_profile # .bash_profile # Get the aliases and functions if [ -f ~/.bashrc ]; then . ~/.bashrc fi # User specific environment and startup programs PATH=$PATH:$HOME/bin export PATH [db2inst1@localhost ~]$ echo $PATH /usr/lib64/qt-3.3/bin:/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin:/home/db2inst1/sqllib/bin:/home/db2inst1/sqllib/adm:/home/db2inst1/sqllib/misc:/home/db2inst1/bin [db2inst1@localhost ~]$ exit logout [root@localhost server]# su - his [his@localhost ~]$ echo $PATH /usr/lib64/qt-3.3/bin:/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin:/home/his/bin [his@localhost ~]$ vi .bash_profile [his@localhost ~]$ vi .bash_profile [his@localhost ~]$ exit logout [root@localhost server]# su - his [his@localhost ~]$ db2 connect to his SQL10007N Message "-1390" could not be retrieved. Reason code: "3". [his@localhost ~]$ exit logout [root@localhost server]# su - db2inst1 [db2inst1@localhost ~]$ db2 (c) Copyright IBM Corporation 1993,2007 Command Line Processor for DB2 Client 9.7.0
You can issue database manager commands and SQL statements from the command prompt. For example: db2 => connect to sample db2 => bind sample.bnd
For general help, type: ?. For command help, type: ? command, where command can be the first few keywords of a database manager command. For example: ? CATALOG DATABASE for help on the CATALOG DATABASE command ? CATALOG for help on all of the CATALOG commands.
To exit db2 interactive mode, type QUIT at the command prompt. Outside interactive mode, all commands must be prefixed with 'db2'. To list the current command option settings, type LIST COMMAND OPTIONS.
For more detailed help, refer to the Online Reference Manual.
db2 => grant connect on database to user his DB21034E The command was processed as an SQL statement because it was not a valid Command Line Processor command. During SQL processing it returned: SQL1024N A database connection does not exist. SQLSTATE=08003 db2 => exit DB21034E The command was processed as an SQL statement because it was not a valid Command Line Processor command. During SQL processing it returned: SQL1024N A database connection does not exist. SQLSTATE=08003 db2 => QUIT DB20000I The QUIT command completed successfully. [db2inst1@localhost ~]$ db2 grant connect on database to user his DB21034E The command was processed as an SQL statement because it was not a valid Command Line Processor command. During SQL processing it returned: SQL1024N A database connection does not exist. SQLSTATE=08003 [db2inst1@localhost ~]$ db2 connect to his
Database Connection Information
Database server = DB2/LINUXX8664 9.7.0 SQL authorization ID = DB2INST1 Local database alias = HIS
[db2inst1@localhost ~]$ grant connect on database to user his -bash: grant: command not found [db2inst1@localhost ~]$ db2 (c) Copyright IBM Corporation 1993,2007 Command Line Processor for DB2 Client 9.7.0
You can issue database manager commands and SQL statements from the command prompt. For example: db2 => connect to sample db2 => bind sample.bnd
For general help, type: ?. For command help, type: ? command, where command can be the first few keywords of a database manager command. For example: ? CATALOG DATABASE for help on the CATALOG DATABASE command ? CATALOG for help on all of the CATALOG commands.
To exit db2 interactive mode, type QUIT at the command prompt. Outside interactive mode, all commands must be prefixed with 'db2'. To list the current command option settings, type LIST COMMAND OPTIONS.
For more detailed help, refer to the Online Reference Manual.
db2 => grant connect on database to user his DB20000I The SQL command completed successfully. db2 => grant bindadd on database to user his DB20000I The SQL command completed successfully. db2 => grant createtab on database to user his DB20000I The SQL command completed successfully. db2 => grant implicit_schema on database to his DB20000I The SQL command completed successfully. db2 => grant load on database to user his DB20000I The SQL command completed successfully. db2 => grant use of tablespace assp to user his DB21034E The command was processed as an SQL statement because it was not a valid Command Line Processor command. During SQL processing it returned: SQL0204N "ASSP" is an undefined name. SQLSTATE=42704 db2 => create bufferpool buffer_assp8k size 25600 pagesize 8k DB20000I The SQL command completed successfully. db2 => create bufferpool buffer_idx8k size 25600 pagesize 8k DB20000I The SQL command completed successfully. db2 => create bufferpool buffer_clob32k size 6400 pagesize 32k DB20000I The SQL command completed successfully. db2 => quit DB20000I The QUIT command completed successfully. [db2inst1@localhost ~]$ exit logout [root@localhost server]# su - his [his@localhost ~]$ db2 SQL10007N Message "-1390" could not be retrieved. Reason code: "3". [his@localhost ~]$ exit logout [root@localhost server]# ll /home total 20 drwxr-xr-x. 5 dasusr1 dasadm1 4096 Oct 21 15:24 dasusr1 drwx------. 4 db2fenc1 db2fadm1 4096 Oct 21 15:07 db2fenc1 drwxr-xr-x. 9 db2inst1 db2iadm1 4096 Oct 21 15:17 db2inst1 drwx------. 4 his users 4096 Oct 21 15:29 his drwx------. 4 jyc jyc 4096 Oct 21 14:21 jyc [root@localhost server]# find / -name db2profile /home/db2inst1/sqllib/db2profile /opt/ibm/db2/V9.7/cfg/db2profile [root@localhost server]# su - his [his@localhost ~]$ vi .bash_profile db2 => bind sample.bnd For general help, type: ?. For command help, type: ? command, where command can be the first few keywords of a database manager command. For example: ? CATALOG DATABASE for help on the CATALOG DATABASE command ? CATALOG for help on all of the CATALOG commands. To exit db2 interactive mode, type QUIT at the command prompt. Outside interactive mode, all commands must be prefixed with 'db2'. To list the current command option settings, type LIST COMMAND OPTIONS. For more detailed help, refer to the Online Reference Manual. db2 => grant connect on database to user his DB20000I The SQL command completed successfully. db2 => grant bindadd on database to user his DB20000I The SQL command completed successfully. db2 => grant createtab on database to user his DB20000I The SQL command completed successfully. db2 => grant implicit_schema on database to his DB20000I The SQL command completed successfully. db2 => grant load on database to user his DB20000I The SQL command completed successfully. db2 => grant use of tablespace assp to user his DB21034E The command was processed as an SQL statement because it was not a valid Command Line Processor command. During SQL processing it returned: SQL0204N "ASSP" is an undefined name. SQLSTATE=42704 db2 => create bufferpool buffer_assp8k size 25600 pagesize 8k DB20000I The SQL command completed successfully. db2 => create bufferpool buffer_idx8k size 25600 pagesize 8k DB20000I The SQL command completed successfully. db2 => create bufferpool buffer_clob32k size 6400 pagesize 32k DB20000I The SQL command completed successfully. db2 => quit DB20000I The QUIT command completed successfully. [db2inst1@localhost ~]$ exit logout [root@localhost server]# su - his [his@localhost ~]$ db2 SQL10007N Message "-1390" could not be retrieved. Reason code: "3". [his@localhost ~]$ exit logout [root@localhost server]# ll /home total 20 drwxr-xr-x. 5 dasusr1 dasadm1 4096 Oct 21 15:24 dasusr1 drwx------. 4 db2fenc1 db2fadm1 4096 Oct 21 15:07 db2fenc1 drwxr-xr-x. 9 db2inst1 db2iadm1 4096 Oct 21 15:17 db2inst1 drwx------. 4 his users 4096 Oct 21 15:29 his drwx------. 4 jyc jyc 4096 Oct 21 14:21 jyc [root@localhost server]# find / -name db2profile /home/db2inst1/sqllib/db2profile /opt/ibm/db2/V9.7/cfg/db2profile [root@localhost server]# su - his [his@localhost ~]$ vi .bash_profile
[his@localhost ~]$ exit logout [root@localhost server]# su - his -bash: export: `HOME/bin:/home/db2inst1/sqllib/bin': not a valid identifier [his@localhost ~]$ vi .bash_profile To exit db2 interactive mode, type QUIT at the command prompt. Outside interactive mode, all commands must be prefixed with 'db2'. To list the current command option settings, type LIST COMMAND OPTIONS. For more detailed help, refer to the Online Reference Manual. db2 => grant connect on database to user his DB20000I The SQL command completed successfully. db2 => grant bindadd on database to user his DB20000I The SQL command completed successfully. db2 => grant createtab on database to user his DB20000I The SQL command completed successfully. db2 => grant implicit_schema on database to his DB20000I The SQL command completed successfully. db2 => grant load on database to user his DB20000I The SQL command completed successfully. db2 => grant use of tablespace assp to user his DB21034E The command was processed as an SQL statement because it was not a valid Command Line Processor command. During SQL processing it returned: SQL0204N "ASSP" is an undefined name. SQLSTATE=42704 db2 => create bufferpool buffer_assp8k size 25600 pagesize 8k DB20000I The SQL command completed successfully. db2 => create bufferpool buffer_idx8k size 25600 pagesize 8k DB20000I The SQL command completed successfully. db2 => create bufferpool buffer_clob32k size 6400 pagesize 32k DB20000I The SQL command completed successfully. db2 => quit DB20000I The QUIT command completed successfully. [db2inst1@localhost ~]$ exit logout [root@localhost server]# su - his [his@localhost ~]$ db2 SQL10007N Message "-1390" could not be retrieved. Reason code: "3". [his@localhost ~]$ exit logout [root@localhost server]# ll /home total 20 drwxr-xr-x. 5 dasusr1 dasadm1 4096 Oct 21 15:24 dasusr1 drwx------. 4 db2fenc1 db2fadm1 4096 Oct 21 15:07 db2fenc1 drwxr-xr-x. 9 db2inst1 db2iadm1 4096 Oct 21 15:17 db2inst1 drwx------. 4 his users 4096 Oct 21 15:29 his drwx------. 4 jyc jyc 4096 Oct 21 14:21 jyc [root@localhost server]# find / -name db2profile /home/db2inst1/sqllib/db2profile /opt/ibm/db2/V9.7/cfg/db2profile [root@localhost server]# su - his [his@localhost ~]$ vi .bash_profile [his@localhost ~]$ exit logout [root@localhost server]# su - his -bash: export: `HOME/bin:/home/db2inst1/sqllib/bin': not a valid identifier [his@localhost ~]$ vi .bash_profile # .bash_profile
# Get the aliases and functions if [ -f ~/.bashrc ]; then . ~/.bashrc fi
# User specific environment and startup programs
export PATH=$PATH:.$HOME/bin:/home/db2inst1/sqllib/bin if [ -f /home/db2inst1/sqllib/db2profile ] then source /home/db2inst1/sqllib/db2profile fi
[his@localhost ~]$ exit logout [root@localhost server]# su - his [his@localhost ~]$ db2 (c) Copyright IBM Corporation 1993,2007 Command Line Processor for DB2 Client 9.7.0
You can issue database manager commands and SQL statements from the command prompt. For example: db2 => connect to sample db2 => bind sample.bnd
For general help, type: ?. For command help, type: ? command, where command can be the first few keywords of a database manager command. For example: ? CATALOG DATABASE for help on the CATALOG DATABASE command ? CATALOG for help on all of the CATALOG commands.
To exit db2 interactive mode, type QUIT at the command prompt. Outside interactive mode, all commands must be prefixed with 'db2'. To list the current command option settings, type LIST COMMAND OPTIONS.
For more detailed help, refer to the Online Reference Manual.
db2 => connect to his user his using his
Database Connection Information
Database server = DB2/LINUXX8664 9.7.0 SQL authorization ID = HIS Local database alias = HIS
db2 => connect to his
Database Connection Information
Database server = DB2/LINUXX8664 9.7.0 SQL authorization ID = HIS Local database alias = HIS
db2 => list tablespace show detail SQL0104N An unexpected token "show" was found following "TABLESPACE". Expected tokens may include: "CONTAINERS". SQLSTATE=42601 db2 => list tablespaces
Tablespaces for Current Database
Tablespace ID = 0 Name = SYSCATSPACE Type = Database managed space Contents = All permanent data. Regular table space. State = 0x0000 Detailed explanation: Normal
Tablespace ID = 1 Name = TEMPSPACE1 Type = System managed space Contents = System Temporary data State = 0x0000 Detailed explanation: Normal
Tablespace ID = 2 Name = USERSPACE1 Type = Database managed space Contents = All permanent data. Large table space. State = 0x0000 Detailed explanation: Normal
Tablespace ID = 3 Name = SYSTOOLSPACE Type = Database managed space Contents = All permanent data. Large table space. State = 0x0000 Detailed explanation: Normal
db2 => list tablespaces show detail
Tablespaces for Current Database
Tablespace ID = 0 Name = SYSCATSPACE Type = Database managed space Contents = All permanent data. Regular table space. State = 0x0000 Detailed explanation: Normal Total pages = 24576 Useable pages = 24572 Used pages = 16568 Free pages = 8004 High water mark (pages) = 16568 Page size (bytes) = 4096 Extent size (pages) = 4 Prefetch size (pages) = 4 Number of containers = 1
Tablespace ID = 1 Name = TEMPSPACE1 Type = System managed space Contents = System Temporary data State = 0x0000 Detailed explanation: Normal Total pages = 1 Useable pages = 1 Used pages = 1 Free pages = Not applicable High water mark (pages) = Not applicable Page size (bytes) = 4096 Extent size (pages) = 32 Prefetch size (pages) = 32 Number of containers = 1
Tablespace ID = 2 Name = USERSPACE1 Type = Database managed space Contents = All permanent data. Large table space. State = 0x0000 Detailed explanation: Normal Total pages = 8192 Useable pages = 8160 Used pages = 96 Free pages = 8064 High water mark (pages) = 96 Page size (bytes) = 4096 Extent size (pages) = 32 Prefetch size (pages) = 32 Number of containers = 1
Tablespace ID = 3 Name = SYSTOOLSPACE Type = Database managed space Contents = All permanent data. Large table space. State = 0x0000 Detailed explanation: Normal Total pages = 8192 Useable pages = 8188 Used pages = 144 Free pages = 8044 High water mark (pages) = 144 Page size (bytes) = 4096 Extent size (pages) = 4 Prefetch size (pages) = 4 Number of containers = 1
db2 => create table test( ID VARCHAR(40) not null, TYPE CHAR(1) )DB21034E The command was processed as an SQL statement because it was not a valid Command Line Processor command. During SQL processing it returned: SQL0104N An unexpected token "(" was found following "create table test". Expected tokens may include: "END-OF-STATEMENT". SQLSTATE=42601 db2 => DB21034E The command was processed as an SQL statement because it was not a valid Command Line Processor command. During SQL processing it returned: SQL0104N An unexpected token "ID VARCHAR" was found following "BEGIN-OF-STATEMENT". Expected tokens may include: "<values>". SQLSTATE=42601 db2 => DB21034E The command was processed as an SQL statement because it was not a valid Command Line Processor command. During SQL processing it returned: SQL0104N An unexpected token "TYPE CHAR" was found following "BEGIN-OF-STATEMENT". Expected tokens may include: "<values>". SQLSTATE=42601 db2 => DB21034E The command was processed as an SQL statement because it was not a valid Command Line Processor command. During SQL processing it returned: SQL0104N An unexpected token ")" was found following "BEGIN-OF-STATEMENT". Expected tokens may include: "<stmt_or_dcl>". SQLSTATE=42601 db2 => db2 => db2 => db2 => db2 => ? ACTIVATE DATABASE GET CONTACTGROUPS RECONCILE ADD CONTACT GET CONTACTS RECOVER ADD CONTACTGROUP GET/UPDATE DB CFG REDISTRIBUTE DB PARTITION ADD DATALINKS MANAGER GET/UPDATE DBM CFG REFRESH LDAP ADD DBPARTITIONNUM GET DBM MONITOR SWITCHES REGISTER LDAP ADD XMLSCHEMA GET DESCRIPTION FOR HEALTH REGISTER XMLSCHEMA ARCHIVE LOG GET NOTIFICATION LIST REGISTER XSROBJECT ATTACH GET HEALTH SNAPSHOT REORG INDEXES/TABLE AUTOCONFIGURE GET INSTANCE REORGCHK BACKUP DATABASE GET MONITOR SWITCHES RESET ADMIN CFG BIND GET RECOMMENDATIONS RESET ALERT CFG CATALOG APPC NODE GET ROUTINE RESET DB CFG CATALOG APPN NODE GET SNAPSHOT RESET DBM CFG CATALOG DATABASE HELP RESET MONITOR CATALOG DCS DATABASE HISTORY RESTART DATABASE CATALOG LDAP DATABASE IMPORT RESTORE DATABASE CATALOG LDAP NODE INITIALIZE TAPE REWIND TAPE CATALOG LOCAL NODE INSPECT ROLLFORWARD DATABASE CATALOG NPIPE NODE LIST ACTIVE DATABASES RUNCMD CATALOG NETBIOS NODE LIST APPLICATIONS RUNSTATS CATALOG ODBC DATA SOURCE LIST COMMAND OPTIONS SET CLIENT CATALOG TCPIP NODE LIST DATABASE DIRECTORY SET RUNTIME DEGREE CHANGE DATABASE COMMENT LIST DB PARTITION GROUPS SET TABLESPACE CONTAINERS CHANGE ISOLATION LEVEL LIST DATALINKS MANAGERS SET TAPE POSITION COMPLETE XMLSCHEMA LIST DBPARTITIONNUMS SET UTIL_IMPACT_PRIORITY CREATE DATABASE LIST DCS APPLICATIONS SET WRITE CREATE TOOLS CATALOG LIST DCS DIRECTORY START DATABASE MANAGER DEACTIVATE DATABASE LIST DRDA INDOUBT START HADR DECOMPOSE XML DOCUMENT LIST HISTORY STOP DATABASE MANAGER DECOMPOSE XML DOCUMENTS LIST INDOUBT TRANSACTIONS STOP HADR DEREGISTER LIST NODE DIRECTORY TAKEOVER HADR DESCRIBE LIST ODBC DATA SOURCES TERMINATE DETACH LIST PACKAGES/TABLES UNCATALOG DATABASE DROP CONTACT LIST TABLESPACE CONTAINERS UNCATALOG DCS DATABASE DROP CONTACTGROUP LIST TABLESPACES UNCATALOG LDAP DATABASE DROP DATABASE LIST UTILITIES UNCATALOG LDAP NODE DROP DATALINKS MANAGER LOAD UNCATALOG NODE DROP DBPARTITIONNUM LOAD QUERY UNCATALOG ODBC DATA DROP TOOLS CATALOG MIGRATE DATABASE UNQUIESCE DATABASE ECHO PING UNQUIESCE INSTANCE EDIT PREP/PRECOMPILE UPDATE ALERT CFG EXPORT PRUNE HISTORY/LOGFILE UPDATE COMMAND OPTIONS FORCE APPLICATION PUT ROUTINE UPDATE CONTACT GET/UPDATE ADMIN CFG QUERY CLIENT UPDATE CONTACTGROUP GET ALERT CFG QUIESCE DATABASE UPDATE NOTIFICATION LIST GET AUTHORIZATIONS QUIESCE INSTANCE UPDATE HISTORY GET/UPDATE CLI CFG QUIESCE TABLESPACES UPDATE LDAP NODE GET CONNECTION STATE QUIT UPDATE MONITOR SWITCHES GET CONTACTGROUP REBIND XQUERY
Note: Some commands are operating system specific and may not be available.
For further help: ? db2-command - help for specified command ? OPTIONS - help for all command options ? HELP - help for reading help screens The preceding three options can be run as db2 <option> from an OS prompt.
!db2ic - DB2 Information Center (Windows only) This command can also be run as db2ic from an OS prompt. db2 => create table test(id varchar(40) not null,type char(1)) DB20000I The SQL command completed successfully. db2 => comment on table test is '用户默认数据源表'; DB21034E The command was processed as an SQL statement because it was not a valid Command Line Processor command. During SQL processing it returned: SQL0104N An unexpected token ";" was found following "·默认数据源表'". Expected tokens may include: "END-OF-STATEMENT". SQLSTATE=42601 db2 => comment on table test is '用户默认数据源表' DB20000I The SQL command completed successfully. db2 => insert into test values('abc','1') DB20000I The SQL command completed successfully. db2 => commit DB20000I The SQL command completed successfully. db2 => select * from test
ID TYPE ---------------------------------------- ---- abc 1
1 record(s) selected.
db2 => alter table test add column uid integer DB20000I The SQL command completed successfully. db2 => list tables
Table/View Schema Type Creation time ------------------------------- --------------- ----- -------------------------- TEST HIS T 2020-10-21-15.46.32.407999
1 record(s) selected.
db2 => select * from test
ID TYPE UID ---------------------------------------- ---- ----------- abc 1 -
1 record(s) selected.
db2 => create index idx1 on test(id) DB20000I The SQL command completed successfully. db2 => alter table test add constraint pk1 Primary key(id) SQL0598W Existing index "HIS.IDX1" is used as the index for the primary key or a unique key. SQLSTATE=01550 db2 => drop index idx1 DB21034E The command was processed as an SQL statement because it was not a valid Command Line Processor command. During SQL processing it returned: SQL0669N A system required index cannot be dropped explicitly. SQLSTATE=42917 db2 => describe table test
Data type Column Column name schema Data type name Length Scale Nulls ------------------------------- --------- ------------------- ---------- ----- ------ ID SYSIBM VARCHAR 40 0 No TYPE SYSIBM CHARACTER 1 0 Yes UID SYSIBM INTEGER 4 0 Yes
3 record(s) selected.
db2 => desc table test DB21034E The command was processed as an SQL statement because it was not a valid Command Line Processor command. During SQL processing it returned: SQL0104N An unexpected token "table" was found following "desc ". Expected tokens may include: "JOIN <joined_table>". SQLSTATE=42601 db2 => describe table test
Data type Column Column name schema Data type name Length Scale Nulls ------------------------------- --------- ------------------- ---------- ----- ------ ID SYSIBM VARCHAR 40 0 No TYPE SYSIBM CHARACTER 1 0 Yes UID SYSIBM INTEGER 4 0 Yes
3 record(s) selected.
db2 => create table t(id integer not null,name varchar(20)) DB20000I The SQL command completed successfully. db2 => create table t1(id integer not null,name varchar(20)) DB20000I The SQL command completed successfully. db2 => create table t2(id integer not null,name varchar(20)) DB20000I The SQL command completed successfully. db2 => insert into t values(1,2) DB20000I The SQL command completed successfully. db2 => insert into t1 values(1,3) DB20000I The SQL command completed successfully. db2 => insert into t2 values(2,1) DB20000I The SQL command completed successfully. db2 => select * from t
ID NAME ----------- -------------------- 1 2
1 record(s) selected.
db2 => select * from t2
ID NAME ----------- -------------------- 2 1
1 record(s) selected.
db2 => select * from t1
ID NAME ----------- -------------------- 1 3
1 record(s) selected.
db2 => quit DB20000I The QUIT command completed successfully.
[his@localhost /]$ db2 update db cfg for his using LOGARCHMETH1 'Disk:/home/db2inst1/arch' SQL1092N "HIS" does not have the authority to perform the requested command or operation. [his@localhost /]$ exit logout [root@localhost etc]# su - db2inst1 [db2inst1@localhost ~]$ mkdir -p /home/db2 db2fenc1/ db2inst1/ [db2inst1@localhost ~]$ mkdir -p /home/db2inst1/arch [db2inst1@localhost ~]$ db2 update db cfg for his using LOGARCHMETH1 'Disk:/home/db2inst1/arch' DB20000I The UPDATE DATABASE CONFIGURATION command completed successfully. [db2inst1@localhost ~]$ db2 get db cfg for his |grep "log" User exit for logging status = NO Catalog cache size (4KB) (CATALOGCACHE_SZ) = 300 Number of primary log files (LOGPRIMARY) = 13 Number of secondary log files (LOGSECOND) = 4 Changed path to log files (NEWLOGPATH) = Path to log files = /home/db2inst1/db2inst1/NODE0000/SQL00001/SQLOGDIR/ Overflow log path (OVERFLOWLOGPATH) = Mirror log path (MIRRORLOGPATH) = First active log file = Block log on disk full (BLK_LOG_DSK_FUL) = NO Block non logged operations (BLOCKNONLOGGED) = NO Percent max primary log space by transaction (MAX_LOG) = 0 Num. of active log files for 1 active UOW(NUM_LOG_SPAN) = 0 Percent log file reclaimed before soft chckpt (SOFTMAX) = 520 User exit for logging enabled (USEREXIT) = OFF HADR log write synchronization mode (HADR_SYNCMODE) = NEARSYNC First log archive method (LOGARCHMETH1) = DISK:/home/db2inst1/arch/ Options for logarchmeth1 (LOGARCHOPT1) = Second log archive method (LOGARCHMETH2) = OFF Options for logarchmeth2 (LOGARCHOPT2) = Failover log archive path (FAILARCHPATH) = Number of log archive retries on error (NUMARCHRETRY) = 5 [db2inst1@localhost ~]$ db2stop 10/21/2020 16:26:06 0 0 SQL1064N DB2STOP processing was successful. SQL1064N DB2STOP processing was successful. [db2inst1@localhost ~]$ db2start 10/21/2020 16:26:10 0 0 SQL1063N DB2START processing was successful. SQL1063N DB2START processing was successful. [db2inst1@localhost ~]$ db2 get db cfg for his |grep "log" User exit for logging status = NO Catalog cache size (4KB) (CATALOGCACHE_SZ) = 300 Number of primary log files (LOGPRIMARY) = 13 Number of secondary log files (LOGSECOND) = 4 Changed path to log files (NEWLOGPATH) = Path to log files = /home/db2inst1/db2inst1/NODE0000/SQL00001/SQLOGDIR/ Overflow log path (OVERFLOWLOGPATH) = Mirror log path (MIRRORLOGPATH) = First active log file = Block log on disk full (BLK_LOG_DSK_FUL) = NO Block non logged operations (BLOCKNONLOGGED) = NO Percent max primary log space by transaction (MAX_LOG) = 0 Num. of active log files for 1 active UOW(NUM_LOG_SPAN) = 0 Percent log file reclaimed before soft chckpt (SOFTMAX) = 520 User exit for logging enabled (USEREXIT) = OFF HADR log write synchronization mode (HADR_SYNCMODE) = NEARSYNC First log archive method (LOGARCHMETH1) = DISK:/home/db2inst1/arch/ Options for logarchmeth1 (LOGARCHOPT1) = Second log archive method (LOGARCHMETH2) = OFF Options for logarchmeth2 (LOGARCHOPT2) = Failover log archive path (FAILARCHPATH) = Number of log archive retries on error (NUMARCHRETRY) = 5 [db2inst1@localhost ~]$ cd /home/db2inst1/arch/ [db2inst1@localhost arch]$ ll total 0 [db2inst1@localhost arch]$ ll total 0 [db2inst1@localhost arch]$ db2 logretain DB21034E The command was processed as an SQL statement because it was not a valid Command Line Processor command. During SQL processing it returned: SQL1024N A database connection does not exist. SQLSTATE=08003 [db2inst1@localhost arch]$ db2 get db cfg for his|grep LOGRETAIN Log retain for recovery enabled (LOGRETAIN) = OFF
============================
db2相关下载地址:
https://www.iteye.com/blog/happyqing-2082305
Index of ftp://public.dhe.ibm.com/software/hk/cobra
Parent Directory
DB2_ESE_9.7_trial_VA_32bit.exe 2.01Gb June 30 2009 DB2_ESE_9.7_trial_VA_32bit.rar 2.01Gb July 3 2009 db2exc_952beta_MAC_x86_64.tar.gz 140.96Mb June 29 2009 db2exc_970_LNX_ppc.tar.gz 356.78Mb June 29 2009 db2exc_970_LNX_x86.tar.gz 399.66Mb June 29 2009 db2exc_970_LNX_x86_64.tar.gz 440.86Mb June 29 2009 db2exc_970_SUN_x86_64.tar.gz 389.60Mb June 29 2009 db2exc_970_WIN_x86.zip 395.38Mb June 29 2009 db2exc_970_WIN_x86_64.zip 449.96Mb June 29 2009 db2exc_client_952beta_MAC_x86_64.tar.gz 83.18Mb June 29 2009 db2exc_guide_952_MAC_x86_64.pdf 1.42Mb June 29 2009 db2exc_nlpack_970_LNX_ppc.tar.gz 312.12Mb June 29 2009 db2exc_nlpack_970_LNX_x86.tar.gz 268.92Mb June 29 2009 db2exc_nlpack_970_LNX_x86_64.tar.gz 318.12Mb June 29 2009 db2exc_nlpack_970_SUN_x86_64.tar.gz 183.43Mb June 29 2009 db2exc_vsai_970_WIN_x86.zip 28.97Mb June 29 2009 v9.7_aix64_server.tar.gz 876.94Mb June 30 2009 v9.7_hpipf64_server.tar.gz 853.47Mb June 30 2009 v9.7_linux390x64_server.tar.gz 450.07Mb June 29 2009 v9.7_linuxia32_server.tar.gz 641.87Mb June 29 2009 v9.7_linuxppc64_server.tar.gz 627.43Mb June 29 2009 v9.7_linuxx64_server.tar.gz 758.57Mb June 30 2009 v9.7_nt32_server.zip 546.64Mb June 29 2009 v9.7_ntx64_server.zip 602.99Mb June 29 2009 v9.7_sun64_server.tar.gz 717.64Mb June 30 2009 v9.7_sunamd64_server.tar.gz 588.31Mb June 29 2009