Using Agent To Copy Files Between Servers
Aug 10, 1999
I connect to remote servers using PPTP connection. There are 4 web servers and 1 production server on the other side of the firewall. From my staging server, I am supposed to archive the NT event logs(Application and system) for each of the servers.
To solve this problem, I have mapped the C drives of each of the remote servers to my local staging server. I then created a batch file, webevnt.bat containing code,
G:
Cd winnt
Cd system32
Cd config
Copy sysevent.evt c:eventarcweb01sysevent.evt
Copy appevent.evt c:eventarcweb01appevent.evt
Then I used SQL Agent to create a job of type, Operating system command(cmdexec) and typed the following command :
C:atch_~1eventl~1webevnt.bat
When I run the command, C:atch_~1eventl~1webevnt.bat through the command prompt, the files are copied with the correct modified date.
The output is,
1 file(s) copied
1 file(s) copied
But, when I use SQL Agent and start the job containing the same command, the job runs successfully but, the files have a wrong modified date. Moreover, when I view the job history for this job, it says, specified drive not found. 1 file(s) copied. 1 file(s) copied.
Please let me know why this happens.
Thank you.
Praveena
View 1 Replies
ADVERTISEMENT
Oct 20, 2005
I need to move SQL Agent scheduled jobs from one server to another..
Here are the details:
Source Server
SQL 2000 SP3 (upgraded from SQL 7)
Data stored in MsSQL7Data
target
SQL Server 2000 SP4
Data Stored in DATA
DTS Packages have already been resaved on Target Server, how can I copy the scheduled jobs over?
Thanks
View 2 Replies
View Related
Apr 27, 2006
This is a question of whether or not to use SSIS to solve a problem.
I need to copy SQL Server database backup files from a server in the DMZ to a fileserver inside the firewall. The SQL Server is not allowed to write it's backup files directly to the fileserver, so they are written to local disk. A connection can be made from inside the firewall to the SQL Server to copy the files off.
So, I'm considering SSIS for the job. Is it possible to use SSIS to perform the file copies from one remote server to another? If so, is the FTP task required, or can File System tasks be used?
An alternative would be Windows scripting, xcopy, robocopy, etc. but I like the features of SSIS and would like to take advantage of it's flow control, error handling, database scheduling, etc.
Any tips, sample code, etc. would be appreciated.
Thanks,
david
View 4 Replies
View Related
Feb 28, 2008
Hi!
I did:
alter database mydb set single_user with rollback immediate;
exec sp_detach_db @dbname='mydb', @keepfulltextindexfile='true';
then I tried to copy files to new location on other drives, same server but got
>>Cannot copy <myfile>: Access is denied
Make sure the disk is not full or write-protected and that the file is not currently in use<<
I also tried rename of file without success.
I also tried with db service stoppet (not preferred) without success.
How to find out, which process locks the files?
Best regards
View 7 Replies
View Related
Nov 14, 2000
hi, I do have over 30 scheduled jobs in one sql server in which I want to have the same jobs in another sql server. What is the best way to copy those jobs?
I thought of backing up the msdb from one sql server then restoring msdb into another sql server..... someone advice me NOT to do so due to potential compatibility problems that he did not explicitly state.
I am hoping to get the answer here.
Thanks
Ahmed
View 5 Replies
View Related
Sep 9, 2005
Hi, How can you copy a table from one server to another server using SELECT statement?
View 1 Replies
View Related
Dec 9, 2007
Hi,
I've got two servers with sql 2005 express on, the first is a shared server at our isp, we rent one database from them. The other server is our own and we have full sa access.
Is there an easy way to copy the database from the shared server onto our own server. We're unable to use the backup.
Thanks
View 3 Replies
View Related
Jun 26, 2007
Hi,
Once a report is deployed to a specific server (server A), is there a way to "copy" it to a different server (servers B, C), without having to actually deploy it server by server?
In my case, I am trying to have the developers deploy the reports on the development server first (server A), and then manually or automatically copy them to a Preview server (server B), and later to a production server (server C). I cannot grant the developers full permissions on the production server, so a "copy" is what I'm thinking about....
Thanks in advance for any ideas.
Edwin.
View 4 Replies
View Related
Jul 31, 2007
Hello. I need to copy all of the rows in a table from a database on one server, to another existing table of the same name in a different database on a different server. I'm trying to use a SELECT INTO statement. Any idea how to do this?I've tried SELECT * INTO DestinationServer.dbo.DestinationDB.DestinationTableFROM SourceTable AS SourceTable_1 But this doesn't work, saying there are too many prefixes. Any idea how to do this?
View 5 Replies
View Related
Sep 14, 2004
Hi,
I am creating a job that runs this command:
EXEC xp_cmdshell 'copy f:dados_sqlmssqlackup
ecom_tb_basico.bak \stalingrado_2c$ emp',
The result of this job is:
"Access is denied.
0 file(s) copied.
NULL"
But I am running this command with sa user.....
Wich kind of permission is missing to execute this copy?
When I execute the same command to copy the backup from the server to itself, it works fine!!!!
Does someone have an idea to solve this problem?????
View 3 Replies
View Related
Feb 10, 2008
I have a SSIS package which is used to update the OLAP database daily. It includes various processes from the initial dropping of the raw data source tables, rebuilding it, dropping of the OLAP datamart tables (dimension tables and fact tables), re-building it, updating the OLAP dimensions and finally updating the OLAP cubes. I wrote a series of the Sql scripts to perform the tasks except the updating of the OLAP dimensions and cubes, and assigned them to the SSIS package. Everything is working great and it was scheduled with the sql agent to execute at the early hour everyday. We have a single server enviroment for the "Production/Processing" i.e. Database engine, SSIS, SSAS, SSRS are all installed on a single server. By the way we are using Sql 2005.
Recently we split the "Production/Processing" enviroment into two seperated servers. We purchase another server "Production" server and use the existing server as the "Processing" server. I want to copy the success updated OLAP database from the current server "Processing" server to the new "Production" server. How to copy an OLAP database between servers?
Idealy, I believe that the following 5 processes should be assigned after the completion of the OLAP cubes updated at the "Processing" server:
Stop the SSAS at the "Production" server.........I know how to do this in SSIS
Re-name the existing OLAP database at the "Production" server.......not sure how to do this
Copy the newly updated OLAP database from "Processing" server to the "Production" server. If the copy process is succeed, drop the OLAP database that has just been re-named at the "Production" server. If the copy process is failed, re-named the OLAP database that has just been re-named back to the original name.....not sure how to do this. Should it be a Sql script?
Start the SSAS at the "Production" server........I know how to do this in SSIS
Thanks
View 1 Replies
View Related
Mar 23, 2006
I have recently moved from a Microsoft SQL Server 2000 to a SQL Server
2005.
In the good old Enterprise Manager, when I imported a table from a SQL
server to another, I could choose "Copy objects and data between SQL
Server
databases". When choosen, all primary keys, and default values was
copied.
My question is:
Is it possible to do the same in Microsoft SQL Server Management Studio
with
SQL Server 2005? And how do I do it?
I have tried using the "SELECT * INTO NewTable FROM OldTable"
statement, but
it just drops all information about primary keys and default values.
Best Regards
View 1 Replies
View Related
Feb 21, 2008
I want to migrate from one machine to another is it wise to use SSIS "Copy Objects and Data Between SQL Servers" task to accomplish this....migration both data and metadata (in master,model,and msdb ) databases?
View 1 Replies
View Related
Oct 14, 2014
I am following website link:
[URL]
I require to gather status details about all the SQL Agent jobs in the environment on multiple SQL Servers.
I tried to edit the script using:
[void][System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SqlServer.SMO")
$sqlServerName = 'localhostdeveloper'
$sqlServer = New-Object Microsoft.SqlServer.Management.Smo.Server($sqlServerName)
foreach($job in $sqlServer.JobServer.Jobs)
{
$job | select Name, OwnerLoginName, IsEnabled, LastRunDate, LastRunOutcome, DateCReated, DateLastModified
}
but SQL Agent jobs are not reflecting in the mail output...
View 11 Replies
View Related
May 27, 2015
I have migrated databases and logins from SQL server 2008 R2->SQL Server 2014. Now I also want to migrate/copy the "linked servers". Do you have a step-by-step for this, so that i will copy everything that is necessary regarding logins etc ?
View 2 Replies
View Related
Nov 13, 2006
The DTS Task Copy Server Objects is PAINFULLY slow.
The Copy Table Wizard is fast but generates an unmanagable DTS and does not bring over the indexes.
Any tips or tricks to copy tables, data and indexes and a reasonable speed?
Thanks,
Carl
View 1 Replies
View Related
Nov 8, 2007
Hi,
I'm from Argentina. I'm trying to copy a SQL 2000 databse into SQL 2005 using the "Copy Database Wizard". The problem is that when I reach the end of the process I get 2 errors concerning "SQL Server Agent Job".
First error: "Start SQL Server Agent Job". Status > Stopped.
Second Error: "Execute SQL Server Agent Job". Status > Stopped.
Here's the report:
Performing operation...
- Add log for package (Success)
- Add task for transferring database objects (Success)
- Create package (Success)
- Start SQL Server Agent Job (Stopped)
- Execute SQL Server Agent Job (Stopped)
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Any ideas?
Thanks.
View 11 Replies
View Related
Jul 26, 2006
Hi, I am trying to use SQL Server 2005 Enterprise Edition to copy tables from my local server to my hosts server at brinkster.com. In the old version you could use DTS, but everything seems to have got far more complicated now! Please can anybody guide me in the right direction? Thanks a lot.
View 2 Replies
View Related
Sep 9, 2004
Can I move a database from one server to another server using QA?
EXEC sp_detach_db @dbname = 'IISLOG'
EXEC sp_attach_single_file_db @dbname = 'IISLOG',
@physname = 'c:Program FilesMicrosoft SQL ServerMSSQLDataIISLOG.mdf'
Or would I need a tape backup to move this database to another server?
Thanks
Lystra
View 1 Replies
View Related
May 18, 2006
I'm trying to copy files between 2 servers on a local network from within aSQL Job (and Query Analyzer) using xp_cmdshell.xcopy but get an accessdenied message returned.I'm able to successfully do the copy from within a command window so thinkthe problem has something to do with using the default SQL Server accountbut as yet I don't know how to resolve.Any help/suggestions would be much appreciated.
View 1 Replies
View Related
Oct 25, 2007
I have a maintenace plan that copies production backup files in DR server. The production is mission critical and runs 24/7. We have a round the clock backups. Backups include full backup, differential backups and log backups.
To secure these backup files, I was asked to keep these files in different server at the same time as it goes to DR Server. As I am using maintenace plan for scheduled backups that go to DR server and I had no idea how to incorparate copying these files to another server in the same maintenence plan. I came up with idea using xp_cmdshell stored proc that I attached on the maintenace plan in executeT-SQL statement task. The statement looks like
Exec master..xp_cmdshell 'copy e:DRbackup*.bak \fgh-sql16ackup$'
Above statement copy all backup files on DR server and takes these to remote server called fgh-sql16.
My question here is ....are there any other effective methods to copy backup files simultaneously to different servers via maintenace plan.
Thanks all
View 1 Replies
View Related
Sep 28, 2007
Hi-I have a sql 2005 database that stores weekly time and attendance data for 500 users. I need to send the file on a scheduled basis.I'd alo like to have programmatic control over sending the file via my asp,net application's admin pages. (I have roles and security set up on the site) My question is two fold: Can asp.net be scripted to manage a data extraction to a file, (I gotta HOPE so) THEN is there any sFTP functions built into asp.net?I know I can do this in SQL2005, then have a scheduled event fire off the file via sFTP. but like I said, I'd like to have programmatic control over the file sending. (Of course they have to be sent on SUNDAY!) Thanks in advance for any advise
View 6 Replies
View Related
Jan 16, 2007
My Snapshot Agent for SQL Server 2005 sometimes does not fully complete. I am expecting around 2073 files in the snapshot folder but only get 492 (this number does change). I have immediate_sync set to true, so I should get a full snapshot every time. It seems to quit after all data has been BCP'ed out and before the schema generation starts. I do get the "The replication agent has not logged a progress message in 10 minutes. This might indicate an unresponsive agent or high system activity. Verify that records are being replicated to the destination and that connections to the Subscriber, Publisher, and Distributor are still active. " message in the MSSnapshot_history table.
I am guessing that there is some sort of blocking that is preventing the snapshot agent from continuing and then it times out and dies. But that is a total guess as I have not been able to observe the behavior, only the outcome.
Any suggestions to what the cause is or how I can fix it?
Thanks, Amy
View 4 Replies
View Related
Mar 24, 2007
I copied a database using backup and restore from Sql server 2000 to Sql server 2005. I noticed the data(mdf) and log(ldf) files did not copy. when I try to do a copy and past it gives me an error: cannot copy lof: it is being used by another person or program. Close all programs and try again. Does this mean I have to stop both servers to copy between them? Please help.
View 1 Replies
View Related
Dec 20, 2007
Hello, everyone:
I want setup a scheduled job to copy txt files from FTP to local hard drive. How to open FTP and copy files from SQL Server Query Analyzer?
Thanks
ZYT
View 5 Replies
View Related
Feb 5, 2008
I have been looking for a way to copy only new flat files from an FTP server. I can find how to copy all of the files into another directory, but I only want to copy in files that are not already in my target directory.
So, is there a way to compare the files in the FTP directory to a list of files in a SQL table and use this to control the transfer, and how do I get those FTP file names into a SQL table? Or is there some other way?
Thanks in advance for any help.
Graham
View 4 Replies
View Related
Aug 3, 2006
I am trying to
copy a database from our company's external SQL
Server(production) to our local SQL
Server(development). The Copy Database wizard fails on the step
"Execute SQL Server Agent Job".
Following is the error in the log file.. Please advise
InnerException-->An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)
View 7 Replies
View Related
Nov 18, 2007
Howdy, hope someone can help me out with this.I want to run a job each night that copies files from one server to another.I cant even get a simple copy one file from one directory to another,statement to work.When I try :@cmd 'copy c: empfile1.txt c:ackupsfile1.txt'master.dbo.xp_cmdshell @cmdI get the msg: 'c' is not recognised as an internal command, program orbatch file, Null.What I ideally want to do is pass xp_cmdshell variables for the 2 file'spath+names. I have tried numerous variations of single and double quoteswithout success, which is why I decided to work up form the simple 'copyc: empfile1.txt c:ackupsfile1.txt', but can't even get that to work.Any advice much appreciated.
View 3 Replies
View Related
Jul 20, 2005
Hi,I'm having some trouble finding any information on this topic - can MS SQLserver 2000 copy/delete files on the host computers disk.Any info on this would be great.Thanks,Eirik
View 2 Replies
View Related
Jan 11, 2008
hi , I am trying to copy files dynamically from a remot folder by using File System task ,
the files are going to be generated daily with f1yyyy-mm-dd.txt
I created 3 file connections :
- Existing remote folder (RemotFolder) and set that to var v_remotefolder
- Existing destination folder (DestFolder)
- existing file (filename) and set the expression to var (string ) =v_fname
in the File System task I set the the
Destination connection = DestFolder
Operation =Copy file
Source = filename
expression >>Property (source) = @[User::v_remotefolder] + @[User::v_fname]
I know I need the date too ,but I 'm getting error on this step.
Can you please tell me if you know how to resolve this without using For each loop since I don't have control on the remote folder and I don't want to copy unneeded files (the files are 10 GB daily) and get delete it once every month.
-I know this not uncommon task but I can't find any example.
Thanks
View 3 Replies
View Related
Mar 24, 2007
I copied a database using backup and restore from Sql server 2000 to Sql server 2005. I noticed the data(mdf) and log(ldf) files did not copy. when I try to do a copy and past it gives me an error: cannot copy lof: it is being used by another person or program. Close all programs and try again. Does this mean I have to stop both servers to copy between them? Please help.
View 5 Replies
View Related
Jul 14, 2006
I've got an SSIS package that I've been testing all week and it runs fine in Visual Studio. The package uses an OLE DB connection manager to access the dBase files using the Jet Provider. The dBase files are stored on a remote file share. There are a series of identical files held in different dated folders. I use a ForEach loop to move through the folder list and import the data as I go. When I deploy it to the server and try to run it, I get the following:
The AcquireConnection method call to the connection manager "Aloha" failed with error code 0xC0202009.
Aloha is the ConncetionManager to the dBase files. I've searched everywhere I can for ideas on how to solve this. I've made the SQL Agent Service is running under the same account I used to author the package. I've made sure that the package is using Server Storage. Everything looks like it should be working.
Can anyone give me any other items I can look into?
Thanks!
Barry Austin
View 4 Replies
View Related
Jun 19, 2000
I was trying to copy backup files from production domain to test domain nightly using xp_cmdshell. I
View 3 Replies
View Related