LINUX下创建db2数据库、用户、授权、导入库

创建数据库:(db2inst1用户下)

db2 CREATE DATABASE TSCF USING CODESET GBK TERRITORY CN COLLATE USING SYSTEM PAGESIZE 32768 WITH 'TSCF'

 

 

创建用户:(root用户下)

[root@devsvr2 root]# useradd oatest

 

[root@devsvr2 root]# passwd oatest

 

Changing password for user oatest.

 

New password:

 

BAD PASSWORD: it is too short

 

Retype new password:

 

passwd: all authentication tokens updated successfully.

 

 

授权:(db2inst1用户下)

[db2inst1@devsvr2 db2inst1]$ db2 connect to tscf

数据库连接信息

数据库服务器 = DB2/LINUX 8.2.0

SQL 授权标识 = DB2INST1

本地数据库别名 = SAMPLE

 

[db2inst1@devsvr2 db2inst1]$ db2 GRANT DBADM,CREATETAB,BINDADD,CONNECT,CREATE_NOT_FENCED_ROUTINE,IMPLICIT_SCHEMA,LOAD,CREATE_EXTERNAL_ROUTINE,QUIESCE_CONNECT ON DATABASE TO USER TOPSCF;

DB20000I SQL 命令成功完成。

 

创建schema: 

[db2inst1@devsvr2 db2inst1]$ db2 "create schema topscf"

 

[db2inst1@devsvr2 db2inst1]$ db2 GRANT CREATEIN,DROPIN,ALTERIN ON SCHEMA TOPSCF TO USER TOPSCF

DB20000I SQL 命令成功完成。

 

[db2inst1@devsvr2 db2inst1]$ db2 connect to tscf user topscf using pass1234

数据库连接信息

数据库服务器 = DB2/LINUX 8.2.0

SQL 授权标识 =OATSET

本地数据库别名 = SAMPLE

 

远程导入数据

1.创建表机构

2.将data数据包data1031放在bak目录下

执行(db2inst1用户下)

cd /home/db2inst1/bak/data1031

cd /home/db2inst1/backup/data1031

db2move scfns import -io replace -u topscf_chs -p pass1234

db2move scfns import -u topscf_chs -p pass1234

 

 

 

#jdbc.driverClassName=com.ibm.db2.jcc.DB2Driver

#jdbc.url=jdbc:db2://130.251.106.14:50001/scf

#jdbc.username=scf

#jdbc.password=pass1234

jdbc:db2://database_server_uri:port/database_name:currentSchema=schema_name;

你可能感兴趣的:(linux)