Showing posts with label job. Show all posts
Showing posts with label job. Show all posts

Thursday, March 22, 2012

Can I delete BAK and TRN files?

I have an implementation of SQL Server 2000 with a job to
backup a customer database. The backup works file, but
none of the old backup and transaction files are removed
after each backup, so it is consuming a lot of disk
space. I have BAK and TRN files dating back 3 months.
Before I deleted any of the old files, I wanted to make
sure I am okay to do so. Does anyone know of a problem
with manually most of these files, leaving only the most
recent week or two of backups?
Thanks,
Jason... and if the backups are created by a SQL Server maintenance plan, you can
modify it to have the files older than a specified period removed. It's on
the Complete Backup and Transaction Log Backup tabs respectively, Remove
files older than item.
"Linchi Shea" <linchi_shea@.NOSPAMml.com> wrote in message
news:0b4a01c3d932$260faea0$a001280a@.phx.gbl...
> As far as whether deleting the old backup files will do
> any damage to the backup setup (e.g. your maintanance
> plans) is concerned, there is no problem. But you do need
> to make sure that if you ever need them, you can get them
> back (e.g. from your tape backup facility).
> Linchi
> >--Original Message--
> >I have an implementation of SQL Server 2000 with a job to
> >backup a customer database. The backup works file, but
> >none of the old backup and transaction files are removed
> >after each backup, so it is consuming a lot of disk
> >space. I have BAK and TRN files dating back 3 months.
> >Before I deleted any of the old files, I wanted to make
> >sure I am okay to do so. Does anyone know of a problem
> >with manually most of these files, leaving only the most
> >recent week or two of backups?
> >
> >Thanks,
> >
> >Jason
> >.
> >sql

Can I delete BAK and TRN files?

I have an implementation of SQL Server 2000 with a job to
backup a customer database. The backup works file, but
none of the old backup and transaction files are removed
after each backup, so it is consuming a lot of disk
space. I have BAK and TRN files dating back 3 months.
Before I deleted any of the old files, I wanted to make
sure I am okay to do so. Does anyone know of a problem
with manually most of these files, leaving only the most
recent week or two of backups?
Thanks,
JasonAs far as whether deleting the old backup files will do
any damage to the backup setup (e.g. your maintanance
plans) is concerned, there is no problem. But you do need
to make sure that if you ever need them, you can get them
back (e.g. from your tape backup facility).
Linchi
quote:

>--Original Message--
>I have an implementation of SQL Server 2000 with a job to
>backup a customer database. The backup works file, but
>none of the old backup and transaction files are removed
>after each backup, so it is consuming a lot of disk
>space. I have BAK and TRN files dating back 3 months.
>Before I deleted any of the old files, I wanted to make
>sure I am okay to do so. Does anyone know of a problem
>with manually most of these files, leaving only the most
>recent week or two of backups?
>Thanks,
>Jason
>.
>
|||... and if the backups are created by a SQL Server maintenance plan, you ca
n
modify it to have the files older than a specified period removed. It's on
the Complete Backup and Transaction Log Backup tabs respectively, Remove
files older than item.
"Linchi Shea" <linchi_shea@.NOSPAMml.com> wrote in message
news:0b4a01c3d932$260faea0$a001280a@.phx.gbl...[QUOTE]
> As far as whether deleting the old backup files will do
> any damage to the backup setup (e.g. your maintanance
> plans) is concerned, there is no problem. But you do need
> to make sure that if you ever need them, you can get them
> back (e.g. from your tape backup facility).
> Linchi
>

Can I Created a BPA 'Job'

