DB2在操作系统用户下创建数据库schema

[db2inst9@th1 ~]$ db2 connect to test9

   Database Connection Information

 Database server        = DB2/LINUXX8664 9.7.10
 SQL authorization ID   = DB2INST9
 Local database alias   = TEST9


db2 => create schema aaa
DB20000I  The SQL command completed successfully.
db2 => create table aaa.aaa(id int)
DB20000I  The SQL command completed successfully.
db2 => select * from aaa.aaa

ID         
-----------

  0 record(s) selected.


db2 => drop table aaa.aaa
DB20000I  The SQL command completed successfully.
db2 => connect to test9

   Database Connection Information

 Database server        = DB2/LINUXX8664 9.7.10
 SQL authorization ID   = DB2INST9
 Local database alias   = TEST9

db2 => grant select,update,insert,delete on db2inst9.t2 to aaa
DB20000I  The SQL command completed successfully.
db2 => connect to test9 user aaa
Enter current password for aaa: 
SQL30082N  Security processing failed with reason "24" ("USERNAME AND/OR 
PASSWORD INVALID").  SQLSTATE=08001

db2 => SET CURRENT SCHEMA = aaa
DB20000I  The SQL command completed successfully.
db2 => select * from db2inst9.t2       

C1          C2                  
----------- --------------------
          1 aa                  
         22 qwer                

  2 record(s) selected.

db2 => insert into db2inst9.t2 values (1,'qqqq')
DB20000I  The SQL command completed successfully.
db2 => delete from db2inst9.t2 where c2='qqqq'   
DB20000I  The SQL command completed successfully.
db2 => commit
DB20000I  The SQL command completed successfully.


你可能感兴趣的:(DB2)