db2数据库安装、备份和恢复

1.db2数据安装博客地址

https://jingyan.baidu.com/article/454316ab695700f7a7c03a9a.html

2. 数据库备份和恢复

2.1 备份:先关掉所有tomcat
2.2 运行:db2cmd 

 db2Stop force 停止服务器所有的进程

 db2Start   开启服务

20170209164335 备份数据库后缀时间戳

db2Stop force
db2Start
DB2 FORCE APPLICATIONS ALL
DB2 BACKUP DATABASE histest TO D:\数据库备份

db2 Create db HISTEST on D:
db2 restore db HISTEST from D:\数据库备份 taken at 20170209164335 into HISTEST
db2 rollforward db HISTEST to end of logs and stop

3 创建表空间

SET TABLESPACE CONTAINERS FOR 0 IGNORE ROLLFORWARD CONTAINER OPERATIONS USING (PATH "E:\UFLOTEST\SYSCATASPACE")
	SET TABLESPACE CONTAINERS FOR 1 IGNORE ROLLFORWARD CONTAINER OPERATIONS USING (PATH "E:\UFLOTEST\TEMPSPACE1")
	SET TABLESPACE CONTAINERS FOR 2 IGNORE ROLLFORWARD CONTAINER OPERATIONS USING (PATH "E:\UFLOTEST\USERSPACE1")
	SET TABLESPACE CONTAINERS FOR 5 IGNORE ROLLFORWARD CONTAINER OPERATIONS USING (PATH "E:\UFLOTEST\USERSPACE2")
	RESTORE DATABASE kistestl CONTINUE

4.测试连接数据库(进入dos命令输入db2cmd)

DB2 CONNECT TO KISTESTL USER db2admin using db2admin

5.查看db2目录

db2 list database directory

 

你可能感兴趣的:(db2)