Quantcast
Channel: Operations Manager - General forum
Viewing all articles
Browse latest Browse all 11941

How to backup SQL server database using powershell

$
0
0

I am trying to backup sql server 2008R2 database, name of the database is test I am using the following script but i get an error message that database does not exists, but I can see "test" database and tables and i can query them..

Backup-SqlDatabase -ServerInstance testpc-001\SQLEXPRESS -Database test -BackupAction   Database

and if i try an edit the above script using

$date = Get-Date -Format yyyyMMddHHmmss$dbname ='test'
Backup-SqlDatabase -ServerInstance SQLEXPRESS -Database$dbname -BackupFile   "C:\DBbackups\$($dbname)_db_$($dt).bak"

I am getting an error failed to connect to SQLEXPRESS


Viewing all articles
Browse latest Browse all 11941

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>