Showing posts with label backup. Show all posts
Showing posts with label backup. Show all posts

Wednesday, March 28, 2012

Scheduling MSSQL Databases Daily Backup

Hi -
I want to Schedule Daily Backup of MSSQL Databases .. How can i do it .. How can i schedule it so that it get backuped everyday automatically at desired time.
Kind RegardsYou need to read up on Maintenance Plans on BOL. How yoyur databases are setup and each applications recovery requirements in order to setup the backups properly. Also read up on Recovery Plans.|||You can use the SQL Server Agent Utility (available through Enterprise Manager) to schedule jobs to run at regular times. The Maintenance Plan wizard merely creates the jobs for you (and also provides a convenient method of grouping databases upon which to perform identical maintenance).

blindman

scheduling maintenance activities

Am I able to do this in SS Express -like a backup or something or do I need to purhcase a SQL Server Agent (I believe I saw a 3rd party company always advertising this in SQL Server Central.com). It's cheap -- just curious if I really need it.

SQL Express does not contain any specific scheduling tools. You can schedule T-SQL scripts to be run using Windows Task Scheduler and SQLCmd, which is a free solution as Task Scheduler is part of Windows.

For more complex needs, a third party scheduling tool is an option.

Regards,

Mike Wachal
SQL Express team

-
Mark the best posts as Answers!

sql

scheduling job in sql server 2005

Hi,

I created a scheduled job in sql server 2005 which takes a daily backup of database.

My problem is this job does not run automatically.but when i execute it manually it runs on that instance.

do i need to activate any servrice to have scheduling of jobs running perfectly on my machine ?

Please guide me on this.

Thanks,

Prashant

The SQL Agent Server must be running (Check in Services) and have OS permission to the backup file location.

The Job must be 'Enabled'.

The Schedule must be 'Enabled'

Monday, March 26, 2012

Scheduling Complete and Differential backups

I'm new to the SQL 7 scene but would like a few things clearing up with regards to scheduling backups.

Our backup time of databases has recently changed. I've scheduled in the new database backup using Enterprise Manager with the new time.

I expected the backup to take place at the new time, which it does, but when I came to restoring the database I've noticed that the old backup time is still being carried out. How do I cancel or get rid of the old backup time?

Secondly, If I do a complete backup of the database using Enterprise Manager, can I deattach the transactional log and delete the transactional log before reattaching in order to free up MG?

Thirdly, is carrying out a complete backup of the database via Enterprise Manager enough to ensure a full backup of the database should anything go wrong?

I would like help on these matters please as I need these clearing up. thanking you in advance!!!It sounds like you might have two scheduled jobs running one for the old time and one for the new time if so find the old job and delete it.

If you need to restore your database to a point in time you need the transaction log. A full backup backs up the database and the T-log together so you will only be able to restore to the last time you did the full backup.

If the transaction log is getting to large you can truncate the log which is sort of the same thing as deleting but doesn't actually get rid of the .ldf file. If you truncate the log without first backing it up you lose all those transactions from the last time the log was backed up!

If you need to restore to a point in time you need the T-log. Say you do a full backup every night and a T-log backup every hour. We will say that SQL fails on Tuesday at 1:45pm. To restore you would backup the current T-log because the next scheduled T-log backup will not occur until 2pm. and it contains the active portion of the log and you need to recover it by backing it up. You then would apply the full backup and all T-log backups in sequence up to the point of failure.

If you have SQL installed then you should have Books Online installed. You should find it in the menu. They have exhaustive information that talks about backup strategies. I suggest you take some time to read up on it it's well worth the time.

Best Regards|||[QUOTE][SIZE=1]Originally posted by mkal
It sounds like you might have two scheduled jobs running one for the old time and one for the new time if so find the old job and delete it.

Thats the thing, I'm pretty sure I deleted the old Database_bk file and created a new one in the 'MSSQL\Backup' folder but still the old backup time is there when doing a restore. I'll have another go.

As for the tranasactional backup, we currently carry out a Complete backup of a weekend and a differential backup every night which is scheduled using the Enterprise Manager but there is no option to backup the Transaction log. How is this done?

You'll have to bear with me on this one as I'm still a newbie and require a lot of patience.

Thanks v.much for the reply|||I'm still getting two lots of complete backups to restore as well as two lots of differential backups to restore having changed the times of when the backups are scheduled using Enterprise Manager.

