Showing posts with label copy. Show all posts
Showing posts with label copy. Show all posts

Friday, March 23, 2012

Scheduled Tasks on Windows 2000/2003

I'm trying to use scheduled tasks to copy over transaction logs from one server to another.

Can I schedule a task to run hourly? I have it set to repeat the task every hour, but it's not working. It does it once and then the next run date is tomorrow.

Please let me know if I'm missing something.

Thanks

Susan

Figured it out..

I had the repeat task selected, but had the duration at an hour and a half.

Once I modified the duration to 24 hours it worked great!!

Thanks

Susan

Monday, March 12, 2012

Scheduled DTS package not running

I have created a DTS package to read data from a SQL Server table and copy it to an Excel file on one sheet. I have tested the DTS package manually and it runs. I scheduled the package but it keeps failing giving the following error message. The path to the Excel file is valid and the SQL server is connected to the server where the Excel file resides.

... DTSRun: Executing... DTSRun OnStart: Copy Data from vw_Symbols to vw_Symbols$ Step DTSRun OnError: Copy Data from vw_Symbols to vw_Symbols$ Step, Error = -2147467259 (80004005) Error string: 'S:\Mission Critical Enterprises\Current Projects\JPMC Aperture Rollout 05-100-1-0001\Symbol Requests\JPMC - Symbols Added.xls' is not a valid path. Make sure that the path name is spelled correctly and that you are connected to the server on which the file resides. Error source: Microsoft JET Database Engine Help file: Help context: 5003044 Error Detail Records: Error: -2147467259 (80004005); Provider Error: -534774783 (E01FFC01) Error string: 'S:\Mission Critical Enterprises\Current Projects\JPMC Aperture Rollout 05-100-1-0001\Symbol Requests\JPMC - Symbols Added.xls' is not a valid path. Make sure that the path name is spelled correctly and that you are connected to the server on which the file resides. Error sour... Process Exit Code 1. The step failed.

Is S:\ a network-shared drive?

The Agent runs your package under its own account, so if S:\ is a network drive mapped under your account, it might not be visible to Agent's account.

You may create Agent Proxy to make package run under your account.|||

I have a same or pretty similar problem, but in my case it′s when a trying to schedule a DTS and leave a file in a share point tool. If you have some information or tips I will appreciate it.

This is the message error.

Executed as user: Server Name\CRMSandbox. ...Step_DTSExecuteSQLTask_1 DTSRun OnError: DTSStep_DTSExecuteSQLTask_1, Error = -2147467259 (80004005) Error string: Failure creating file. Error source: Microsoft JET Database Engine Help file: Help context: 5003436 Error Detail Records: Error: -2147467259 (80004005); Provider Error: -329978796 (EC54EC54) Error string: Failure creating file. Error source: Microsoft JET Database Engine Help file: Help context: 5003436 DTSRun OnFinish: DTSStep_DTSExecuteSQLTask_1 DTSRun OnStart: DTSStep_DTSExecuteSQLTask_2 DTSRun OnError: DTSStep_DTSExecuteSQLTask_2, Error = -2147467259 (80004005) Error string: Failure creating file. Error source: Microsoft JET Database Engine Help file: Help context: 5003436 Error Detail Records: Error: -2147467259 (80004005); Provider Error: -329978796 (EC54EC54) Error string: Failur... Process Exit Code 2. The step failed.

Thanks.

Miguel

|||

Hi, with regards to creating "Agnet Proxy" have you any further information regarding this?

Thank you.

|||Search for "Creating SQL Server Agent Proxies" in Books Online.

Scheduled DTS package not running

I have created a DTS package to read data from a SQL Server table and copy it to an Excel file on one sheet. I have tested the DTS package manually and it runs. I scheduled the package but it keeps failing giving the following error message. The path to the Excel file is valid and the SQL server is connected to the server where the Excel file resides.

... DTSRun: Executing... DTSRun OnStart: Copy Data from vw_Symbols to vw_Symbols$ Step DTSRun OnError: Copy Data from vw_Symbols to vw_Symbols$ Step, Error = -2147467259 (80004005) Error string: 'S:\Mission Critical Enterprises\Current Projects\JPMC Aperture Rollout 05-100-1-0001\Symbol Requests\JPMC - Symbols Added.xls' is not a valid path. Make sure that the path name is spelled correctly and that you are connected to the server on which the file resides. Error source: Microsoft JET Database Engine Help file: Help context: 5003044 Error Detail Records: Error: -2147467259 (80004005); Provider Error: -534774783 (E01FFC01) Error string: 'S:\Mission Critical Enterprises\Current Projects\JPMC Aperture Rollout 05-100-1-0001\Symbol Requests\JPMC - Symbols Added.xls' is not a valid path. Make sure that the path name is spelled correctly and that you are connected to the server on which the file resides. Error sour... Process Exit Code 1. The step failed.

Is S:\ a network-shared drive?

The Agent runs your package under its own account, so if S:\ is a network drive mapped under your account, it might not be visible to Agent's account.

You may create Agent Proxy to make package run under your account.|||

I have a same or pretty similar problem, but in my case it′s when a trying to schedule a DTS and leave a file in a share point tool. If you have some information or tips I will appreciate it.

This is the message error.

Executed as user: Server Name\CRMSandbox. ...Step_DTSExecuteSQLTask_1 DTSRun OnError: DTSStep_DTSExecuteSQLTask_1, Error = -2147467259 (80004005) Error string: Failure creating file. Error source: Microsoft JET Database Engine Help file: Help context: 5003436 Error Detail Records: Error: -2147467259 (80004005); Provider Error: -329978796 (EC54EC54) Error string: Failure creating file. Error source: Microsoft JET Database Engine Help file: Help context: 5003436 DTSRun OnFinish: DTSStep_DTSExecuteSQLTask_1 DTSRun OnStart: DTSStep_DTSExecuteSQLTask_2 DTSRun OnError: DTSStep_DTSExecuteSQLTask_2, Error = -2147467259 (80004005) Error string: Failure creating file. Error source: Microsoft JET Database Engine Help file: Help context: 5003436 Error Detail Records: Error: -2147467259 (80004005); Provider Error: -329978796 (EC54EC54) Error string: Failur... Process Exit Code 2. The step failed.

Thanks.

Miguel

|||

Hi, with regards to creating "Agnet Proxy" have you any further information regarding this?

Thank you.

|||Search for "Creating SQL Server Agent Proxies" in Books Online.

Scheduled DTS package not running

I have created a DTS package to read data from a SQL Server table and copy it to an Excel file on one sheet. I have tested the DTS package manually and it runs. I scheduled the package but it keeps failing giving the following error message. The path to the Excel file is valid and the SQL server is connected to the server where the Excel file resides.

... DTSRun: Executing... DTSRun OnStart: Copy Data from vw_Symbols to vw_Symbols$ Step DTSRun OnError: Copy Data from vw_Symbols to vw_Symbols$ Step, Error = -2147467259 (80004005) Error string: 'S:\Mission Critical Enterprises\Current Projects\JPMC Aperture Rollout 05-100-1-0001\Symbol Requests\JPMC - Symbols Added.xls' is not a valid path. Make sure that the path name is spelled correctly and that you are connected to the server on which the file resides. Error source: Microsoft JET Database Engine Help file: Help context: 5003044 Error Detail Records: Error: -2147467259 (80004005); Provider Error: -534774783 (E01FFC01) Error string: 'S:\Mission Critical Enterprises\Current Projects\JPMC Aperture Rollout 05-100-1-0001\Symbol Requests\JPMC - Symbols Added.xls' is not a valid path. Make sure that the path name is spelled correctly and that you are connected to the server on which the file resides. Error sour... Process Exit Code 1. The step failed.

Is S:\ a network-shared drive?

