Batch authorization of DB2 user tables. DB2 user table batch authorization 1. create a user [root @ localhost ~] # PasswdghanChangingpasswordforuserghan. NewUNIXpassword: BADPASSWORD: itistooshortRetypenewUNIXpasswo DB2 user table batch authorization
1. create a user
[Root @ localhost ~] # Passwd ghan
Changing password for user ghan.
New UNIX password:
Bad password: it is too short
Retype new UNIX password:
Passwd: all authentication tokens updated successfully.
[Root @ localhost ~] # Su-db2inst2
[Db2inst2 @ localhost ~] $ Db2 connect to ghan user ghan
Enter the current ghan password:
Database Connection information
Database server = DB2/LINUXX8664 9.7.5
SQL authorization id = GHAN
Local database alias = GHAN
II. access the db2int2. t2 table and report an error
[Db2inst2 @ localhost ~] $ Db2 "select count (1) from db2inst2. t2"
SQL0551N "GHAN" does not have operations on the object "DB2INST2. T2" SELECT"
Required permissions or privileges. SQLSTATE = 42501
[Db2inst2 @ localhost ~] $ Db2 connect to ghan
Database Connection information
Database server = DB2/LINUXX8664 9.7.5
SQL authorization id = DB2INST2
Local database alias = GHAN
3. generate authorization scripts
[Db2inst2 @ localhost ~] $ Db2-x + o-z commands. SQL "select 'grant select, insert, update, delete on table' | trim (tabschema) | '. '| trim (tabname) |' to user ghan; 'from syscat. tables where type ='t '"
4. modify table authorization
[Db2inst2 @ localhost ~] $ Vi commands. SQL
***
5. execute authorization statements
[Db2inst2 @ localhost ~] $ Db2-tsvf commands. SQL
Grant select, insert, update, delete on table DB2INST2. EMPL to user ghan
The DB20000I SQL command is successfully completed.
Grant select, insert, update, delete on table DB2INST2. EMPLDD to user ghan
The DB20000I SQL command is successfully completed.
Grant select, insert, update, delete on table DB2INST2. STAFF to user ghan
The DB20000I SQL command is successfully completed.
Grant select, insert, update, delete on table DB2INST2. T1 to user ghan
The DB20000I SQL command is successfully completed.
[Db2inst2 @ localhost ~] $ Db2 connect to ghan user ghan
Enter the current ghan password:
Database Connection information
Database server = DB2/LINUXX8664 9.7.5
SQL authorization id = GHAN
Local database alias = GHAN
VI. test authorization results
[Db2inst2 @ localhost ~] $ Db2 "select count (*) from db2inst2. t1"
1
-----------
4
1 record selected.
Principal 1. create a user [root @ localhost ~] # Passwd ghan Changing password for user ghan. New UNIX password: bad password: it is too short Retype new UNIX passwo...