January 28, 2002 at 9:27 am
Hi,
I ran into problem when I set FormatMedia property to TRUE in backup object. if I do not set this property or set it to FALSE, the code runs fine.
Here is the exerpt of the relevant code:
g_pSQLBackup->SetDatabase (g_szDBName);
g_pSQLBackup->SetTapes(g_szBkupRstrFileName);
g_pSQLBackup->SetAction(SQLDMOBackup_Database);
g_pSQLBackup->SetBackupSetName (g_szBkupSetName);
g_pSQLBackup->SetFormatMedia (TRUE);
// perform backup
if FAILED(hr = g_pSQLBackup->SQLBackup (g_pSQLServer)) {
printf("in C, Backup failed\n");
} else {
printf("in C, Backup is successful\n");
}
Please help me identify what's wrong with my code.
Thanks
Bill
February 2, 2002 at 6:17 pm
Hi Bill,
Sorry for the late reply, was out of the office for a few days. It'll be another day or two before I get a chance to look into it, don't have a machine at home right now that has SQL AND a tape drive!
Andy
February 4, 2002 at 8:47 am
Hi, Andy,
Glad to hear from you. Here is additional info:
1) SQL server 7.0
2) if I use SetInitialize(TRUE) instead of SetFormatMedia(TRUE), the code can also run without problem.
3) if I use T-SQL to do backup, there is no problem with format or init option. But I may have to use DMO because of the event feature, such as nextMedia event I need to show to user via Java app.
Bill
February 4, 2002 at 1:41 pm
Cool - I'll try to experiment tonight if I can get everythign working at home so I have a tape to test with.
Andy
February 11, 2002 at 6:41 pm
Hey Bill,
Think this is a record for slowest reply, sorry for the delay. Did some quick testing and found that if I do the following it works:
.FormatMedia = True
.Initialize = True
.SkipTapeHeader = True
There is some interaction between init and skip, take a look at Backup in BOL. A good way to get a better feel for whats going on is to do the following just before the call to the SQLBackup method:
sql = .GenerateSQL
Debug.Print sql
That way you can see exactly what DMO is generating. See if that works. If not, we'll definitely try to do a faster turn around on the next question!
Andy
February 15, 2002 at 2:23 pm
Hi, Andy
It Works! Your suggestions are very helpful.
Thanks a lot
Bill
February 15, 2002 at 2:59 pm
Viewing 7 posts - 1 through 7 (of 7 total)
You must be logged in to reply to this topic. Login to reply
This website stores cookies on your computer.
These cookies are used to improve your website experience and provide more personalized services to you, both on this website and through other media.
To find out more about the cookies we use, see our Privacy Policy