Maintenance plan task fails

  • Hi

    We have a maintenance plan with two tasks. The first saves the db, the second should shrink the log and looks like:

    backup log mydb with truncate_only

    go

    use mydb

    go

    dbcc shrinkfile(mydb_log, 100)

    go

    The second task fails while dbcc looks in the master db for mydb_log, so the command 'use mydb' doesn't work in the plan. The hole command can be run as query or job successfully.

    What can be done to set another default db?

    Thanks for help.

    Jan

  • Did you try to use another job step and shrink the DB not a a part of the maintenance plan but as a job step of the type of Transact-SQL Script?

    Regards,Yelena Varsha

  • As I sad, with a sql agent job it works. This and also the second plan task are t-sql steps. But in the plan-task you cant choose a db like in a agent job step, you can only choose another connection what I tried.

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply