您的位置:首页 > 数据库

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

2016-03-23 14:38 399 查看
[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.
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: