SQL Backup

Silas2
Silas2 used Ask the Experts™
on
I've got a SQL server at an ISP which I want to archive, structure + data. I'm trying to find the old SQL Publishing Wizard, but I can't seem to get one that works. I just want a backup in case this app ever goes online again.
What is the best thing to do?
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
ste5anSenior Developer

Commented:
Make a backup of all databases.
what version Sql?

transact SQL
USE AdventureWorks2012;
GO
BACKUP DATABASE AdventureWorks2012
TO DISK = 'Z:\SQLServerBackups\AdventureWorks2012.Bak'
   WITH FORMAT,
      MEDIANAME = 'Z_SQLServerBackups',
      NAME = 'Full Backup of AdventureWorks2012';
GO

powershell
1 setup sql server powershell provider PowerShell Provider
2 C:\PS>
Backup-SqlDatabase -ServerInstance Computer\Instance -Database MyDB -BackupAction Database

Author

Commented:
That transact SQL isn't going to bring the DB down from the web is it? (I can't make a file on the remote server)
Ensure you’re charging the right price for your IT

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden using our free interactive tool and use it to determine the right price for your IT services. Start calculating Now!

Author

Commented:
Right, getting there with the PowerShell...I'm using this command:
Backup-SqlDatabase -ServerInstance dmssql.databasehost.co.uk -Database silas02_walkden2 -Credential (Get-Credential silas02_uname) -BackupFile "c:\deletes\walkden.bak"

Open in new window

I'm getting in, but just saying the backup file doesn't exist. I was hoping it would make it + even better to make a sql script like the wizard used to ....any help? (sorry to be so helpless)
no it will not bring the DB down
wht version of powershell are you running?
$bakfile = "walkden.bak"
$backuppath = "c:\deletes"
if(!(Test-Path $backuppath )){New-Item -ItemType Directory -Path $backuppath}
$backupfile = Join-Path -Path $backuppath -ChildPath $bakfile

Backup-SqlDatabase -ServerInstance dmssql.databasehost.co.uk -Database silas02_walkden2 -Credential (Get-Credential silas02_uname) -BackupFile $backupfile

also try  -SqlCredential "silas02_uname"
migth be your version of powershell/sql server


see if that helps

Author

Commented:
Thanks for that.
The funny thing is, I keep getting 'Cannot open device c:\deletes\walkden.bak', maybe I should create it with Management Studio?
Vitor MontalvãoIT Engineer
Distinguished Expert 2017

Commented:
That transact SQL isn't going to bring the DB down from the web is it?
You can backup to a network share:
BACKUP DATABASE DatabaseName
 TO DISK = '\\ServerName\ShareName\DatabaseName.Bak'

Open in new window

Author

Commented:
The db as with an ISP, I don't have any network share, only ftp access.
Vitor MontalvãoIT Engineer
Distinguished Expert 2017
Commented:
I mean, the share need to be from your side, so the DB server can write into it.
Anyway this may raise some security issues from the provider and depending in their policies this may not be achieved. You'll need to ask them, I think.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial