?
Solved

OSQL batch scripting

Posted on 2007-10-01
6
Medium Priority
?
752 Views
Last Modified: 2013-12-01
We have an issue on a Windows 2003 SP2 server with Symantec BackupExec 11d (with the latest hotfixes installed), with an Sony AIT4 StorStation Library where we get a cleaning tape error on a couple of the backup jobs - but the jobs themselves complete with no issue - except that the error "cleaning media was mounted" is logged - except these slots are not marked as cleaning slots - and the tapes are either brand new or a long erase has been run previously.

We have a single cleaning tape in slot 8 - and when the drive requests a cleaning request - it uses the tape because it is marked as a cleaning slot.

From the Veritas/Symantec knowledgebase - we know that this is a bug that will be fixed in the next major release - but for the time being know that these commands fix the issue.

osql -E -S sgs-sr-backup\bkupexec -d bedb
delete from jobhistorydetail where finalerrordescription like '%library%'
go

We are looking to script this to run automatically at regular intervals - but the first command has to be run - then the lines after piped into the osql prompt.

Does anyone have an idea how to do this? All suggestions gratefully received.

How
0
Comment
Question by:and235100
  • 4
  • 2
6 Comments
 
LVL 30

Accepted Solution

by:
SteveGTR earned 2000 total points
ID: 19993109
You could do this:

@echo off

(echo delete from jobhistorydetail where finalerrordescription like '^%library^%')>_temp.txt
(echo go)>>_temp.txt
(echo exit)>>_temp.txt

osql -E -S sgs-sr-backup\bkupexec -d bedb - i _temp.txt

del _temp.txt

0
 
LVL 32

Author Comment

by:and235100
ID: 19993198
Yes, possibly - I can see what that is attempting to do - but will it work? As far as I know - the "osql> " prompt will not take a text file...

I will try this now - and get back to you...
0
 
LVL 30

Assisted Solution

by:SteveGTR
SteveGTR earned 2000 total points
ID: 19993244
It will do it if I post the correct syntax. I've got an extra space on the command line :(

osql -E -S sgs-sr-backup\bkupexec -d bedb -i _temp.txt
0
Get quick recovery of individual SharePoint items

Free tool – Veeam Explorer for Microsoft SharePoint, enables fast, easy restores of SharePoint sites, documents, libraries and lists — all with no agents to manage and no additional licenses to buy.

 
LVL 32

Author Comment

by:and235100
ID: 19993252
I have just tried what you suggested - all that comes up is the list of supported commands for osql.

Any other ideas?
0
 
LVL 32

Author Comment

by:and235100
ID: 19993255
I will try the ammendment...
0
 
LVL 32

Author Comment

by:and235100
ID: 19993267
Excellent - works a treat!!!

Thank you - nice easy one for you...
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this article we will learn how to backup a VMware farm using Nakivo Backup & Replication. In this tutorial we will install the software on a Windows 2012 R2 Server.
This is a fine trick which I've found useful many times, when you just don't want to accidentally run a batch script or the commands needs administrator rights.
This tutorial will walk an individual through configuring a drive on a Windows Server 2008 to perform shadow copies in order to quickly recover deleted files and folders. Click on Start and then select Computer to view the available drives on the se…
This tutorial will walk an individual through setting the global and backup job media overwrite and protection periods in Backup Exec 2012. Log onto the Backup Exec Central Administration Server. Examine the services. If all or most of them are stop…
Suggested Courses

839 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question