Can I created a job that I can send to my Service Delivery group to run on the Production servers? I'm a developer and don't WANT access to PROD, but I want BPA run against PROD. I'd like to have them install BPA and them send them a 'package' to run. Is
this available with BPA?
Thanks,
Maybe not exactly what you want, but there's a way you can get close.
Install BPA, which creates the repository. In it, create a best practice
group that scans things the way you want. You should register the servers
from production, or register them as (local).
Have your production team install BPA (they will have to create a repository
but it can be discarded) and then ask them to run bpa (likely the command
line version bpacmd.exe) pointing at your repository database. If they do
that, they'll have to execute the best practice group that you created.
- Christian
"B.W." <bw.lightsey@.tetrapak.com> wrote in message
news:611E0DF9-C69E-4EF6-AA6B-0E390C3430A8@.microsoft.com...
> Can I created a job that I can send to my Service Delivery group to run on
the Production servers? I'm a developer and don't WANT access to PROD, but I
want BPA run against PROD. I'd like to have them install BPA and them send
them a 'package' to run. Is this available with BPA?
> Thanks,
>
sql

can I create a job to call a stored procedure?

Hello,

Can I create a job to call a stored procedure everyday? If yes, how to do it?

Thanks

I use sql server 2005.

Thanks

|||

Yes, refer to Books Online, Topic: SQL Agent, Jobs

Unless you are using SQL Express. With SQL Express, SQL Agent is not included. You can accomplish the same functionality using the Windows Scheduler service, SQLCmd.exe and a stored procedure.

|||

from sql agen job, I can't find stored procedure calling item from the drop down list. It only has maintanence plan etc.

Thanks

|||If you will explore Books Online, Topic: Jobs, Creating, you will find excellent walk-thoughs and examples.|||You have
1) create new job,
2) add a step to created job
3) Add name for this step, such as "Step1"
4) Choose type: Transact-SQL script
5) Choose actual database from list
6) Add command:

Code Snippet

EXEC sp_yourstored_proc_name

7) Go to schedules tab and set correct schedule plan|||

Easiest way to at least for me is to use isql wrapped in a bat file.

Open notepad or your favorite text editor.

Type the following, replacing where required.

@.echo off
isql -S SERVER_NAME_OR_IP -d DATABASE_NAME -Q "EXEC STORED_PROC_NAME" -U YOUR_USERNAME -P YOUR_PASSWORD -s , -o "OUTPUT_FILE"

Save the file with .bat as the extension.

Navigate to Start, All Programs, Control Panel, Scheduled Tasks, Add Scheduled Task.

Select next from the introduction screen.

Select browse from the next screen and find the .bat file created earlier.

Give the job a name and select interval from the next screen.

Enter the username and password to run as (helpful if using integrated security).

Select finish.

You can test your job by navigating to the scheduled jobs folder, right click on the job, select run

You can obtain the command arguments for isql using "isql /?" (w/o the quotes) at the command prompt.

Simple bat example (will execute sp_monitor and log the results to c:\sqlout.csv)

@.echo off

isql -S 192.168.1.250 -d master -Q "EXEC sp_monitor" -U test -P test -s , -o "c:\sqlout.csv"

Wednesday, March 7, 2012

Can BCP Handle Leap Day: 2/29/08 ?

I have a production job that is killing BCP... If I change the dates to
2/28/08, the file processes just fine. Here is the error message ... is
this a known issue? Is there a fix for this?
#@. Row 11366, Column 2: Invalid date format @.#
1/21/08 2/29/08 1 0073210002300 0 3.68 12
#@. Row 24909, Column 2: Invalid date format @.#
1/21/08 2/29/08 4 0073210002300 0 3.68 12
#@. Row 38452, Column 2: Invalid date format @.#
1/21/08 2/29/08 7 0073210002300 0 3.68 12
#@. Row 51995, Column 2: Invalid date format @.#
1/21/08 2/29/08 14 0073210002300 0 3.68 12
#@. Row 65538, Column 2: Invalid date format @.#
Thanks!
Greg,
I am sure that bcp is simply using the SQL Server engine, so I would expect
it to 'know'. When I tested the following file all rows worked.
2/29/08
2/28/08
2/29/2008
2/28/2008
If the date was invalid, you would get the message that you show. I get the
errorw when I include a row with:
2/30/2008
So, one possibility is that your format file (or the format of your file) is
the problem. Are you using a format file or are you depending on tabs and
column order? (The latter is fine when it works, of course, but sometimes
you need a format file to control things more. See:
http://support.microsoft.com/kb/67409 and look "format files" in the SQL
Server Book Online for some examples.)
RLF
"greg may" <gregory_may [at] yahoo [dot] com> wrote in message
news:%233wz4JyvHHA.736@.TK2MSFTNGP06.phx.gbl...
>I have a production job that is killing BCP... If I change the dates to
>2/28/08, the file processes just fine. Here is the error message ... is
>this a known issue? Is there a fix for this?
> #@. Row 11366, Column 2: Invalid date format @.#
> 1/21/08 2/29/08 1 0073210002300 0 3.68 12
> #@. Row 24909, Column 2: Invalid date format @.#
> 1/21/08 2/29/08 4 0073210002300 0 3.68 12
> #@. Row 38452, Column 2: Invalid date format @.#
> 1/21/08 2/29/08 7 0073210002300 0 3.68 12
> #@. Row 51995, Column 2: Invalid date format @.#
> 1/21/08 2/29/08 14 0073210002300 0 3.68 12
> #@. Row 65538, Column 2: Invalid date format @.#
>
>
> Thanks!
>
|||Thanks Russell for your feedback. I will have to set up some more tests to
track this down further.
We are not using a format file in this case. Its using an implicid
conversion as the table structure and the field lay outs are an exact match
(Using Pipe delimiters) ... this may be part of what is causing the issue?
In this case, the destination table is using a SmallDateTime.
I will see if I can reproduce the problem with only the above conditions.
g.
"Russell Fields" <russellfields@.nomail.com> wrote in message
news:uUKHnIzvHHA.4244@.TK2MSFTNGP04.phx.gbl...
> Greg,
> I am sure that bcp is simply using the SQL Server engine, so I would
> expect it to 'know'. When I tested the following file all rows worked.
> 2/29/08
> 2/28/08
> 2/29/2008
> 2/28/2008
> If the date was invalid, you would get the message that you show. I get
> the errorw when I include a row with:
> 2/30/2008
> So, one possibility is that your format file (or the format of your file)
> is the problem. Are you using a format file or are you depending on tabs
> and column order? (The latter is fine when it works, of course, but
> sometimes you need a format file to control things more. See:
> http://support.microsoft.com/kb/67409 and look "format files" in the SQL
> Server Book Online for some examples.)
> RLF
> "greg may" <gregory_may [at] yahoo [dot] com> wrote in message
> news:%233wz4JyvHHA.736@.TK2MSFTNGP06.phx.gbl...
>

Can backup to disk, but not to tape - Access Denied

I have been trying to use the Maintenance Wizard to setup a backup job to
tape however I continually get an Access Denied message for the failure.
Even when I try to insert a previously successful tape and try to see what
is on it I still get the Access denied message (Bad Password). I am able to
backup to a folder without any problem.
Both SQL server and Agent start with a Domain Admin account and I have
created these jobs while logging in with the accounts. I have even created
the databases with this account as well. No problem accessing the data,
just backing up to tape.
Windows 2003 Server SP1
SQL 2000 SP3
All latest Windows UpdatesJordan wrote:
> I have been trying to use the Maintenance Wizard to setup a backup job to
> tape however I continually get an Access Denied message for the failure.
> Even when I try to insert a previously successful tape and try to see what
> is on it I still get the Access denied message (Bad Password). I am able to
> backup to a folder without any problem.
> Both SQL server and Agent start with a Domain Admin account and I have
> created these jobs while logging in with the accounts. I have even created
> the databases with this account as well. No problem accessing the data,
> just backing up to tape.
> Windows 2003 Server SP1
> SQL 2000 SP3
> All latest Windows Updates
>
>
For what it's worth, most folks don't write SQL backups directly to
tape. Write your SQL backups to disk, and then let your tape backup
software backup those backup files to tape.
Tracy McKibben
MCDBA
http://www.realsqlguy.com|||I found that even though the services are run as MYDOMAIN\Administrator the
backup task kept getting set to run as Administrator@.mydomain.com. When I
manually changed the job to MYDOMAIN\Administrator it started to work.
"Tracy McKibben" <tracy@.realsqlguy.com> wrote in message
news:4526493E.6080206@.realsqlguy.com...
> Jordan wrote:
>> I have been trying to use the Maintenance Wizard to setup a backup job to
>> tape however I continually get an Access Denied message for the failure.
>> Even when I try to insert a previously successful tape and try to see
>> what is on it I still get the Access denied message (Bad Password). I am
>> able to backup to a folder without any problem.
>> Both SQL server and Agent start with a Domain Admin account and I have
>> created these jobs while logging in with the accounts. I have even
>> created the databases with this account as well. No problem accessing
>> the data, just backing up to tape.
>> Windows 2003 Server SP1
>> SQL 2000 SP3
>> All latest Windows Updates
>>
>>
> For what it's worth, most folks don't write SQL backups directly to tape.
> Write your SQL backups to disk, and then let your tape backup software
> backup those backup files to tape.
>
> --
> Tracy McKibben
> MCDBA
> http://www.realsqlguy.com