Is there anyway I can get it so that there is only one backup scheduled?|||Deleting the backup file is not the same as deleting the job. In Enterprise Manager expand out the server you create the backups for. Click on the Management folder and then SQL Server Agent and then click on jobs. In the right hand pane you should see a list of jobs. There should be the one for your backup and possibly others. To explore what the job is doing right click on it and choose properties. You then can take a look at what's going on.

To free up space on the drive where the T-log is you can run a script see below, just replace the info between the <> (but don't include the <>) with the name of the database, name of the log file and the size expressed as an integer you want the file to become.

The following is from BOL:

If target_size is specified, DBCC SHRINKFILE attempts to shrink the file to the specified size. Used pages in the part of the file to be freed are relocated to available free space in the part of the file retained. For example, if there is a 10-MB data file, a DBCC SHRINKFILE with a target_size of 8 causes all used pages in the last 2 MB of the file to be reallocated into any available free slots in the first 8 MB of the file. DBCC SHRINKFILE does not shrink a file past the size needed to store the data in the file. For example, if 7 MB of a 10-MB data file is used, a DBCC SHRINKFILE statement with a target_size of 6 shrinks the file to only 7 MB, not 6 MB.

Backup log <DatabaseName> with truncate_only
GO
DBCC SHRINKFILE (<LogFile_Name, <targetsize>)
GO

Creating a full backup backs up the data and the T-log, so you can recover everything up to the day and time you performed the backup.

It doesn't back up the database structure i.e. tables, constraints, PK/FK. You should script your database to make sure that in the event of a major crash you can recreate the database and reload it from the backups.

To script your database use Enterprise Manager. Right click on the database you wish to script, choose 'All Tasks' and then Generate SQL Script.

Best Regards
Mike|||Cheers Mike,

When I went into the Management\SQLServerAgent\Jobs folder and sure enough I seen a whole load of jobs that had been duplicated. I have gotten rid of the ones that are now redundant and have left the jobs that run at a later time (the ones I need) in there. I'm quite sure that this will work but I will need to check in the morning after the databases have been backed up.

A big thank you mate for your help and persevering with me.|||One more thing about log backups. For this to take place you must have the recovery model of the database set to full and there must be at least one full database backup must exist.

To check the recoverty model right click on the database and choose properties. Go the options tab and where it says 'Recovery model' choose full.

Now when you right click on the database and choose 'All Tasks' and the 'Database Backup' you will see a radio button to perform a log backup.

Glad I could help.

Scheduling an automatic backup

I have only started using SQL Server 2005 Express Edition recently.I also installed Management Studio Express version to manage the database. While testing the database I had came across some question and they are:
    Can I upgrade from SQL Server 2005 Express to Workgroup/Standard/Enterprise without loosing the database and its contents. While I backed up the database, I was permitted to backup only on to my local drive even though I have administrative rights on the system. It would be easy if I could backup to a network drive directly.My question is:Is it possible to backup directly to a network drive rather than backing the database to a local drive and then "copy and paste" it to a network drive.
    Windows Scheduler: I have scheduled a daily backup of the database by midnight. I have also written the script to run the backup. But every time the scheduler starts the backup, it asks for the database password. This halts the backup until I come back in the morning and manually enter the password. My question is: is it possible to run an automatic database backup using Windows Scheduler? I understand that there are 2 types of backups: full and differential backups. My question is: Is it possible to dynamically allocate different names automatically to consecutive backups so that the previous backups are not over written

Thanks for your patience and time.

regards,
Berly Sam

1. Yes

2. SQL Server only allows backups to local drives or LUNs. There are third party backup tools that will backup to a network drive/share. I usually have a job step that 'moves' the files to a network share after the backup is complete.

3.Yes. I assume that you are using SQLCmd.exe. Use on of the following command line arguements (switches): -U login_id [ -P password ] } OR –E trusted connection. For addtional information, see Books Online, Topic: "SQLCmd Utility'. If necessary, you can download a copy of Books Online here.

4. Since you would need two separate Jobs scheduled, one for FULL backup and one for DIFFERENTIAL, then it seems that you would not have any issue having two different names. And yes, you can dynamically create your file names.

|||Thank you Mr. Rowland for replying.
But in the question of Back ups: i need to create different differential backups which take different names dynamically. Is it possible to schedule differential backups without over writing the previous backup.

Thank you for your time and patience
Regards
Berly Sam
|||

They will not 'take' names.

You will have to dynamically, and in your script/code, create the names and provide them to the backup command.

|||I was working over the backup case but was unable to come up with a solution as to how i can automatically backup the database while dynamically allocating names to consecutive differential backups. Just a reminder, the database I am using is SQL Server 2005 Express edition.

The script that is used to run the backup is
BACKUP DATABASE [DatabaseName] TO DISK = N'C:\BackUp\ST_BKUP_14_06_07'WITH DIFFERENTIAL , NOFORMAT, NOINIT, NAME = N'DatabaseName-Differential Database Backup', SKIP, NOREWIND, NOUNLOAD, STATS = 10
GO

I have also run the SQLCMD utility.
C:\Program Files\Microsoft SQL Server\90\Tools\Binn\SQLCMD.EXE -S [SERVER] -U backupadmin -P [PASSWORD] -i B:\ST_BACKUP\sqlscript.sql

What else must i do so that i get an automatic backup without being asked to login for every scheduled backup.Since the 'login' makes it compulsory for me to be on the system while the backup takes place. Is there any alteration i must make so that different names are alloted to consecutive backups thus not overwriting an old backup.|||

Before the part of the script that executes the BACKUP command, create a variable with the name you wish to use.

Code Snippet


DECLARE @.MyBackupName nvarchar(250)


SET @.MyBackupName = 'C:\BackUp\ST_BKUP_' + convert( varchar(10), getdate(), 112 ) + '.BAK'

BACKUP DATABASE [DatabaseName] TO DISK = @.MyBackupName
WITH DIFFERENTIAL ,
NOFORMAT,
NOINIT,
NAME = N'DatabaseName-Differential Database Backup',
SKIP,
NOREWIND,
NOUNLOAD,
STATS = 10

Every time this runs, the file name will be in the form: ST_BKUP_20070614.BAK, with the date changing every day.

|||

Very cool.

So, for addition information I have a question:

1-Can I create a Stored Procedure with this code and then run it from a command line (cmd) ?

2-Can I to use the osql.exe to run this command or run the Stored Procedure created with this code ?

Tks,

Mura

|||

1. By using OSQL or SQLCmd.

2. Yes, OSQL.exe with SQL 2000, SQLCmd.exe with SQL 2005.

You can use the Windows Scheduler service to automate this.

|||Thank you Mr. Rowland for replying.
Your posts have helped me solve my problem of dynamic name allocation to my backups.
Although I could solve that, the scheduled backup does not execute at the specified time and will be halted till I manually enter the login information. My question is how can i remove the login option that i have to fill-in every time a scheduled backup script is run.

This would complete my question of how an automatic backup is done in SQL Server.
Thank you for your time and patience

Regards
Berly Sam
|||

This command line prompts the user for a Server and password.

C:\Program Files\Microsoft SQL Server\90\Tools\Binn\SQLCMD.EXE -S [SERVER] -U backupadmin -P [PASSWORD] -i B:\ST_BACKUP\sqlscript.sql

I suggest that you put in the ServerName in place of [SERVER], and that you use -E instead of: -U backupadmin -P [PASSWORD]. So my suggested command line would be:

C:\Program Files\Microsoft SQL Server\90\Tools\Binn\SQLCMD.EXE -S MyServerName -E -i B:\ST_BACKUP\sqlscript.sql

|||Tkx guy,|||Thank you Mr. Rowland,
I could solve my problem. I really appreciate the time and energy you invested to help me with my issue.Once again thank you
Regards
Berly Sam
|||When I executed this code, it works fine, but the thing is when I tried to change the style in the convert function its throwing an error. The dynamic file which which is generated for each backup should have the date and also the time for me . Can anyone help me on this.
|||

You have probably selected a time format that contains characters unacceptable in a path/filename.

You may prefer to do something more like this:


Code Snippet


DECLARE @.MyBackupName nvarchar(250)


SET @.MyBackupName = 'C:\BackUp\ST_BKUP_'
SET @.MyBackupName = @.MyBackupName + convert( varchar(10), getdate(), 112 ) + '_'
SET @.MyBackupName = @.MyBackupName + replace( convert( varchar(5), getdate(), 108 ), ':', '' )
SET @.MyBackupName = @.MyBackupName + '.BAK'


SELECT @.MyBackupName

--
C:\BackUp\ST_BKUP_20070618_2124.BAK

Friday, March 23, 2012

Scheduling a backup on SQL Server Express

