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

分享一下我老师大神的人工智能教程!零基础,通俗易懂!http://blog.csdn.net/jiangjunshow

也欢迎大家转载本篇文章。分享知识,造福人民,实现我们中华民族伟大复兴!

                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.           

给我老师的人工智能教程打call!http://blog.csdn.net/jiangjunshow

这里写图片描述

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