資料庫備份與恢復

2021-04-24 18:47:14 字數 2055 閱讀 3247

unit ustore;

inte***ce

uses

windows, messages, sysutils, variants, classes, graphics, controls, forms,

dialogs, stdctrls, ibservices;

type

tfrestore = class(tform)

ibbackupservice1: tibbackupservice;

ibrestoreservice1: tibrestoreservice;

button1: tbutton;

memo1: tmemo;

button2: tbutton;

memo2: tmemo;

procedure button1click(sender: tobject);

procedure button2click(sender: tobject);

private

public

end;

var frestore: tfrestore;

implementation

procedure tfrestore.button1click(sender: tobject);

begin

//資料庫備份

with ibbackupservice1 do

begin

servername := 'employee';

loginprompt := false;

params.add('user_name=sysdba');

params.add('password=masterkey');

active := true;

tryverbose := true;

options := [nontransportable, ignorelimbo];

//指定資料庫原始檔 ,設定為特定的資料庫檔案

databasename := 'g:/malin/employee.gdb';

//指定備份檔案

backupfile.add('c:/temp/employee1.gbk');

//啟動服務

servicestart;

while not eof do

//在memo元件中顯示備份資訊

memo1.lines.add(getnextline);

finally

active := false;

end;

end;

end;

procedure tfrestore.button2click(sender: tobject);

begin

//從備份檔案中恢復資料庫

with ibrestoreservice1 do

begin

servername := 'poulet';

loginprompt := false;

params.add('user_name=sysdba');

params.add('password=masterkey');

active := true;

tryverbose := true;

options := [replace, useallspace];

pagebuffers := 3000;

pagesize := 4096;

//要恢復的資料庫

databasename.add('g:/malin/employee1.gdb');

//指定備份檔案

backupfile.add('c:/temp/employee1.gbk');

servicestart;

while not eof do

//在memo元件中顯示恢復資訊

memo2.lines.add(getnextline);

finally

active := false;

end;

end;

end;

end.

資料庫備份與恢復

主要 段 資料庫的備份和實時進度顯示 public bool backupdb string servername,string username,string password,string strdbname,string strfilename,progressbar pgbmain catc...

資料庫備份與恢復

對於絕大多數企業來講,失去資料就相當於失去商機 失去產品 失去客戶,甚至會造成公司倒閉,那麼,在所有的資料中,最核心的資料又是哪些呢?這恐怕要屬資料庫中的資料了,當然,並不是說其他資料不重要,只是這一部分更具代表性。既然資料庫中的資料地位這麼高,那麼資料庫備份與恢復的重要性就不言而喻了。1 mysq...

資料庫備份與恢復

資料庫備份與恢復 mysql資料庫備份 基本備份輸入命令 mysqldump u root p stumysql1 home bak 2019 04 11 stumysql1.sql enter password song123 此時,已成功將資料庫stumysql1備份到 home bak 201...