SQL Server Maintenance Task
I have configured a maintenance task that consists of only two T-SQL Statements, one that executes after completion of the other, however it fails and no history is generated. Please advise how I should begin troubleshooting the issue with the maintenance
task.
what version\edition of sql are you using? how are you executing your maintenance plans ?? through sql job or straight from maintenance plan.
make sure your sql server agent is running. you can get the error log from two places 1. maintenance history 2. job history. these two are integrated..
try the queries below...
if the plan was deleted and recreated, the previous history is gone.
--maintenance plan history
use msdb
go
select case when d.Succeeded=1 then 'Success' when d.succeeded=0 then 'Failed' End as Result,
name as [PlanName],b.subplan_name,D.line1,D.line2,D.line3,D.line4,D.line5,D.start_time,D.end_time,D.command,d.Succeeded
from sysmaintplan_plans a inner join sysmaintplan_subplans b on a.id=b.plan_id
inner join sysmaintplan_log c on c.plan_id=b.plan_id and c.Subplan_id=b.subplan_id
inner join sysmaintplan_logdetail d on d.task_detail_id=c.task_detail_id
--where a.Name='yourmaintenanceplanname'
ORDER BY D.start_time asc
GO
--maintenance plan history from jobs
select case when b.step_id=0 then 'Final Job Outcome' else 'Job Step '+cast(b.step_id as varchar(20))+':'+b.step_name End as [JobOutCome],d.name as [JobName],
c.name as [MaintenancePlan],a.subplan_name as [SubPlan_Name],run_date,Run_time,Run_duration,message
from dbo.sysmaintplan_subplans a inner join
sysjobhistory b on a.job_id=b.job_id inner join
sysmaintplan_plans c on c.id=a.plan_id
inner join msdb.dbo.sysjobs d on d.job_id=b.job_id
--where c.name='yourmaintenanceplanname'
order by b.instance_id asc,step_id asc
Hope it Helps!!
Similar Messages
-
Data Migration - SSIS Transfer SQL Server Objects Task or something else
Can someone please kindly help me with this.
Scenario
I have a requirement to transfer selected tables and views (with a specific schema) between two databases which reside in two different servers. In the interest of clarity I will call my databases DB_A and DB_B respectively. Please note that these databases
are NOT on the same server.
Transfer of these objects (tables & views) happens once a month. 99% of the objects in question will be of the same name and schema between the two databases as the ones migrated from the previous month. However, metadata definitions may change on DB_A
and those changes are supposed to be reflected on DB_B along with the associated data. This therefore means that each time a transfer/migration happens; objects in DB_B are dropped first and completely replaced by objects from DB_A.
Problem
What is the best way to achieve this?
My first attempt has been a go on the Transfer SQL Server Objects Task
in SSIS. The problem that I have is that when using Transfer SQL Server Objects Task
I don’t know how to filter objects in DB_A so that only objects with a specified schema can be migrated.
Transfer SQL Server Objects Task appears to be the best solution to me to accomplish my requirement but I can’t filter the desired objects by schema. Someone suggested using C# but my C# skills are not that eloquent.
May someone kindly help please, or possibly suggest any other way which can be handy to fulfil my requirements.
Many thanks,
MpumeleloHi Prashanth
Thanks for your response. There is one problem though in my case. I’m sorry I forgot to mention this in the original question. When the objects are moved from BD_A to DB_B the schema in DB_B changes. That is, schemas are not the same between the source and
the destination database. How do I handle that with the solution that you have suggested?
Many thanks,
Mpumelelo -
Is there any way to add the "Keep Identity" option to the tables selected for transfer in a Transfer SQL Server Object Task? It seems that would be very useful, yet I can't find an easily available setting for it. I would prefer to
accomplish this within the Transfer SQL Server Object Task since it can copy any new fields added to the source tables, as opposed to having to rebuild a custom Data Flow Task any time a table structure is altered. I thought setting "CopyPrimaryKeys"
to True would do the trick, but I found that only ensures that the column settings are transferred; when the transfer happens, the destination id column is populated based on the specified seed and increment value, not what's actually in the source table.
I'd like to point out that replication isn't really an option here. This is a package that runs a few times a day to keep some data on our website up to date with data in our protected corporate environment.IIRW there is FastLoadKeepIdentity specifies
whether to keep an identity in OLEDB destination
Best Regards,Uri Dimant SQL Server MVP,
http://sqlblog.com/blogs/uri_dimant/
MS SQL optimization: MS SQL Development and Optimization
MS SQL Consulting:
Large scale of database and data cleansing
Remote DBA Services:
Improves MS SQL Database Performance
SQL Server Integration Services:
Business Intelligence -
Error at the time of using "Transfer SQL Server Objects Task"
Hi all,
I am creating a task for coping the structure of one database to another but there is some issues which are disturbing me
i am unable to get how to fix it any one can help me please
I have one Source database and destination database
Errors are like
[Transfer SQL Server Objects Task] Error: Execution failed with the following error: "An error occurred while transferring data. See the inner exception for details.".
[Transfer SQL Server Objects Task] Error: Execution failed with the following error: "Invalid filegroup 'SFG_1_Application' specified.".
Niraj Sevalkar[Transfer SQL Server Objects Task] Error: Execution failed with the following error: "Invalid filegroup
'SFG_1_Application' specified.".
Hello Niraj,
Seems in the source database a filegroup is used, which is not available in the Destination database.
Olaf Helper
[ Blog] [ Xing] [ MVP] -
My client has MS SQL database administrators that are highly recommending doing a periodic reindex as they are seeing a high level of fragmentation. I am unable to find any documents on proper MS SQL Server maintenance from Cisco. In the absence of recommendations from "the vendor" (as the DBA puts it) should we apply generally accepted maitenance procedures for MS SQL? Should we set our log files to Autogrow as they are currently set to none?
Thanks,
MarkHi,
since MS SQL Server is not used in UCCX anymore, I assume you are talking about Cisco ICM.
It has already a system implemented that periodically checks the size of tables and removes old data according to the schedule.
I don't really see the meaning of index "defragmentation", as data is written sequentially to the historical tables. You can rebuild the index of the configuration tables, if, for instance, agents are added and removed frequently.
G. -
SQL Server Maintenance Plan Issue
SQL Server Version:
Microsoft SQL Server 2005 - 9.00.5000.00 (Intel X86)
Dec 10 2010 10:56:29
Copyright (c) 1988-2005 Microsoft Corporation
Enterprise Edition on Windows NT 5.2 (Build 3790: Service Pack 2)
Issue : Maintenance Plan - DB backup plan & TRN Log backup plan skipped / some times not deleting the old backup files.
Error : Failed to retrieve date for this request (Microsoft.SqlServer.SmoEnum)
Additional Informaiton
An exception occurred while executing a Transact-SQL statement or batch.
(Microsoft.SqlServer.ConnectionInfo)
A Server error occurred on the current command.
The results, if any should be discarded (Microsoft Sql Server)
Any experts can help me to resolve this issue.
Thanks
drmrpush
MRVSFLYHello,
Same issue reported here:
https://social.msdn.microsoft.com/Forums/sqlserver/en-US/601fd83c-c49f-4bf8-b69d-95431197652d/maintenance-plan-is-not-opening-on-sql-server-2005-sp2?forum=sqlkjmanageability
Please check solution on :
https://social.msdn.microsoft.com/Forums/sqlserver/en-US/3e53ba8b-ea23-4629-98db-43c80ba9888e/cannot-save-maintenance-plans?forum=sqltools
This problem occurs if some of the stored procedures while installing SP2 has not been applied successfully. So manually run the script below and it may resolve
your issue. It resolved ours and we went throught exact same process of re-installing several times.
1)
First go to the folder Install . The default location is this = “C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Install “ .
Please post back still your issue not resolves.
2)
Then in this folder find this “sysdbupg.sql” .
3)
Please open this script with a nodepad.
4)
Then copy the
whole script and then paste it in the Query window of the Management studio.
5)
Then execute this script.
6)
Once this script has been successfully executed, The issue should be resolved.
Regards, Pradyothana DP. Please Mark This As Answer if it solved your issue. Please Mark This As Helpful if it helps to solve your issue. ========================================================== http://www.dbainhouse.blogspot.in/ -
Hi experts,
We are running BPC for MS with SQL 2008. Our data growth is very modest (less than 100 MB per month).
We are currently using the functionality in BPC to do the maintenance (Optimization etc). Given our low volumes, do we need to order additional server maintenance from our IT vendor to directly in SQL Server?
What additional maintenance could they do that would be benificial to us?
Thanks,
SamHi Sam,
BPC maintenance is specific for BPC appsets and is trying to provide you good performances for appset.
For good performances of SQL Server database you really have to create a maintenance plan for SQL Server.
You can read more about Maintenance Pllan into Microsoft side.
Usually maintenance plan is corelated with a backup strategy.
Because we are speaking about a small amount of data in your case I suggest:
1. Keep database in simple mode
2. Full Backup every day after the full optimize of SAP BPC appset and also
3. Shrink of transaction log after the backup
4. Update statistics of your appset
Once per week instead of full optimize for SAP BPC you have to perform full optimize with compress.
Regards
Sorin Radulescu
Edited by: Sorin Radulescu on Sep 18, 2009 8:32 AM -
SQL Server Maintenance Plan does not run DEL command in .BAT
Hello,
I have a T-SQL Statement task in my Maintenance Plan that runs a .BAT file and it runs OK when manually executed. The .BAT file has a del d:\backups\*.* command in it. However, when the plan runs automatically at a scheduled time, the .BAT file does
not delete files. Could this be a permissions issue?
PaulHi Paul,
This looks like a permission issue. Make sure the account SQL instance is running has delete permissions on the folder from which you are trying to delete and also make sure the account has execute permission on that batch file.
Thanks,
Bhanu -
Unable to edit maintenance plan Sql Server 2008R2
Hi All,
I am unable to edit sql server maintenance plan and it is failing continuously from job as well.When I try to open the same the throws an error:
Microsoft SQL Server Management Studio is unable to load this document.:
Error loading from XML. No further detailed error information can be supplied for this problem because no Event objects was passed where detailed error information can be stored. It used to work pretty well in the past.Throws same error when I try to connect
remotely.
Regards
RahulHas the MP been developed in SQL Server 2008r2 as well?
Best Regards,Uri Dimant SQL Server MVP,
http://sqlblog.com/blogs/uri_dimant/
MS SQL optimization: MS SQL Development and Optimization
MS SQL Consulting:
Large scale of database and data cleansing
Remote DBA Services:
Improves MS SQL Database Performance
SQL Server Integration Services:
Business Intelligence -
Migrate SQL Server 2005 database to 2008r2
Hi
We have SQL Server 2005 in 32 bit machine, We are planning to move to SQL Server 2008r2 in 64 bit machine(Virtual Environment) . Planning to do side by side migration. I was wondering what approach would be best way to
copy user db, login information ,jobs and maintenance plan to New environment.
thanks for help.Hello,
You can use backup/restore or detach/copy/attach methods to migrate those databases. Look at the following resource to
consider these and other options.
http://blogs.msdn.com/b/sreekarm/archive/2009/09/11/move-a-database-from-one-server-to-another-server-in-sql-server-2008.aspx
Transfer logins using the following article.
http://support.microsoft.com/kb/918992
To transfer jobs, you can script them or use SSIS.
http://www.mssqltips.com/sqlservertip/2081/transfer-sql-server-jobs-task-and-transfer-sql-server-logins-task-in-ssis/
https://sqlserverrider.wordpress.com/2011/10/15/transfer-sql-server-agent-jobs-between-servers/
The following resource may be valuable for your project too.
http://www.microsoft.com/en-us/download/details.aspx?id=15220
Hope this helps.
Regards,
Alberto Morillo
SQLCoffee.com -
Copying more tables from a SQL Server db to another one - SSIS 2012
Hi,
in order to copy data of more tables (more an hundred) from a SQL Server db to a SQL Server destination db I'd like to use the Transfer SQL Server objects task, but the source tables belonged to the dbo schema and the destination schema is a different
one.
It seems that this task doesn't provide a such option.
Any suggests to me, please?
Thankshttp://www.experts-exchange.com/Database/MS-SQL-Server/Q_26533111.html
Best Regards,Uri Dimant SQL Server MVP,
http://sqlblog.com/blogs/uri_dimant/
MS SQL optimization: MS SQL Development and Optimization
MS SQL Consulting:
Large scale of database and data cleansing
Remote DBA Services:
Improves MS SQL Database Performance
SQL Server Integration Services:
Business Intelligence -
Copying SQL Server Agent - Jobs in SSMS - 2012
Hi,
I am using SQL 2012 version.
when i try to copy the existing sql agent job (job "X") (using, Script Job As--> Create To--> New query window) and paste it into different database it is giving me some errors as below. (this method is working fine with SQL 2005, but not
with 2012)
Error :
@schedule_uid is not a parameter for procedure sp_add_jobschedule.
Any other way of copying sql agent job in SQL 2012 ???
ThanksSee the below article which speaks about behavior changes in sql 2012
http://technet.microsoft.com/en-us/library/ms143359.aspx
it has section as below
Changes to Behavior in Scripting a SQL Server Agent Task
In SQL Server 2012, if you create a new job by copying the script from an existing job, the new job might inadvertently affect the existing job. To create a new job using the script from an
existing job, manually delete the parameter @schedule_uid which is usually the last parameter of the section which creates the job schedule in the existing job. This will create a new independent schedule for
the new job without affecting existing jobs.
Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs -
Transfer SQL Server Objects Timeout
Hello
I have created a Transfer SQL Server Objects Task with the following settings:
DropObjectsFirst = True
CopyData = True
CopySchema = True
CopyAllObjects = False
TablesList = (1 table in collection)
CopyIndexes = True
It copies a large table (13 million rows). The data transfers across fine, however it fails when trying to create the indexes giving the error "Timeout expired. The timeout period elapsed prior to
completion of the operation or the server is not responding.The statement has been terminated."
I can however create these indexes in SSMS either using T-SQL or using the GUI with no problem. What could be causing this timeout?
ThanksYou will need to use CopyIndexes = False
Then an extra script to add the index
I suspect that the target may have a slow disk subsystem yet being a Standard SQL Server where the indexing is resource consuming and the built in time out (that you cannot override) is not long enough.
Arthur
MyBlog
Twitter -
How to convert from SQL Server table to Flat file (txt file)
I need To ask question how convert from SQL Server table to Flat file txt file
Hi
1. Import/Export wizened
2. Bcp utility
3. SSIS
1.Import/Export Wizard
First and very manual technique is the import wizard. This is great for ad-hoc and just to slam it in tasks.
In SSMS right click the database you want to import into. Scroll to Tasks and select Import Data…
For the data source we want out zips.txt file. Browse for it and select it. You should notice the wizard tries to fill in the blanks for you. One key thing here with this file I picked is there are “ “ qualifiers. So we need to make
sure we add “ into the text qualifier field. The wizard will not do this for you.
Go through the remaining pages to view everything. No further changes should be needed though
Hit next after checking the pages out and select your destination. This in our case will be DBA.dbo.zips.
Following the destination step, go into the edit mappings section to ensure we look good on the types and counts.
Hit next and then finish. Once completed you will see the count of rows transferred and the success or failure rate
Import wizard completed and you have the data!
bcp utility
Method two is bcp with a format file http://msdn.microsoft.com/en-us/library/ms162802.aspx
This is probably going to win for speed on most occasions but is limited to the formatting of the file being imported. For this file it actually works well with a small format file to show the contents and mappings to SQL Server.
To create a format file all we really need is the type and the count of columns for the most basic files. In our case the qualifier makes it a bit difficult but there is a trick to ignoring them. The trick is to basically throw a field into the
format file that will reference it but basically ignore it in the import process.
Given that our format file in this case would appear like this
9.0
9
1 SQLCHAR 0 0 """ 0 dummy1 ""
2 SQLCHAR 0 50 "","" 1 Field1 ""
3 SQLCHAR 0 50 "","" 2 Field2 ""
4 SQLCHAR 0 50 "","" 3 Field3 ""
5 SQLCHAR 0 50 ""," 4 Field4 ""
6 SQLCHAR 0 50 "," 5 Field5 ""
7 SQLCHAR 0 50 "," 6 Field6 ""
8 SQLCHAR 0 50 "," 7 Field7 ""
9 SQLCHAR 0 50 "n" 8 Field8 ""
The bcp call would be as follows
C:Program FilesMicrosoft SQL Server90ToolsBinn>bcp DBA..zips in “C:zips.txt” -f “c:zip_format_file.txt” -S LKFW0133 -T
Given a successful run you should see this in command prompt after executing the statement
Starting copy...
1000 rows sent to SQL Server. Total sent: 1000
1000 rows sent to SQL Server. Total sent: 2000
1000 rows sent to SQL Server. Total sent: 3000
1000 rows sent to SQL Server. Total sent: 4000
1000 rows sent to SQL Server. Total sent: 5000
1000 rows sent to SQL Server. Total sent: 6000
1000 rows sent to SQL Server. Total sent: 7000
1000 rows sent to SQL Server. Total sent: 8000
1000 rows sent to SQL Server. Total sent: 9000
1000 rows sent to SQL Server. Total sent: 10000
1000 rows sent to SQL Server. Total sent: 11000
1000 rows sent to SQL Server. Total sent: 12000
1000 rows sent to SQL Server. Total sent: 13000
1000 rows sent to SQL Server. Total sent: 14000
1000 rows sent to SQL Server. Total sent: 15000
1000 rows sent to SQL Server. Total sent: 16000
1000 rows sent to SQL Server. Total sent: 17000
1000 rows sent to SQL Server. Total sent: 18000
1000 rows sent to SQL Server. Total sent: 19000
1000 rows sent to SQL Server. Total sent: 20000
1000 rows sent to SQL Server. Total sent: 21000
1000 rows sent to SQL Server. Total sent: 22000
1000 rows sent to SQL Server. Total sent: 23000
1000 rows sent to SQL Server. Total sent: 24000
1000 rows sent to SQL Server. Total sent: 25000
1000 rows sent to SQL Server. Total sent: 26000
1000 rows sent to SQL Server. Total sent: 27000
1000 rows sent to SQL Server. Total sent: 28000
1000 rows sent to SQL Server. Total sent: 29000
bcp import completed!
BULK INSERT
Next, we have BULK INSERT given the same format file from bcp
CREATE TABLE zips (
Col1 nvarchar(50),
Col2 nvarchar(50),
Col3 nvarchar(50),
Col4 nvarchar(50),
Col5 nvarchar(50),
Col6 nvarchar(50),
Col7 nvarchar(50),
Col8 nvarchar(50)
GO
INSERT INTO zips
SELECT *
FROM OPENROWSET(BULK 'C:Documents and SettingstkruegerMy Documentsblogcenzuszipcodeszips.txt',
FORMATFILE='C:Documents and SettingstkruegerMy Documentsblogzip_format_file.txt'
) as t1 ;
GO
That was simple enough given the work on the format file that we already did. Bulk insert isn’t as fast as bcp but gives you some freedom from within TSQL and SSMS to add functionality to the import.
SSIS
Next is my favorite playground in SSIS
We can do many methods in SSIS to get data from point A, to point B. I’ll show you data flow task and the SSIS version of BULK INSERT
First create a new integrated services project.
Create a new flat file connection by right clicking the connection managers area. This will be used in both methods
Bulk insert
You can use format file here as well which is beneficial to moving methods around. This essentially is calling the same processes with format file usage. Drag over a bulk insert task and double click it to go into the editor.
Fill in the information starting with connection. This will populate much as the wizard did.
Example of format file usage
Or specify your own details
Execute this and again, we have some data
Data Flow method
Bring over a data flow task and double click it to go into the data flow tab.
Bring over a flat file source and SQL Server destination. Edit the flat file source to use the connection manager “The file” we already created. Connect the two once they are there
Double click the SQL Server Destination task to open the editor. Enter in the connection manager information and select the table to import into.
Go into the mappings and connect the dots per say
Typical issue of type conversions is Unicode to non-unicode.
We fix this with a Data conversion or explicit conversion in the editor. Data conversion tasks are usually the route I take. Drag over a data conversation task and place it between the connection from the flat file source to the SQL Server destination.
New look in the mappings
And after execution…
SqlBulkCopy Method
Sense we’re in the SSIS package we can use that awesome “script task” to show SlqBulkCopy. Not only fast but also handy for those really “unique” file formats we receive so often
Bring over a script task into the control flow
Double click the task and go to the script page. Click the Design script to open up the code behind
Ref.
Ahsan Kabir Please remember to click Mark as Answer and Vote as Helpful on posts that help you. This can be beneficial to other community members reading the thread. http://www.aktechforum.blogspot.com/ -
Hi
I am in need of SCCM 2012 complete maintenance task Manual as well as Scheduled maintenance task document. Moreover the
link for SQL 2008 maintenance task document. If anybody is having the link for these please let me know it would be very helpful for me.I will be very thankful for this.
Please let me know some link on below topics also.
How to check Distribution Manager issues , Clean Configuration Manager inboxes on sites , Intermittent Proxy Management Point connection issues to SQL , Make site settings consistent between Primary sites
Thanks in advance!!!!!!!!!!!!!!!!!
Regards
GokulnathDuplicate post of
http://social.technet.microsoft.com/Forums/en-US/189e9afe-17e0-4a35-9777-3c20a102960a/sccm-2012-complete-maintenance?forum=configmanagergeneral
http://www.enhansoft.com/
Maybe you are looking for
-
Internal Table to Excel with Column Header line
Hello everyone, I need to download Internal table data to excel with a column header line. My Code is as follows: TYPES: BEGIN OF y_hdr, head(30) TYPE c, END OF y_hdr. Data: t_hdr TYPE STANDARD TABLE OF y_hdr. Fill internal table t_
-
AS/400 (MAPICS) TO ORACLE
This is the problem. I'm passing a table from AS/400(MAPICS) to Oracle using ODI. The problem is that the data is all wrong. The different values for a column should be: IND SIN SIS SUD And I'm getting: C9D5C4 E2C9E2 E2C9D5 E2E4C4 Obviously it's a pr
-
Connection timeout when running web service
I'm running a desktop application which call an a web service every 10 minutes. Every few calls to this web service it fails. (for example: 4 calls to ws works fine but fifth call failed) When executing the application on: windows xp professional (ph
-
Dashboard Prompt - Integer field (material number) - remove commas
Hi all, We have a problem with one number field that added as a prompt in the dashboard. This is an integer field contains Material numbers shows commas and we need to remove commas. Problem is we cannot cast it because we need to keep it as ineteger
-
Since we've updated to 3.0 our corp config's are asking users to reset their passwords daily. Some of these are 3g's, some are 3g S's. The settings on our configs are as follows: Require Password - checked Allow Simple Value - checked 4 min passcode