Hi,
is there a way to schedule a backup ?
Using the Management Studio Express I've seen only the way to Backup a
database but not to "schedule" a backup.
Any help or suggestion is appreciated
Adriano
hi Adriano,
Adry wrote:
> Hi,
> is there a way to schedule a backup ?
> Using the Management Studio Express I've seen only the way to Backup a
> database but not to "schedule" a backup.
>
unfortunately, SQLExpress does not provide the SQL Server Agent, so you have
to rely on os scheduled (AT, SCHTASKS) scripts to be run via osql.exe or
sqlcmd.exe...
Andrea Montanari (Microsoft MVP - SQL Server)
http://www.asql.biz/DbaMgr.shtmhttp://italy.mvps.org
DbaMgr2k ver 0.15.0 - DbaMgr ver 0.60.0
(my vb6+sql-dmo little try to provide MS MSDE 1.0 and MSDE 2000 a visual
interface)
-- remove DMO to reply

Scheduling a backup

Hi,

I want to schedule a backup of three databases on a daily basis.

I've written the code to run the 3 backups in TSQL and was wondering how
best to automate this procedure?

Should I put the code in an sproc and then schedule running that command
in the DTS or should I just add the TSQL into a DTS command?? Or is
there a better way of doing this?

I then prefer to use DTSRUNUI to generate the syntax and then schedule
this from the windows scheduler as opposed to the SQL SCheduler in EM
(is this the best way?)

Help would be appreciated

M3ckon

*** Sent via Devdex http://www.devdex.com ***
Don't just participate in USENET...get rewarded for it!"m3ckon" <anonymous@.devdex.com> wrote in message
news:40cdbb60$0$25520$c397aba@.news.newsgroups.ws.. .
> Hi,
> I want to schedule a backup of three databases on a daily basis.
> I've written the code to run the 3 backups in TSQL and was wondering how
> best to automate this procedure?
> Should I put the code in an sproc and then schedule running that command
> in the DTS or should I just add the TSQL into a DTS command?? Or is
> there a better way of doing this?
> I then prefer to use DTSRUNUI to generate the syntax and then schedule
> this from the windows scheduler as opposed to the SQL SCheduler in EM
> (is this the best way?)
> Help would be appreciated
> M3ckon
> *** Sent via Devdex http://www.devdex.com ***
> Don't just participate in USENET...get rewarded for it!

Putting the code in a procedure may be best, because it's simpler to manage,
and you don't get awkward problems working with EM or other tools which
allow only a very limited area for viewing code. If you're executing a DTS
package, then your geenral approach above seems OK, although the Windows
scheduler is rather limited compared to the MSSQL one, so unless there is a
very good reason not to, I would use the MSSQL scheduler.

Having said all that, using DTS as a backup mechanism is a little unusual,
unless your backups are part of a larger workflow. For simple backups,
maintenance plans are a convenient solution, although since they have some
limitations, you might have to write your own TSQL code sooner or later. But
scheduling a stored procedure in MSSQL is generally less complicated than
scheduling a DTS package, unless you need some extra functionality.

Simon|||Hi

You can do it in serveral ways, but I would control it through a SQL Agent
job. If you run the backup

See sp_add_job, sp_add_jobschedule, and sp_add_jobstep
http://msdn.microsoft.com/library/d...asp?frame=true

If you want see a backup job programmed there is a schedule option at the
bottom of the backup wizard screen in Enterprise Manager.

John

"m3ckon" <anonymous@.devdex.com> wrote in message
news:40cdbb60$0$25520$c397aba@.news.newsgroups.ws.. .
> Hi,
> I want to schedule a backup of three databases on a daily basis.
> I've written the code to run the 3 backups in TSQL and was wondering how
> best to automate this procedure?
> Should I put the code in an sproc and then schedule running that command
> in the DTS or should I just add the TSQL into a DTS command?? Or is
> there a better way of doing this?
> I then prefer to use DTSRUNUI to generate the syntax and then schedule
> this from the windows scheduler as opposed to the SQL SCheduler in EM
> (is this the best way?)
> Help would be appreciated
> M3ckon
> *** Sent via Devdex http://www.devdex.com ***
> Don't just participate in USENET...get rewarded for it!

scheduled TRN backups failing (sql2000)

I have created a backup that does once weekly BAK and every night it does TRN backup. This is in the same maintaince plan, the jobs appear as seprate jobs as they should. I have noticed my TRN is always failing, after looking into the event logs i see this.

please note this is lastest time to early:

4:22pm
this is the warning that the event log gives:

