본문 바로가기
다른 DBMS/DB2

[DB2] 다른유저가 SYSADM_GROUP 권한을 가지면 DB 관리 권한이 있을까?

by 취미툰 2022. 12. 10.
반응형

DB2관리를 위해 다른 유저를 생성하고 SYSADM_GROUP 권한을 부여했을 때 관리가 되는지 테스트를 해보겠습니다.

 

DB2의 유저 : db2test

새로운 유저 : ysbae

OS : AIX 7

 

 

 

1.현재 DB의 SYSADM_GROUP 확인

[db2test 유저]
$  db2 get dbm cfg | grep "_GROUP"
 SYSADM group name                        (SYSADM_GROUP) = DB2IADM1
 SYSCTRL group name                      (SYSCTRL_GROUP) =
 SYSMAINT group name                    (SYSMAINT_GROUP) =
 SYSMON group name                        (SYSMON_GROUP) =

 

2.새로운 유저 ysbae 생성 후 SYSADM_GROUP 에 포함

[root유저로 수행]
# useradd -g db2iadm1 -m -d /home/ysbae ysbae

# cat /etc/group |grep db2iadm1
db2iadm1:!:203:db2inst1,root,ysbae

 

3.db2test의 접근을 위해 db2test유저의 프로파일 복사

[ysbae유저에서 수행]
$ cat /home/db2test/.profile > .profile
$ . .profile

$ db2 list db directory

 System Database Directory

 Number of entries in the directory = 1

Database 1 entry:

 Database alias                       = DB2TEST
 Database name                        = DB2TEST
 Local database directory             = /home/db2test
 Database release level               = 14.00
 Comment                              =
 Directory entry type                 = Indirect
 Catalog database partition number    = 0
 Alternate server hostname            =
 Alternate server port number         =

 

4.DB 재기동해보기

재기동은 잘 되는것을 확인할 수 있습니다.

[ysbae유저에서 수행]

$ db2stop
12/08/2022 16:24:53     0   0   SQL1064N  DB2STOP processing was successful.
SQL1064N  DB2STOP processing was successful.

$ ps -ef |grep db2sys
   ysbae 57344310 38404502   0 16:24:58  pts/3  0:00 grep db2sys
   
$ db2start
SQL8007W  There are "90" day(s) left in the evaluation period for the product
"DB2 Advanced Enterprise Server Edition". For evaluation license terms and
conditions, refer to the License Agreement document located in the license
directory in the installation path of this product. If you have licensed this
product, ensure the license key is properly registered. You can register the
license by using the db2licm command line utility. The license key can be
obtained from your licensed product CD.
12/08/2022 16:25:02     0   0   SQL1063N  DB2START processing was successful.
SQL1063N  DB2START processing was successful.

$ ps -ef |grep db2sys
   ysbae 23462352 38404502   0 16:25:06  pts/3  0:00 grep db2sys
 db2test 50069944 23527922   0 16:25:01      -  0:00 db2sysc 0

 

5.DB접속해서 쿼리 날려보기

select 권한이 없기 때문에 되지 않습니다.

이를 해결하기 위해서는 db에서 최고 권한인 dbadm 권한을 부여해주어야 합니다.

 [ysbae유저에서 수행]
 $db2 connect to db2test

   Database Connection Information

 Database server        = DB2/AIX64 11.1.4.7
 SQL authorization ID   = YSBAE
 Local database alias   = DB2TEST




db2 => select * From test;
SQL0104N  An unexpected token ";" was found following "select * From test".
Expected tokens may include:  "END-OF-STATEMENT".  SQLSTATE=42601

 

DB의 권한부여하기

[db2test에서 수행]
db2 => GRANT DBADM ON DATABASE TO USER ysbae
DB20000I  The SQL command completed successfully.

 

DB의 기동을 관리하기 위해서는 OS의 SYSADM_GROUP  에만 포함되면 됩니다.

DB 내부의 권한을 가지기 위해서는 DB에서 grant를 통해 권한을 다시 부여받아야 합니다.

 

 

 

반응형

댓글