Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Backing Up Sql Databases
Message
From
10/04/2007 16:27:10
Dragan Nedeljkovich (Online)
Now officially retired
Zrenjanin, Serbia
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
01213442
Message ID:
01214148
Views:
9
>Hi Folks,
>Thanks for all your comments and suggestions.
>
>However, I still dont know where else, other than the LDF and the MDF data is stored. I know I may not need this info bit I am curious.
>
>Also, it seems that most solutions require the user to go into SQL server management studio (or simular) to start the backup.(other than purchased Backup Solutions)
>Is there any solution where I can have an icon on the desktop, or a scheduled event , of some sort.

Here's the crucial part of my backup app. I had to obfuscate some things as I don't own the code:
	Procedure DoBkp()
Local cSql


*-- TEXT BLOCK BEGIN
TEXT TO csql NOSHOW TEXTMERGE

BACKUP LOG mydb WITH TRUNCATE_ONLY
use mydb
dbcc shrinkfile(2,0,TRUNCATEONLY)

use master

backup database mydb to disk='<<this.cBkpPath>>' with init

ENDTEXT
*-- TEXT BLOCK END

		l=oTsql.Exec(cSql,"result",1)
		Return l
This is a part of the class which handles several things in the process. The shrinkfile part is not necessary, I just found it handy to run daily.
This.cBkpPath is a fully qualified pathname of the .bak file (as seen from the perspective of the SQL server, i.e. as if you're sitting at the machine where it runs!). oTsql is just a SPT handler class, the .exec call basically just runs a SqlExec() and logs the errors, returns success or not.

I've built an exe around this, scheduled it to run daily and that's it.

back to same old

the first online autobiography, unfinished by design
What, me reckless? I'm full of recks!
Balkans, eh? Count them.
Previous
Reply
Map
View

Click here to load this message in the networking platform