Can backup to disk, but not to tape - Access Denied

I have been trying to use the Maintenance Wizard to setup a backup job to
tape however I continually get an Access Denied message for the failure.
Even when I try to insert a previously successful tape and try to see what
is on it I still get the Access denied message (Bad Password). I am able to
backup to a folder without any problem.
Both SQL server and Agent start with a Domain Admin account and I have
created these jobs while logging in with the accounts. I have even created
the databases with this account as well. No problem accessing the data,
just backing up to tape.
Windows 2003 Server SP1
SQL 2000 SP3
All latest Windows Updates
Jordan wrote:
> I have been trying to use the Maintenance Wizard to setup a backup job to
> tape however I continually get an Access Denied message for the failure.
> Even when I try to insert a previously successful tape and try to see what
> is on it I still get the Access denied message (Bad Password). I am able to
> backup to a folder without any problem.
> Both SQL server and Agent start with a Domain Admin account and I have
> created these jobs while logging in with the accounts. I have even created
> the databases with this account as well. No problem accessing the data,
> just backing up to tape.
> Windows 2003 Server SP1
> SQL 2000 SP3
> All latest Windows Updates
>
>
For what it's worth, most folks don't write SQL backups directly to
tape. Write your SQL backups to disk, and then let your tape backup
software backup those backup files to tape.
Tracy McKibben
MCDBA
http://www.realsqlguy.com
|||I found that even though the services are run as MYDOMAIN\Administrator the
backup task kept getting set to run as Administrator@.mydomain.com. When I
manually changed the job to MYDOMAIN\Administrator it started to work.
"Tracy McKibben" <tracy@.realsqlguy.com> wrote in message
news:4526493E.6080206@.realsqlguy.com...
> Jordan wrote:
> For what it's worth, most folks don't write SQL backups directly to tape.
> Write your SQL backups to disk, and then let your tape backup software
> backup those backup files to tape.
>
> --
> Tracy McKibben
> MCDBA
> http://www.realsqlguy.com

Can backup to disk, but not to tape - Access Denied

I have been trying to use the Maintenance Wizard to setup a backup job to
tape however I continually get an Access Denied message for the failure.
Even when I try to insert a previously successful tape and try to see what
is on it I still get the Access denied message (Bad Password). I am able to
backup to a folder without any problem.
Both SQL server and Agent start with a Domain Admin account and I have
created these jobs while logging in with the accounts. I have even created
the databases with this account as well. No problem accessing the data,
just backing up to tape.
Windows 2003 Server SP1
SQL 2000 SP3
All latest Windows UpdatesJordan wrote:
> I have been trying to use the Maintenance Wizard to setup a backup job to
> tape however I continually get an Access Denied message for the failure.
> Even when I try to insert a previously successful tape and try to see what
> is on it I still get the Access denied message (Bad Password). I am able
to
> backup to a folder without any problem.
> Both SQL server and Agent start with a Domain Admin account and I have
> created these jobs while logging in with the accounts. I have even create
d
> the databases with this account as well. No problem accessing the data,
> just backing up to tape.
> Windows 2003 Server SP1
> SQL 2000 SP3
> All latest Windows Updates
>
>
For what it's worth, most folks don't write SQL backups directly to
tape. Write your SQL backups to disk, and then let your tape backup
software backup those backup files to tape.
Tracy McKibben
MCDBA
http://www.realsqlguy.com|||I found that even though the services are run as MYDOMAIN\Administrator the
backup task kept getting set to run as Administrator@.mydomain.com. When I
manually changed the job to MYDOMAIN\Administrator it started to work.
"Tracy McKibben" <tracy@.realsqlguy.com> wrote in message
news:4526493E.6080206@.realsqlguy.com...
> Jordan wrote:
> For what it's worth, most folks don't write SQL backups directly to tape.
> Write your SQL backups to disk, and then let your tape backup software
> backup those backup files to tape.
>
> --
> Tracy McKibben
> MCDBA
> http://www.realsqlguy.com

Thursday, February 16, 2012

Can a job trigger itself upon receipt of an email?

Hi all,
I have a SQL Server Job that I would like to run when I receive an email saying "Data is now ready to be imported to SQL Server" ?
Is there a way to accomplish this.
- Vivekgot a mapi compliant mail server laying around. you might be able to do this with sqlmail.

OR

i have never written too much VBA for outlook (mostly access and excel) but you maybe able to write a rule that drops this email in a certain folder. Then, and I am not sure if there is an event for new mail but there probably is, you can probably make a db call in that event. you would have to leave your mail client open and your computer on.|||Check out xp_readmail in SQL BOL. Basically, you would need to put this inside a SQL Job that executes periodically and then use xp_readmail to "answer" the inbox and trigger your job.

Having said all that, I will say that SQL mail only ever caused me grief and heartache. Go Database Mail (SQL 2004)!

Regards,

hmscott

Can a job initiate another job?

How do you initiate another job from a job. Also if you can do this, if you
run two jobs from the original job can you be assured that the first job is
finished before the second is executed, the steps look like they handle this
but want to be sure.
sp_start_job can help you to start one job from another. This just starts
the job. However, it does not wait for completion of the job. You might
want to add WAITFOR and the duration to wait before the second job is
started.
-BD
"sd" <susan.dunn@.ncsl.org> wrote in message
news:OpZ68e5tEHA.1400@.TK2MSFTNGP11.phx.gbl...
> How do you initiate another job from a job. Also if you can do this, if
you
> run two jobs from the original job can you be assured that the first job
is
> finished before the second is executed, the steps look like they handle
this
> but want to be sure.
>

Can a job initiate another job?

How do you initiate another job from a job. Also if you can do this, if you
run two jobs from the original job can you be assured that the first job is
finished before the second is executed, the steps look like they handle this
but want to be sure.sp_start_job can help you to start one job from another. This just starts
the job. However, it does not wait for completion of the job. You might
want to add WAITFOR and the duration to wait before the second job is
started.
-BD
"sd" <susan.dunn@.ncsl.org> wrote in message
news:OpZ68e5tEHA.1400@.TK2MSFTNGP11.phx.gbl...
> How do you initiate another job from a job. Also if you can do this, if
you
> run two jobs from the original job can you be assured that the first job
is
> finished before the second is executed, the steps look like they handle
this
> but want to be sure.
>

Can a job initiate another job?

How do you initiate another job from a job. Also if you can do this, if you
run two jobs from the original job can you be assured that the first job is
finished before the second is executed, the steps look like they handle this
but want to be sure.sp_start_job can help you to start one job from another. This just starts
the job. However, it does not wait for completion of the job. You might
want to add WAITFOR and the duration to wait before the second job is
started.
-BD
"sd" <susan.dunn@.ncsl.org> wrote in message
news:OpZ68e5tEHA.1400@.TK2MSFTNGP11.phx.gbl...
> How do you initiate another job from a job. Also if you can do this, if
you
> run two jobs from the original job can you be assured that the first job
is
> finished before the second is executed, the steps look like they handle
this
> but want to be sure.
>