SQL Server Scheduled Job 'Transaction Log Backup Job for DB Maintenance Plan 'xxxxxxxx TRN'' (0xB87B2FA07E4FB74CA01A1D38134C9C4F) - Status: Failed - Invoked on: 2007-03-09 16:19:40 - Message: The job failed. The Job was invoked by User domain\Administrator. The last step to run was step 1 (Step 1).

the next is
4:22pm
18265 :
Log backed up: Database: Staging, creation date(time): 2007/01/30(09:35:34), first LSN: 24624:14008:1, last LSN: 24624:14021:1, number of dump devices: 1, device information: (FILE=1, TYPE=DISK: {'f:\program files\microsoft sql server\MSSQL\BACKUP\Staging\Staging_tlog_200703091622.TRN'}).

last is 4:21pm
18264 :
Database backed up: Database: Staging, creation date(time): 2007/01/30(09:35:34), pages dumped: 93982, first LSN: 24624:14008:2, last LSN: 24624:14018:1, number of dump devices: 1, device information: (FILE=1, TYPE=DISK: {'f:\program files\microsoft sql server\MSSQL\BACKUP\Staging\Staging_db_200703091618.BAK'}).

So for some very strange reason its running a full backup then a Transactional, for this reason i would say its failing but why is it even doing this backup? the job is only for TRN?

A manual TRN backup works like a treat

Thanks

BRAD

CHECK what is the recovery model of your database... make sure it is not Simple... If it is simple it is normal to have this behaviour

Madhu

|||

ran sp_helpdb all of my databases are at full recovery apart from the tmpdb and another system DB but these are not in the backup plan only user databases are.

any other ideas?

|||

never mind you were right there was the northwind database still active (by default set to simple) this is classed as a user DB.

Thanks

Brad

Scheduled transaction log backup never finish

Cancel the job using the Process Info under Current
Activity.
Have a look and see if there are any error messages being
generated in the SQL Server Logs, then try again.
Peter
"Never ascribe to malice, that which can be explained by
incompetence."
Napoleon

>--Original Message--
>Hi,
>I run a scheduled transaction log job back up serval
database's log
>everyday, it was fine before, however, today, one of jobs
seems can not stop
>running. Checked no deadlock process, checked log file in
disk, only two
>database can not finish. using dbcc opentran, no active
tran. change those
>two database to another job, same thing happening, What
could I do?
>Any help would be appreciated.
>Cheers
>Yifei
>
>.
>
Hi Peter,
Thank you for reply, I do cancel the job and restart it again, the problem
still exist.
Actually I restart sql server, it's been fixed.
But, it looks strange.
Yifei
"Peter The Spate" <anonymous@.discussions.microsoft.com> wrote in message
news:18a901c51b1f$feb702f0$a601280a@.phx.gbl...[vbcol=seagreen]
> Cancel the job using the Process Info under Current
> Activity.
> Have a look and see if there are any error messages being
> generated in the SQL Server Logs, then try again.
> Peter
> "Never ascribe to malice, that which can be explained by
> incompetence."
> Napoleon
>
> database's log
> seems can not stop
> disk, only two
> tran. change those
> could I do?

Scheduled transaction log backup never finish

Cancel the job using the Process Info under Current
Activity.
Have a look and see if there are any error messages being
generated in the SQL Server Logs, then try again.
Peter
"Never ascribe to malice, that which can be explained by
incompetence."
Napoleon

>--Original Message--
>Hi,
>I run a scheduled transaction log job back up serval
database's log
>everyday, it was fine before, however, today, one of jobs
seems can not stop
>running. Checked no deadlock process, checked log file in
disk, only two
>database can not finish. using dbcc opentran, no active
tran. change those
>two database to another job, same thing happening, What
could I do?
>Any help would be appreciated.
>Cheers
>Yifei
>
>.
>Hi Peter,
Thank you for reply, I do cancel the job and restart it again, the problem
still exist.
Actually I restart sql server, it's been fixed.
But, it looks strange.
Yifei
"Peter The Spate" <anonymous@.discussions.microsoft.com> wrote in message
news:18a901c51b1f$feb702f0$a601280a@.phx.gbl...[vbcol=seagreen]
> Cancel the job using the Process Info under Current
> Activity.
> Have a look and see if there are any error messages being
> generated in the SQL Server Logs, then try again.
> Peter
> "Never ascribe to malice, that which can be explained by
> incompetence."
> Napoleon
>
>
> database's log
> seems can not stop
> disk, only two
> tran. change those
> could I do?

