Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Is there a way? Expand / Collapse
Author
Message
Posted Wednesday, August 14, 2013 2:10 PM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Thursday, August 15, 2013 11:06 AM
Points: 5, Visits: 12
If manually did a sql backup (example, right clicking on the database name, Tasks, Backup) is there any way to capture this so I can either create a sql script or have it capture it for me? I don't know how to look under the covers of the gui to see what this process is doing.... I just want to be able to replicate this exact process, but with a script that I can automate or run automatically.
Any suggestions for a newbie?

Thanks!
Post #1484483
Posted Wednesday, August 14, 2013 2:48 PM


SSChampion

SSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampion

Group: General Forum Members
Last Login: Today @ 2:54 PM
Points: 13,228, Visits: 12,705
dwayne.hofstetter (8/14/2013)
If manually did a sql backup (example, right clicking on the database name, Tasks, Backup) is there any way to capture this so I can either create a sql script or have it capture it for me? I don't know how to look under the covers of the gui to see what this process is doing.... I just want to be able to replicate this exact process, but with a script that I can automate or run automatically.
Any suggestions for a newbie?

Thanks!


You can always run profiler to track the sql statements that are being run. But in this case it is pretty straight forward because it is just a backup you want to execute.

http://technet.microsoft.com/en-us/library/ms186865.aspx


_______________________________________________________________

Need help? Help us help you.

Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.

Need to split a string? Try Jeff Moden's splitter.

Cross Tabs and Pivots, Part 1 – Converting Rows to Columns
Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs
Understanding and Using APPLY (Part 1)
Understanding and Using APPLY (Part 2)
Post #1484498
Posted Thursday, August 15, 2013 2:30 AM


SSC-Addicted

SSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-Addicted

Group: General Forum Members
Last Login: Yesterday @ 7:17 AM
Points: 487, Visits: 259
In Management Studio:

Right click on the database -> Tasks -> Backup...

Make your choices in the Back Up Database dialog box

Instead of clicking OK to start the back up, click in the Script button on the top. This generates a script in a new query windows and the Back Up Database dialog box is still active.

If you click on the little triangle it gives you several choices to generate a script. The default action is: Script Action to New Query Window.
Post #1484635
Posted Thursday, August 15, 2013 5:28 AM


SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: Yesterday @ 8:18 AM
Points: 2,448, Visits: 2,988
SQL Surfer '66 (8/15/2013)
Instead of clicking OK to start the back up, click in the Script button on the top. This generates a script in a new query windows ...


The option to script your actions is available on many places within SSMS. Many times it's also possible (for instance on a stored procedure) to right-click on an object and choose the "script as" option.
Great way to learn about T-SQL and see what the GUI is doing!


** Don't mistake the ‘stupidity of the crowd’ for the ‘wisdom of the group’! **
Post #1484696
Posted Thursday, August 15, 2013 5:43 AM


SSChampion

SSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampion

Group: General Forum Members
Last Login: Today @ 3:08 PM
Points: 14,017, Visits: 28,395
One of those instances where I wish we could vote on answers. SQL Surfer has nailed it. When you're creating that backup in the GUI, just generate the script.

----------------------------------------------------
"The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood..." Theodore Roosevelt
The Scary DBA
Author of: SQL Server Query Performance Tuning
SQL Server 2012 Query Performance Tuning
SQL Server 2008 Query Performance Tuning Distilled
and
SQL Server Execution Plans

Product Evangelist for Red Gate Software
Post #1484702
Posted Thursday, August 15, 2013 5:50 AM
SSCarpal Tunnel

SSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal Tunnel

Group: General Forum Members
Last Login: Today @ 2:00 PM
Points: 4,477, Visits: 3,929
This is a great way to learn what SQL the GUI is generating and firing, but consider taking it to the next step and checking out the commands on MSDN. That way you can not only learn the command, but a lot of the options available. This leads to a real understanding of the commands and you'll have it in your toolbox for later.


Tally Tables - Performance Personified
String Splitting with True Performance
Best practices on how to ask questions
Post #1484707
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse