Re: Locate T-SQL Referenced by Job Step?

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



.... and as for being in the master database:

I tend to do backup and restore operations while being in the master database.

--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://sqlblog.com/blogs/tibor_karaszi


"Kevin3NF" <kevin@xxxxxxxxxxxxxxxxxxxxxxx> wrote in message news:eunyNvYzJHA.3404@xxxxxxxxxxxxxxxxxxxxxxx
Unless I'm missing something, 'backup log myDB to myDBBackup' is the actual code that is running. Its not a reference to a stored proc in master or elsewhere.

Its essentially telling the SQL Server to run a transaction log backup of myDB and send the results to the backup device named myDBBackup. Its a direct call, not a reference to another routine or SP

--

Kevin3NF
SQL Server dude

You want fries with that?
http://kevin3nf.blogspot.com/

I only check the newsgroups during work hours, M-F.
Hit my blog and the contact links if necessary...I may be available.

Twitter: Kevin3NF

"Gerry Hickman" <gerry666uk2@xxxxxxxxxxxxxxxx> wrote in message news:%23hoXJQYzJHA.1380@xxxxxxxxxxxxxxxxxxxxxxx
Hi,

In SQL Server 2005, each job conatains one or more job steps. There's a type of job step called TSQL that can run a T-SQL command. The job step uses parameters to reference the T-SQL command, e.g. the name of the database within which the command resides, and the command to be run. This information is stored in 'msdb'. Below is an extract from a job script that shows the job step.

/****** Object: Step [transaction backup] Script Date: 05/05/2009 13:09:07 ******/
EXEC @ReturnCode = msdb.dbo.sp_add_jobstep @job_id=@jobId, @step_name=N'transaction backup',
@step_id=1,
@cmdexec_success_code=0,
@on_success_action=1,
@on_success_step_id=0,
@on_fail_action=2,
@on_fail_step_id=0,
@retry_attempts=0,
@retry_interval=1,
@os_run_priority=0, @subsystem=N'TSQL',
@command=N'backup log myDB to myDBBackup',
@database_name=N'master',
@flags=0
IF (@@ERROR <> 0 OR @ReturnCode <> 0) GOTO QuitWithRollback

It's making reference to a "command" called 'backup log myDB to myDBBackup' in the 'master' database.

1. It seems very odd to me that a backup command would be burried in master?

2. I can NOT find any stored procedure in 'master' called 'backup log myDB to myDBBackup'

3. The job seems to run fine. Job history claims success and files are backed up.

I'm trying to locate the 'backup log myDB to myDBBackup' command so I can look at the raw T-SQL. I did try things like SELECT name from sys.objects where type='P'; but nothing matches.

Strangely, I am able to resolve other T-SQL commands that reside in other job steps on the same server, but in these cases they reside in user databases, not master...

--
Gerry Hickman
London (UK)



.



Relevant Pages

  • Re: Problem in eseutil /p command exchange 2000
    ... > I am facing problem in taking backup up pub1.edb file in one of my server. ... > so i gone for repairing database. ... I also tried the eseutil /p command by ... > integrity test and dont go for repair? ...
    (microsoft.public.exchange.admin)
  • RE: SQL Server failing to start (directly effecting sales!!!) Error: 823, Severity:
    ... You should consider calling Microsoft Technical Support as your master ... They will want your SQL Server Errorlogs ... that the machine with the database has hardware that is failing. ... Even if you are planning to reinstall you should make a backup copy ...
    (microsoft.public.sqlserver.msde)
  • Re: Timeout Expired during backup
    ... I have added the STAT option but... ... The backup is failing even to a new file so I don't think INIT will help. ... > INIT option in Backup database command. ...
    (microsoft.public.sqlserver.msde)
  • Re: Differential backup of "master" failing
    ... The reason is stated explicitly in the error message: you can only perform a full backup of the master database. ... Is there some reason I cannot do a differential backup of the master db even though it was an option in the wizard? ...
    (microsoft.public.windows.server.general)
  • Re: Locate T-SQL Referenced by Job Step?
    ... I was looking for something complicated when in reality the T-SQL is the literal text string in the @command parameter! ... They'd used lower case 'backup log', I didn't recognize it straight away as T-SQL. ... any database. ...
    (microsoft.public.sqlserver.server)