Scheduled transaction log backup never finish

Hi,
I run a scheduled transaction log job back up serval database's log
everyday, it was fine before, however, today, one of jobs seems can not stop
running. Checked no deadlock process, checked log file in disk, only two
database can not finish. using dbcc opentran, no active tran. change those
two database to another job, same thing happening, What could I do?
Any help would be appreciated.
Cheers
YifeiCancel the job using the Process Info under Current
Activity.
Have a look and see if there are any error messages being
generated in the SQL Server Logs, then try again.
Peter
"Never ascribe to malice, that which can be explained by
incompetence."
Napoleon
>--Original Message--
>Hi,
>I run a scheduled transaction log job back up serval
database's log
>everyday, it was fine before, however, today, one of jobs
seems can not stop
>running. Checked no deadlock process, checked log file in
disk, only two
>database can not finish. using dbcc opentran, no active
tran. change those
>two database to another job, same thing happening, What
could I do?
>Any help would be appreciated.
>Cheers
>Yifei
>
>.
>|||Hi Peter,
Thank you for reply, I do cancel the job and restart it again, the problem
still exist.
Actually I restart sql server, it's been fixed.
But, it looks strange.
Yifei
"Peter The Spate" <anonymous@.discussions.microsoft.com> wrote in message
news:18a901c51b1f$feb702f0$a601280a@.phx.gbl...
> Cancel the job using the Process Info under Current
> Activity.
> Have a look and see if there are any error messages being
> generated in the SQL Server Logs, then try again.
> Peter
> "Never ascribe to malice, that which can be explained by
> incompetence."
> Napoleon
>
> >--Original Message--
> >Hi,
> >
> >I run a scheduled transaction log job back up serval
> database's log
> >everyday, it was fine before, however, today, one of jobs
> seems can not stop
> >running. Checked no deadlock process, checked log file in
> disk, only two
> >database can not finish. using dbcc opentran, no active
> tran. change those
> >two database to another job, same thing happening, What
> could I do?
> >
> >Any help would be appreciated.
> >
> >Cheers
> >
> >Yifei
> >
> >
> >
> >.
> >

Scheduled transaction log backup Failed

Hi Greeting,

Sql sever7
OS winNT

We have scheduled transaction log backup for user database to run every one hour. Now the transaction has failed. it gives out put

[12] Database oas: Delete Old Backup Files...
Unable to delete file E:\mssql7\tlogs\oas\oas_tlog_200608111300.TRN. 0 file(s) deleted.

When we try to delete the file manully, we get alert message "can not delelte the file as it is in use."

Please suggest how to solve this.

Awating for reply

Thanks in Advance
AdilSome other process is holding on to the file and won't let go. NetBackup is notorious for that sort of thing, as are other applications. You can:

1. Reboot the server
2. Kill the process holding on to the file.

