Home > database >  How to realize the data backup and recovery
How to realize the data backup and recovery

Time:10-06

9.0 pb + ASA, consult how to backup and restore?
What additional backups on earth? Back again?
Hope experts explain the principle, the younger brother grateful!!!!!!

CodePudding user response:

Own up! You kind help!

CodePudding user response:

The Adaptive Server Anywhere (ASA) of this article the original concept (PB) in this paper with the database management system, can be used as a small database Server, application system and database backup/recovery is a basic work, want to in a short span of a few minutes to complete this kind of program written, can do it? This article will introduce a written in PB ASA backup/restore procedures, only a short period of time, can be compiled and used in the ASA as small applications of data environment,
一 BeiFenChengXu
先来看看备份程序部分的写法,在窗体上建一文本框 sle_1,用来显示备份的文件名,并添加两个按钮:cb_1(浏览),cb_2(备份),相应的事件代码如下:
//cb_1.clicked()
string fname,name
GetfileSaveName('保存',fname,name,"db",'数据库备份文件(*.1),*.1')
sle_1.text=fname
//cb_2.clicked()
string mysql,bfname
bfname=trim(sle_1.text)
bfname=left(bfname,len(bfname)-2)
mysql="BACKUP DATABASE TO '"+bfname+"'"
execute immediate :Mysql USING SQLCA;//use the SQL statement immediately perform a backup
if sqlca.sqlcode=0 then
messagebox("信息提示",'备份成功! 'the information! , OK!//give information about backup success
else
messagebox("信息提示",'备份失败! 'the information! , OK!
end if
I have GetfileSaveName (' save ', fname, name, "db", "database backup files (*. 1), *. 1 ')
Changed to GetfileSaveName (' save ', fname, name, the "db", "database backup files (*. Db), *. Db ')
Why save or after.. 1 the format

CodePudding user response:

Who is going to help me see!

CodePudding user response:

The mysql="BACKUP DATABASE TO '" + bfname +"' "
The execute immediate: Mysql USING SQLCA;//use the SQL statement immediately perform a backup


Change

Mysql="BACKUP DATABASE TO 'fname" + + ", "
The execute immediate: Mysql USING SQLCA;//use the SQL statement immediately perform a backup

Have a try

CodePudding user response:

The mysql="BACKUP DATABASE TO '" + bfname +"' "
The execute immediate: Mysql USING SQLCA;//use the SQL statement immediately perform a backup


Change

Mysql="BACKUP DATABASE TO 'fname" + + ", "
The execute immediate: Mysql USING SQLCA;//use the SQL statement immediately perform a backup

Have a try

CodePudding user response:

The mysql="BACKUP DATABASE TO '" + bfname +"' "
The execute immediate: Mysql USING SQLCA;//use the SQL statement immediately perform a backup


Change

Mysql="BACKUP DATABASE TO 'fname" + + ", "
The execute immediate: Mysql USING SQLCA;//use the SQL statement immediately perform a backup

Have a try

CodePudding user response:

Eldest brother, you are not playing me?

CodePudding user response:

I these days are doing backup. Show it to you. But I am backup of SQL, was a success. The hope can help you
Int li_net
//database full backup
String ls_path, ls_use
//

Ls_use='EXEC' + '(' +' USE Studentexperiment "" + ') '//set up the backup of the logical
The EXECUTE IMMEDIATE: ls_use;

Ls_path=sle_1. Text//get the path

The SQLCA. The AutoCommit=TRUE

Ls_use="EXEC sp_addumpdevice" disk ", "+", 'Studentexperiment', "+" '" + ls_path + "' "
The EXECUTE IMMEDIATE: ls_use;//write backup path

Ls_use="BACKUP DATABASE Studentexperiment to Studentexperiment"//BACKUP DATABASE Studentexperiment for Studentexperiment
The EXECUTE IMMEDIATE: ls_use;

Ls_use="exec sp_dropdevice 'Studentexperiment"//delete logical device
The EXECUTE IMMEDIATE: ls_use;

The SQLCA. The AutoCommit=false

If the sqlca. Sqlcode=0 then
Backup messagebox (" information ", "success!" )
End the if
  • Related