The Agent runs your package under its own account, so if S:\ is a network drive mapped under your account, it might not be visible to Agent's account.

You may create Agent Proxy to make package run under your account.|||

I have a same or pretty similar problem, but in my case it′s when a trying to schedule a DTS and leave a file in a share point tool. If you have some information or tips I will appreciate it.

This is the message error.

Executed as user: Server Name\CRMSandbox. ...Step_DTSExecuteSQLTask_1 DTSRun OnError: DTSStep_DTSExecuteSQLTask_1, Error = -2147467259 (80004005) Error string: Failure creating file. Error source: Microsoft JET Database Engine Help file: Help context: 5003436 Error Detail Records: Error: -2147467259 (80004005); Provider Error: -329978796 (EC54EC54) Error string: Failure creating file. Error source: Microsoft JET Database Engine Help file: Help context: 5003436 DTSRun OnFinish: DTSStep_DTSExecuteSQLTask_1 DTSRun OnStart: DTSStep_DTSExecuteSQLTask_2 DTSRun OnError: DTSStep_DTSExecuteSQLTask_2, Error = -2147467259 (80004005) Error string: Failure creating file. Error source: Microsoft JET Database Engine Help file: Help context: 5003436 Error Detail Records: Error: -2147467259 (80004005); Provider Error: -329978796 (EC54EC54) Error string: Failur... Process Exit Code 2. The step failed.

Thanks.

Miguel

|||

Hi, with regards to creating "Agnet Proxy" have you any further information regarding this?

Thank you.

|||Search for "Creating SQL Server Agent Proxies" in Books Online.

scheduled dts fails but runs when done manually

I'm a newbie to sql2000. i have some jobs that copy stuff from a non microsoft database(titanium) to SQL2000. i use the propriety odbc drivers provided by titanium. when run manually in enterprize manager,it works. but scheduled as a job it fails with the message "System cannot find the specified File" i've read up and tried microsofts suggestions ie ensuring that the sql server agent has rights to the folders used etc. i've also tried puttin in the the dts owner and user passwords. each time it fails with the same error.
any one out there who can help?:confused:I'm a SQL2K newbie and I've experienced a similar problem.

When you run the DTS pkg manually, it runs on your client machine;
when you run it as a job it runs on the SQL server.

If you can run the DTS pkg manually on the SQL server (from its console), do that. You should get more details on the error. Most likely
something is missing from the PATH environment variable on the SQL
server (and you can compare to what you have for this on your client
machine).

Good luck!

Jeff|||Jeff's on the right track. When you develop a DTS package remotely, it remembers the paths based on where you developed it. You would either need to
- develop the package locally (on the server), in which case it would not run interactively from a remote machine, or

- use a unc path, ie. \\servername\sharename\filename. In this case, it should run interactively or scheduled.

Steve|||I'd also add to check permissions. You need to keep in mind that the job on the server is not going to run as "you" but as the sql server agent, so it maynot have the same authorization to access drives and shares as you do. That's the one that always catches me.

Tuesday, February 21, 2012

Schedule a scripted restore on 2005 Express from .bak file.

Hi i have an web app demo that allows users to add info and change attributes within a SQL 2005 Express DB. I'd like to restore a clean copy of this database every couple of hours from a .bak file using a Windows scheduled task on the server. Has anyone got a .sql script for database restoration that i could use and call using a .cmd script file? Thanks.

Hi TheGrox,

Generally speaking the sql restoration script is like this:

RESTORE DATABASE [Your_databasename] FROM DISK = N'File_Path\BCKUP.bak' WITH FILE = 1, NOUNLOAD, STATS = 10
GO

However, I don't think it can be used from a .cmd script file. To run .sql script file, you need to run it within sql server query analyzer (if you run it from a .cmd script, first it will jump up a window asking your to login to sql server, even though you enter the server name and user/password and login successfully, that sql script file will be opened there while won't be executed until you click the execute button from the GUI).