There is a nice little windows utility called ProcessExplorer (http://www.sysinternals.com/Utilities/ProcessExplorer.html)
that will let you find the process holding the handle (file) and then kill the process.sql

Scheduled Tasks for SQL 7.0

Is there a way to schedule a task to shutdown SQL server, run a backup and
restart the service after the backup is finished?
can use the AT scheduler for this but why not backup the database and then
schedule the backup software using sqlserveragent to backup the backup file
as a subsequent step to the database backup?
"Margo" <margo@.discussions.microsoft.com> wrote in message
news:1D7E947F-0F07-4DAC-84E9-C94829930DCD@.microsoft.com...
> Is there a way to schedule a task to shutdown SQL server, run a backup and
> restart the service after the backup is finished?
|||Is there any documentation on this procedure that I could follow?
"Olu Adedeji" wrote:

> can use the AT scheduler for this but why not backup the database and then
> schedule the backup software using sqlserveragent to backup the backup file
> as a subsequent step to the database backup?
> "Margo" <margo@.discussions.microsoft.com> wrote in message
> news:1D7E947F-0F07-4DAC-84E9-C94829930DCD@.microsoft.com...
>
>

Scheduled Tasks for SQL 7.0

Is there a way to schedule a task to shutdown SQL server, run a backup and
restart the service after the backup is finished?can use the AT scheduler for this but why not backup the database and then
schedule the backup software using sqlserveragent to backup the backup file
as a subsequent step to the database backup?
"Margo" <margo@.discussions.microsoft.com> wrote in message
news:1D7E947F-0F07-4DAC-84E9-C94829930DCD@.microsoft.com...
> Is there a way to schedule a task to shutdown SQL server, run a backup and
> restart the service after the backup is finished?|||Is there any documentation on this procedure that I could follow?
"Olu Adedeji" wrote:

> can use the AT scheduler for this but why not backup the database and then
> schedule the backup software using sqlserveragent to backup the backup fil
e
> as a subsequent step to the database backup?
> "Margo" <margo@.discussions.microsoft.com> wrote in message
> news:1D7E947F-0F07-4DAC-84E9-C94829930DCD@.microsoft.com...
>
>

Scheduled Tasks for SQL 7.0

Is there a way to schedule a task to shutdown SQL server, run a backup and
restart the service after the backup is finished?can use the AT scheduler for this but why not backup the database and then
schedule the backup software using sqlserveragent to backup the backup file
as a subsequent step to the database backup?
"Margo" <margo@.discussions.microsoft.com> wrote in message
news:1D7E947F-0F07-4DAC-84E9-C94829930DCD@.microsoft.com...
> Is there a way to schedule a task to shutdown SQL server, run a backup and
> restart the service after the backup is finished?|||Is there any documentation on this procedure that I could follow?
"Olu Adedeji" wrote:
> can use the AT scheduler for this but why not backup the database and then
> schedule the backup software using sqlserveragent to backup the backup file
> as a subsequent step to the database backup?
> "Margo" <margo@.discussions.microsoft.com> wrote in message
> news:1D7E947F-0F07-4DAC-84E9-C94829930DCD@.microsoft.com...
> > Is there a way to schedule a task to shutdown SQL server, run a backup and
> > restart the service after the backup is finished?
>
>

Scheduled tasks

Is it possible to schedule tasks in SQL Express, for example a database backup, or to periodically execute a stored procedure?

hi Allan,

yes, it is possible, but not using the SQL Server Agent as SQLExpress does not provide the relative bits.. you have so to rely on the native OS scheduler, third party (or self written alternative) scheduler, or rely on the Service Broker features..

personally I usually go for the native OS scheduler, where you can define a list of xx.sql scripts to be executed by a xx.cmd file.. then the xx.cmd file, connecting to SqlCMD.exe and executing each defined xx.sql script, has to be scheduled... quiete simple and not expensive... results are output to a text file similar to:

[cmdfile.cmd]

ECHO. >>Backing up databases

SqlCmd -E -S(Local)\InstanceName -i"c:\somefolder\ScheduledBackup.sql" >c:\SomeFolder\ScheduledBackupLog.txt

ECHO. >>Sending results via mail to aministrators

SqlCmd-E -S(Local) -Q"SET NOCOUNT ON; SELECT 'Mailing log of - ' + CONVERT(varchar, GETDATE());" >E:\e-VbHot\Files\Log\MailingLogBCKschedulato.txt
SqlCmd -E -S(Local)\InstanceName -Q"SET NOCOUNT ON; DECLARE @.ret int;EXEC @.ret = [applicationDB].[dbo].[amSMTPmail] @.Server = N'smtp server name', @.Sender = N'scheduledbackup@.my_company.com', @.AddressesTO = N'admin_name@.my_company.com', @.AddressesCC = N'me@.me.com', @.AddressesCCN = NULL, @.AttachFiles = N'c:\SomeFolder\ScheduledBackupLog.txt', @.Subject = N'Backup performed', @.MessageBody = N'Backup performed', @.UserName = NULL, @.UserPassword = NULL; SELECT @.ret AS [Execution result];" >>c:\SomeFolder\MailingLog.txt

[/cmdfile.cmd]

as you can see, I do personally even send the c:\SomeFolder\ScheduledBackupLog.txt resulting file via e-mail to a "list" of addresses.. this is performed via a (free) CLR stored procedure of mine, amDBObj, where the .Net code implements a poor's man SMTP mail feature to "replace" (ok... it is not comparable with) Database Mail missing feature of SQLExpress..

regards

|||

Thanks for the info Andrea. I will look into it.

Thanks, too, for the offer of the CLR email proc - but I already did one myself :)

sql

Wednesday, March 21, 2012

Scheduled Restore DB in EM?

Dear All,
We all know that we can schedule backup DB & Log in EM using Database Maintenance Plan.
Is there a way we can schedule Restore DB using EM?
Anyone?
Thanks.Yup ... write the sql code to do so and schedule as a job.|||Thanks Enigma... seems like that's the only option.

