Showing posts with label setup. Show all posts
Showing posts with label setup. Show all posts

Friday, March 30, 2012

Job to truncate database records more than 15 days old

I have a SQL Server 2K db with some 10 tables and I want to setup a nightly job to truncate all db records which are more than 15 days old. Can anyone provide me with steps involved? Any help will be highly appreciated.You do have a datetime field with the record createion date on the tables, right?

And you do not have any relational integrity that may get in your way?|||Thats correct.|||Then create a stored procedure perform,ing the delete and let it run nightly. SQL Server Assistant has to be running for this to happen. Pretty staraightforward.sql

Friday, March 9, 2012

job execution Time

i observed a strange problem in my production setup. i have a job which updates usage metrics (for reporting) which is scheduled to run once in a day. (the job invokes an sp to do this. the sp refers two tables to retrieve/update information, say TableA and TableB).

the job normally takes an average of 25 seconds to complete. all of a sudden the job execution time increased to 6 minutes and 52 seconds. now, the average job execution time is 8 minutes. there is no table/sp change in the DB

the only thing i observed is that one of the tables referred by the sp has 30,000 records added to it, on the day from which the job execution time increaed to 6 minutes.

i have updated the statistics on the Table, but the execution time remains unchanged. can any one suggest any possible causes for such a scenario.

i expect a few hints with which i can explore my production DB and find out the causes for the increased execution time for the sp.

Pl discuss...

Thanks in advancethe only thing i observed is that one of the tables referred by the sp has 30,000 records added to it, on the day from which the job execution time increaed to 6 minutes.


I think you may have answered your own question! If the columns that your stored procedures are referencing are not indexed, they will likely have to perform table scans. You mentioned that 30,000 rowd were added...how many did you start off with.

Have you tried generating an execution plan using Query Analyzer? That will give you a good indicaton of where the problem lies.

Friday, February 24, 2012

Jet ODBC Driver for Text files - Permissions Issue

Hi,
I have setup a linked server to a text file uing the MS Jet ODBC driver.
Users that are not sysadmins and local admins on the server that the file
resides get an Jet Initialize error message.
What are the permissions required for SQL Server users to gain access to
this file?
Thanks.
Arun,
What happens if you run OPENDATASOURCE (See Books Online) against that
provider for the non-admin user account in Query Analyzer? You could also
enable trace flag 7300.
In Query Analyzer you would type something like:
DBCC TRACEON(7300)
go
SELECT * FROM OpenDataSource( 'Microsoft.Jet.OLEDB.4.0',...
Please provide exact error message.
Regards,
James

Jet ODBC Driver for Text files - Permissions Issue

Hi,
I have setup a linked server to a text file uing the MS Jet ODBC driver.
Users that are not sysadmins and local admins on the server that the file
resides get an Jet Initialize error message.
What are the permissions required for SQL Server users to gain access to
this file?
Thanks.Arun,
What happens if you run OPENDATASOURCE (See Books Online) against that
provider for the non-admin user account in Query Analyzer? You could also
enable trace flag 7300.
In Query Analyzer you would type something like:
DBCC TRACEON(7300)
go
SELECT * FROM OpenDataSource( 'Microsoft.Jet.OLEDB.4.0',...
Please provide exact error message.
Regards,
James