I think there are two solutions for you requirment. One solution is the easist, upgrade your sql express to a full vertion and use Server Agent-> Jobs. Run that script in a job and schedule the job to run at a sepcific time frequency. I believe it won't cost you more than 5 minutes;

The second solution is to use ado.net.Open your visual studio and create a new project, build a connection to your database first and then send the restore sqlcommand to it. Compile and build you project and after that, you create a windows schedule task and run that application regularly.

Hope my suggestion helps

|||

Hi, thanks for the suggestions. The running the .sql from a .cmd file isnt a problem, i already do that to automatically back up all DB's in my SQL Express instance by having a file called BackupDB.cmd with the following code:

CLS
ECHO OFF
ECHO Testing to make sure directories exist.
IF NOT EXIST C:\SQLBackups MD C:\SQLBackups

ECHO Complete with directory creation
ECHO **********************************************************
ECHO Backing up databases......
sqlcmd -S .\SQLEXPRESS -i c:\Windows\BackupExpress.sql -o C:\SQLbackups\backup.log
ECHO **********************************************************
ECHO Backup complete. Look in the C:\SQLBackups\Backup.log file for information.

ECHO ON

The BackupExpress.sql file is simply a script that loops through all databases on the server and creates a .bak file for each of them in the specified directory. Works nicely andmeans i dont need to reconfigure anything if a new DB is created, it is just automatically included in the backups.

So i guess i just need to create a Restore.sql script using the syntax you quoted and call it as above. The command runs under the context of a valid SQL user account specified when the scheduled task is created so login is not an issue.

The script for the BackupExpress.sql file if anyone is interested in using it is:

/**File Name: BackupExpress.sqlDescription: Backs up all databases. This script is mainly meant for SQL Express instancesThe script requires a C:\SQLBackups directory by default to backup to but can be changed with the @.OutputPath variable.Accompanying file is BackupExpress.cmd, which is used to schedule the script.**/SET QUOTED_IDENTIFIEROFF USE masterGOSET NOCOUNT ON DECLARE @.dayofweekvarchar(20)SELECT @.dayofweek =CASE datepart(dw,getdate())WHEN 1THEN'Sunday'WHEN 2THEN'Monday'WHEN 3THEN'Tuesday'WHEN 4THEN'Wednesday'WHEN 5THEN'Thursday'WHEN 6THEN'Friday'WHEN 7THEN'Saturday'ENDDECLARE @.OutputPathvarchar(500)DECLARE @.DatabaseBackupFilevarchar(500)DECLARE @.FolderNamevarchar(25)DECLARE @.DatabaseNamevarchar(25)DECLARE @.strSQLvarchar(2000)DECLARE @.hostnamevarchar(255)SET @.hostname = (select replace(convert(varchar(255),serverproperty('SERVERNAME')),'\','_'))SET @.OutputPath ='C:\SQLBackups'DECLARE cur_BackupCURSOR FOR select name fromsysdatabaseswhere name !='tempdb'OPEN cur_Backup-- Fetch the db names from CursorFETCH NEXT FROM cur_BackupINTO @.DatabaseNameWHILE@.@.FETCH_STATUS = 0BEGINSET @.DatabaseBackupFile = @.OutputPath +'\' + @.hostname +'-' + @.DatabaseName +'-' + @.dayofweek +'.bak'print @.DatabaseBackupFileSET @.strSQL ='BACKUP DATABASE '+@.DatabaseName+' TO DISK = "'+ @.DatabaseBackupFile+'" WITH RETAINDAYS = 1, NOFORMAT, INIT, NAME = N''Full Database Backup'', SKIP, NOREWIND, NOUNLOAD, STATS = 10'PRINT @.strSQLEXEC (@.strSQL)FETCH NEXT FROM cur_BackupINTO @.DatabaseNameEND-- Distroy CursorCLOSE cur_BackupDEALLOCATE cur_BackupSET NOCOUNT OFF