rgds|||I presume you will know better if you read thru BOL as a first hand help.|||Thanks Satya... your prevision is true.

I managed to get the job done... writing the script and scheduled as job.

Scheduled jobs overlapping

Greetings,
I have Full database backup job scheduled at 02:00 every day,
Differential backup every 2 hours from 00:00:00 to 23:59:59 and Log
backup every 15 min from 00:00:00 to 23:59:59. Is there a way to control
order of execution, for example: Full backup starts before Differential
backup and Differential backup starts before transaction log backup.
Does Schedule_id plays any role in processing order? Any advise
appreciated.

Aleksandar Andjelkovic

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!<Aleksandar Andjelkovic> wrote in message
news:40b6fc5a$0$208$75868355@.news.frii.net...
> Greetings,
> I have Full database backup job scheduled at 02:00 every day,
> Differential backup every 2 hours from 00:00:00 to 23:59:59 and Log
> backup every 15 min from 00:00:00 to 23:59:59. Is there a way to control
> order of execution, for example: Full backup starts before Differential
> backup and Differential backup starts before transaction log backup.
> Does Schedule_id plays any role in processing order? Any advise
> appreciated.
>
> Aleksandar Andjelkovic
> *** Sent via Developersdex http://www.developersdex.com ***
> Don't just participate in USENET...get rewarded for it!

You could look at having multiple steps in the same job, or using
sp_help_job to check the status of other jobs before continuing, but the
easiest solution might be to use multiple schedules for each job:

Job1: Full - 02h00
Job2: Differential (Schedule 1) - 00h00
Job2: Differential (Schedule 2) - 04h00 to 23h59, every two hours
Job3: Log (Schedule 1) - 00h15 to 23h59, every hour
Job3: Log (Schedule 2) - 00h30 to 23h59, every hour
Job3: Log (Schedule 3) - 00h45 to 23h59, every hour
Job3: Log (Schedule 4) - 01h00 to 23h59, every 2 hours

You don't need a differential backup at 02h00 because you have the full one
at that time anyway. The multiple log schedules will overlap to backup at
15, 30 and 45 minutes past the hour every hour, and backup on each hour
alternates between differential and log - there's probably no point in
doing both at the same time.

Personally, this seems rather complicated to me, and I would only use
differential once or at most twice a day, with a full backup daily or
weekly, but I don't know your environment or requirements, so the schedule
you've described may well be the best one for you.

Simon

Tuesday, March 20, 2012

Scheduled jobs and Current Activity in SQL Server 7.0

I had scheduled data transfer and backup jobs that could not complete
executing as there was not enough disk space. On stopping the jobs the
process associated with it did not clear out from the Current Activity
Process Info window. I tried stopping and starting the SQL Agent and also
killing the processes but the processed associated with those jobs still show
up in the Current Activity - Process Info window of Enterprise Manager.
I have created disk space on the drives that were running out of space.
What should I do to kill those processes.
KT
Two thoughts here:
First did you refresh your current activity view? Second is there some
process are there any blocking processes. Sometimes a process might be
running that is blocking the processes you are trying to kill. In this case
those killed processes will not die, until the process that is causing the
block is no longer blocking.
----
-
Need SQL Server Examples check out my website
http://www.geocities.com/sqlserverexamples
"KT" <KT@.discussions.microsoft.com> wrote in message
news:4EDD5693-2DAC-4CC9-B9E6-DE745EF630BF@.microsoft.com...
> I had scheduled data transfer and backup jobs that could not complete
> executing as there was not enough disk space. On stopping the jobs the
> process associated with it did not clear out from the Current Activity
> Process Info window. I tried stopping and starting the SQL Agent and also
> killing the processes but the processed associated with those jobs still
show
> up in the Current Activity - Process Info window of Enterprise Manager.
> I have created disk space on the drives that were running out of space.
> What should I do to kill those processes.
> --
> KT

Scheduled job for backup

My scheduled job didnt run. there's no error message that appear on my my
sql server even when i set up the job, that' why i concluded that i did it
correctly. What could be the problem?
Thanks a lot!Verify that Agent service is running.
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://sqlblog.com/blogs/tibor_karaszi
"newbie" <newbie@.discussions.microsoft.com> wrote in message
news:FEC20577-CA41-44A0-AF41-366835F62A54@.microsoft.com...
> My scheduled job didnt run. there's no error message that appear on my my
> sql server even when i set up the job, that' why i concluded that i did it
> correctly. What could be the problem?
> Thanks a lot!