DB2 新建用户创建数据库流程

首先给大家分享一个巨牛巨牛的人工智能教程,是我无意中发现的。教程不仅零基础,通俗易懂,而且非常风趣幽默,还时不时有内涵段子,像看小说一样,哈哈~我正在学习中,觉得太牛了,所以分享给大家!点这里可以跳转到教程

                DB2 新建用户创建数据库流程


1.添加用户
useradd -g users -d /home/audit -s /bin/bash -m audit
2.修改用户密码
passwd audit


3.启动数据库
root@ubuntu:~# su - db2das
db2das@ubuntu:~$ db2admin start
SQL4406W  The DB2 Administration Server was started successfully.


db2inst1@ubuntu:~$ db2start
2014-06-06 00:38:51     0   0   SQL1063N  DB2START processing was successful.


4.创建数据库
db2inst1@ubuntu:~$ db2 create database AUDIT using codeset GBK territory cn
DB20000I  The CREATE DATABASE command completed successfully.


5.连接到创建的数据库上
db2inst1@ubuntu:~$ db2 connect to AUDIT


   Database Connection Information


 Database server        = DB2/LINUXX8664 9.7.1
 SQL authorization ID   = DB2INST1
 Local database alias   = AUDIT


6.给audit用户授予dba权限


db2inst1@ubuntu:~$ db2 grant dbadm on database to user audit
DB20000I  The SQL command completed successfully.


7.为该用户创建schema
db2inst1@ubuntu:~$ db2 create schema audit AUTHORIZATION audit
DB20000I  The SQL command completed successfully.


8.切换到该数据库下


audit@ubuntu:~$ db2 connect to audit


   Database Connection Information


 Database server        = DB2/LINUXX8664 9.7.1
 SQL authorization ID   = AUDIT
 Local database alias   = AUDIT


audit@ubuntu:~$ db2 set current schema audit
DB20000I  The SQL command completed successfully.           

浏览人工智能教程

你可能感兴趣的:(DB2 新建用户创建数据库流程)