Friday, February 10, 2012

Calling vb script from SQL job

I am trying to execute a visual basic script using a SQL job. I can schedul
e
this as a scheduled task and then use a separate SQL job to compelte the
formatting tasks, but prefer to keep all steps consolidated so it is easier
to trouble shoot.
I tried using xp_cmdshell 'job.vbs', no_output
but it gives the error that this is not a recognized internal command.
Any help would be greatly appreciated.>I am trying to execute a visual basic script using a SQL job. I can
>schedule
> this as a scheduled task and then use a separate SQL job to compelte the
> formatting tasks,
Why don't you have the VBScript task call a stored procedure?
A|||Hello Derekman:
You wrote on Mon, 26 Jun 2006 12:12:03 -0700:
D> I am trying to execute a visual basic script using a SQL job. I can
D> schedule this as a scheduled task and then use a separate SQL job to
D> compelte the formatting tasks, but prefer to keep all steps consolidated
D> so it is easier to trouble shoot.
D> I tried using xp_cmdshell 'job.vbs', no_output
D> but it gives the error that this is not a recognized internal command.
You can run only an executable; sql server won't look into the registry to
see what is the application handling file extension. In Explorer, this is
most likely specified as
WScript.exe "%1" %*
That's how it should be in sql job as well.
Vadim Rapp

Calling Stored procedures via the Job Agent - Please help!

Hi all,
My colleague and I are struggling with a rather annoying problem. The
situation is as follows:
We've two database servers (one primary and one backup) with
SQL-server 2000 installed. We've been trying to implement
"log-shipping" on this server using the example scripts from the SQL
server 2000 resource kit. What happens in these scripts is basically
the following.
Server A: starts the (local) stored procedure (sproc) sp_logship
Server A: sp_logship copies the transactionlog into a shared location,
so Server B is able to reach the transactionlog.
Server A: calls a sproc on Server B.
Server B: The sproc looks for a transactionlogfile in the shared
location and restores Server B's database using this logfile.
This mechanism works fine when we call "sp_logship" from the
Query-analyzer on Server A.
When we try to run start the "sp_logship" using the Job Agent (also on
Server A), we get the following error:
Msg 7410, sev 16: Remote access not allowed for Windows NT user
activated by SETUSER [SQLSTATE 42000]
We tried to solve this problem by creating several other users, even
ones who use SQL server Authentication. It was to no avail.
I hope someone can help me with this problem,
Thank you very much in advance,
Alke WiebengaIs the SQL Server Agent startup account a domain one with permission to
access the shared folder in both servers?
AMB
"A. Wiebenga" wrote:

> Hi all,
> My colleague and I are struggling with a rather annoying problem. The
> situation is as follows:
> We've two database servers (one primary and one backup) with
> SQL-server 2000 installed. We've been trying to implement
> "log-shipping" on this server using the example scripts from the SQL
> server 2000 resource kit. What happens in these scripts is basically
> the following.
> Server A: starts the (local) stored procedure (sproc) sp_logship
> Server A: sp_logship copies the transactionlog into a shared location,
> so Server B is able to reach the transactionlog.
> Server A: calls a sproc on Server B.
> Server B: The sproc looks for a transactionlogfile in the shared
> location and restores Server B's database using this logfile.
> This mechanism works fine when we call "sp_logship" from the
> Query-analyzer on Server A.
> When we try to run start the "sp_logship" using the Job Agent (also on
> Server A), we get the following error:
> Msg 7410, sev 16: Remote access not allowed for Windows NT user
> activated by SETUSER [SQLSTATE 42000]
> We tried to solve this problem by creating several other users, even
> ones who use SQL server Authentication. It was to no avail.
> I hope someone can help me with this problem,
> Thank you very much in advance,
> Alke Wiebenga
>