August 14, 2012 at 12:38 am
Comments posted to this topic are about the item 11 Tips to Backup databases with SMO, VB, C# Powershell, Command lines
August 14, 2012 at 5:30 am
Nice summary of backup methods, Daniel. I also like that you took the time to demonstrate how you can schedule backups for SQL Express. Well done.
As an off subject sidebar, let's hope that SMO doesn't go the way of the Dodo bird as did DMO.
--Jeff Moden
Change is inevitable... Change for the better is not.
August 14, 2012 at 8:57 am
Nice write-up Daniel. 🙂
For the PowerShell portion, I would highly recommend using the Backup-SqlDatabase cmdlet that came with SQL Server 2012. It's much simpler to just backup your databases with a simple:
dir SQLSERVER:\SQL\LocalHost\Default\DATABASES\ | Backup-SqlDatabase
Cheers!
@SQLvariantI have a PowerShell script[/url] for you.
August 14, 2012 at 9:34 am
Thanks a lot for the feedback is pretty cool to write in sqlservercentral ! 😎
August 15, 2012 at 3:15 am
I do backups frequently from my computer which is different from the server on which the database resides. But I want the backup to end up on my computer. This requires making use of a special kind of net share. The BAT file below shows what I mean.
set backupdir=C:\Backup
set database=MYDATABASE
set sqlserver=SQLSERVER
set sqluser=SQLUSER
set sqlpassword=SQLPASSWORD
echo backup database %database% to disk='\\%computername%\backup\%database%.bak' with stats=1 > backup.sql
erase %backupdir%\%database%.bak
net share backup /d
net share backup=%backupdir%
sqlcmd -S %sqlserver% -U %sqluser% -P %sqlpassword% -d %database% -i backup.sql
net share backup /d
erase backup.sql
On occasion, I have to use my computer's IP address. A non-server's IP address can change (for various reasons) and getting the IP addess is just a little tricky - but not impossible.
October 14, 2012 at 5:45 am
Many ways to skin a cat! Empowering to know as many ways as possible to perform a set task or tasks then see which is the best fit.
Good article.
qh
Viewing 6 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply