.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
MarieAdela
Imran Ghani
Post New Web Links

backup script

Posted By:      Posted Date: May 22, 2011    Points: 0   Category :
 

Hi

I use SQL Server 2008 R2.

I found a script, where I can backup all dbs.

But I don't know how to add additional options like backup type (full), verify and so forth.

Thanks for your help.

Patrick

/* script copied from http://www.mssqltips.com/tip.asp?tip=1070  */


DECLARE @name VARCHAR(50) -- database name 
DECLARE @path VARCHAR(256) -- path for backup files 
DECLARE @fileName VARCHAR(256) -- filename for backup 
DECLARE @fileDate VARCHAR(20) -- used for file name 

SET @path = 'C:\Backup\' 

SELECT @fileDate = CONVERT(VARCHAR(20),GETDATE(),112) 

DECLARE db_cursor CURSOR 

View Complete Post


More Related Resource Links

Named Pipes provider error - backup script

  
I have a couple of installs of SQL Server 2005 Express.  One thing it doesn't provide is an agent to schedule jobs so I read where you can use Windows job scheduler to execute a batch job to in turn run a sqlcmd file.  I have that working on one server but on the other server I get the dreaded Name Pipes provider error and it goes on to talk about it may not be setup to allow remote connections.  If I check using Surface Configurator it is set to allow remote connections using both tcpip and named pipes.  To my knowledge all I want it tcpip but I enabled named pipes in an effort to get things working. About the only difference I can see is on the working system the database is a named instance (ie. Servername) versus default instance on the non-working system which shows up as (Servername\SQLEXPRESS).  Hopefully I have my terminology right here. Any tips on how to troubleshoot?  Does it depend on the username I am using?  Domain admin or local server admin or what have you? I should mention I can execute the backup script and it does work.  It is when I run the batch job that it fails. The batch job just says "sqlcmd -i d:\MSSQL_Jobs\backup.sql -o d:\Logs\sqlbackup_output.txt"

Restore Database Backup using SQL Script

  

I need to backup a database using query.Please help me.


The backslash '\' on backup script was eliminated.

  

Hi,

One SQL Server 2005 (version 9.00.4035) on server SCHEDULE has a maintenance plan to backup database to NAS.

The maintenance plan is cheduled to run from a TNG that is running on another server that has SQL Server 2005 (version 9.00.3042) . The full script that is scheduled by TNG is :

dtexec.exe /SQL "Maintenance Plans\Backup_To_NAS" /SERVER schedule   /MAXCONCURRENT " -1 " /CHECKPOINTING OFF /SET "\Package\Subplan_1.Disable";false /REPORTING E

Last nigt I got the error message for this backup job failure on one database (master), other databases are completed successful.

SCHEDULE - SQL Backup failed - Microsoft (R) SQL Server Execute Package Utility Version 9.00.3042.00 for 32-bit Copyright (C) Microsoft Corp 1984-2005. All rights reserved. Started: 7:15:05 PM Error: 2010-10-04 19:17:38.66 Code: 0xC002F210 Source: Back Up Database Task Execute SQL Task Description: Executing the query 'BACKUP DATABASE [master] TO DISK = N'\stationTTCApplicationsSQL_Backupsschedulemaster_backup_201010041915.bak' WITH RETAINDAYS = 1, NOFORMAT, NOINIT, NAME = N'master_backup_20101004191507', SKIP, REWIND, NOUNLOAD, STATS = 10 ' failed with the following error: 'Write on '\stationTTCApplicationsSQL_Backupsschedulemaster_backup_201010041915.bak' failed: 64(The specified network name is no longer avail

The backslash '\' on backup script was eliminated.

  

Hi,

One SQL Server 2005 (version 9.00.4035) on server SCHEDULE has a maintenance plan to backup database to NAS.

The maintenance plan is cheduled to run from a TNG that is running on another server that has SQL Server 2005 (version 9.00.3042) . The full script that is scheduled by TNG is :

dtexec.exe /SQL "Maintenance Plans\Backup_To_NAS" /SERVER schedule   /MAXCONCURRENT " -1 " /CHECKPOINTING OFF /SET "\Package\Subplan_1.Disable";false /REPORTING E

Last nigt I got the error message for this backup job failure on one database (master), other databases are completed successful.

SCHEDULE - SQL Backup failed - Microsoft (R) SQL Server Execute Package Utility Version 9.00.3042.00 for 32-bit Copyright (C) Microsoft Corp 1984-2005. All rights reserved. Started: 7:15:05 PM Error: 2010-10-04 19:17:38.66 Code: 0xC002F210 Source: Back Up Database Task Execute SQL Task Description: Executing the query 'BACKUP DATABASE [master] TO DISK = N'\stationTTCApplicationsSQL_Backupsschedulemaster_backup_201010041915.bak' WITH RETAINDAYS = 1, NOFORMAT, NOINIT, NAME = N'master_backup_20101004191507', SKIP, REWIND, NOUNLOAD, STATS = 10 ' failed with the following error: 'Write on '\stationTTCApplicationsSQL_Backupsschedulemaster_backup_201010041915.bak' failed: 64(The specified network name is no longer avail

full backup script

  

i have to take full backup mannually on shared location not through maintenace plan.Please send me the script...... help me..


Thanks

Backup Script Doesn't Connect

  

I am using SSMS 2008 to automate backup of SQL Express databases.  I connect to the databases using Windows Authentication, right-click on the databases and select Task-Backup.  After selecting the backup options, I have saved the script to the local drive.  To automate the database backup, I have scheduled a Windows Task to run the script at a scheduled time.  The tasks run as programmed.  The problem that I am having is the script opens SMMS, but doesn't connect to the database.  The Connect window stays open until I click on the Connect option, and then the database is backed up successfully.  What am I missing in the script to automate the connection process?

Thanks for your help!


Backup script

  

Hello all, I wish to create a daily backup script that would automatically rename the .bak file to the date of backup instead of appending to the existing .bak. I have tried doing something like below but returned error. Would appreciate any idea or suggestion. Thanks~

Declare @Date nvarchar(100)
select @Date = convert(nvarchar(100), getdate(), 4)

BACKUP DATABASE [IDB] TO DISK = N'D:\IDB '+ ''+ @Date +'' +'.bak' WITH NOFORMAT, NOINIT, NAME = N'IDB-Full Database Backup', SKIP, NOREWIND, NOUNLOAD, STATS = 10
GO

 


Restore of database backup done by script failed

  

Hi,

In my C++ application (with MFC) developed in Visual Studio 2010 the user has an option to take a backup of the current database. This is done by executing a Stored Procedure which takes the database name and backup file name as parameters:

CREATE PROCEDURE sp2_backup_database @DATABASE nvarchar(100), @FILENAME nvarchar(260)
WITH ENCRYPTION
AS
SET NOCOUNT ON
Begin
  Exec ('Backup Database [' + @DATABASE + '] TO  DISK = ''' + @FILENAME + '''
      WITH COPY_ONLY, NOFORMAT, INIT,  NAME = ''' + @DATABASE +
      '-Full Database Backup'', SKIP, NOREWIND, NOUNLOAD, STATS = 10')
   Return @@ERROR
End
GO

All this works fine, the backup is done properly by the SP.
What is bothering me is that when trying to make a restore of the database from the backup file the restore fails with a message like (freely translated from Swedish):

"Restore failed for [the SQL Server]. (Microsoft.SqlServer.SmoExtended)
Additional information:
System.Data.SqlClien.SqlError: RESTORE can not process the database [Database-name] since it's in use by this process. It's recommended to use master database during this task."

The only way I can

SQL Server Backup and Restore (video)

  
Restore your full backup, then run a few queries before you keep restoring transaction logs. Brent shows how to use the Standby option for restores.

In this five minute video, Brent demonstrates how to do it by creating a database, populating data, and then showing what disaster recovery is like by doing RESTORE WITH STANDBY.

Rendering ASP.NET Script References into the Html Header

  
One thing that I've come to appreciate in control development in ASP.NET that use JavaScript is the ability to have more control over script and script include placement than ASP.NET provides natively. Specifically in ASP.NET you can use either the ClientScriptManager or ScriptManager to embed scripts and script references into pages via code.

How to backup SMS from windows mobile Pocket PC to computer

  
How to backup SMS from windows mobile Pocket PC to computer

Many Windows Mobile Pocket PC Phone users could not backup their SMS to txt file or view on computer. I found this software offers a SMS Messages backup solution to Backup all SMS messages for Windows Mobile Phones onto computer and keep them safe. Here is the user's guide:

*.axd script references not being rendered to browser

  

I'm running VS2010 with .net 4.0, and am running into issues with the .net ajax script tags mysteriously not being rendered to the browser.

So far I've reduced it to a scenario where I set the DataSourceID property of a databound control.  More specifically, I've only tested it on a Gridview and a DropDownList.

This can be reproduced fairly easily on my machine by following these steps:


1. Create a new empty Web Application Project

2. Create a new Web Form

3. Add a ScriptManager inside the form

4. Add a DropDownList and a DataSource (I used an ObjectDataSource)

5. Set the DataSourceID property of the DropDownList to the ID of the DataSource.  This can be done either declaratively on the .aspx page, or in the code behind in the aspx.cs page, and both produce the same results.

6. Open the page in a browser and watch as you get a javascript error stating "Sys is not defined" and notice that the page source contains no script tags referencing *.axd scripts.


Here's my source code showing my set up:

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="ScriptResourceFAIL.Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 T

Client script not running

  

Dear all,

in my MVC 2 application, and in the shared Master Page I wrote this little script for menu handling :

<script src="../../Scripts/jquery-1.4.1.js" type="text/javascript"></script>
<script type="text/javascript"> $(document).ready(function () {   
       
     $('#nav li').hover(  
         function () {  
             //show its submenu  
             $('ul', this).slideDown(100);  
   
         },   
        function () {  
           //hide its submenu  
            $('ul', this).slideUp(100);           
         }  
     );  
       
 });</script>


The script, that shows menu items when the

Potentially dangerous script....blah blah

  

explain this one - -   (please)

2 projects - same code - one, using 2008, one using 2010 - a textbox a button and a label, using html code in the textbox

In the Page Directive:
EnableEventValidation="false" ValidateRequest="false&q

Toolbox: Easy File Backup, Exploring Files And Folders Inside Visual Studio, Multiple Monitor Softwa

  

If the responsibility for creating, managing, and executing routine backups is yours, these tools will make it easier. Also see how you can browse folders and files from inside Visual Studio.

Scott Mitchell

MSDN Magazine May 2009


Cutting Edge: Custom Script Callbacks in ASP.NET

  

ASP. NET client callbacks represent a neat and elegant way to execute server-side code without posting and refreshing the current page. I discussed ASP. NET callbacks in the August and December 2004 installments of Cutting Edge, considering them from the perspective of rendered pages making background callbacks to the server, sending input data to the relevant page, and receiving a response.

Dino Esposito

MSDN Magazine January 2005


Cutting Edge: Implications of Script Callbacks in ASP.NET

  

Script callbacks in ASP. NET 2. 0 is a feature whose time has come. Script callbacks can significantly speed up an application by limiting server postbacks. They also allow you to execute small portions of server-side code without having to manage the view state for reading or writing.

Dino Esposito

MSDN Magazine December 2004


Categories: 
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend