Home >Database >Mysql Tutorial >DB2数据库之常用的备份和恢复命令

DB2数据库之常用的备份和恢复命令

WBOY
WBOYOriginal
2016-06-07 15:43:502273browse

一、整库备份(备份数据为一个文件) 1)备份之前断开所有连接 db2 force application all 2)备份 db2 backup db dbname user db2admin using db2admin to d:/ 3)恢复 db2 restore db dbnameuser db2admin using db2admin from d:/ 二、按模式备份(备份数

一、整库备份(备份数据为一个文件)

1)备份之前断开所有连接

db2 force application all

2)备份

db2 backup db dbname user db2admin using db2admin to d:/

3)恢复

db2 restore db dbname user db2admin using db2admin from d:/

二、按模式备份(备份数据为多个文件)

1)备份表结构

db2look -d dbname -e -a -x -i db2admin -w db2admin -o d:\createdb.sql

2)导出数据(进入到指定目录后执行)

db2move dbname export -u db2admin -p db2admin

3)导入表结构

db2 -tvf createdb.sql

4)导入数据(进入到指定目录后执行)

db2move dbname import -u db2admin -p db2admin

三、以文本方式导入导出某个表(数据量较小的表)

1)导出

export to d:\dbtable.txt of del select * from dbtable;

2)导入

import from d:\dbtable.txt  of del insert into dbtable;


Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn