Showing posts with label tsql. Show all posts
Showing posts with label tsql. Show all posts

Friday, March 30, 2012

Maintenance Plan File Deletion Bug

I have a maintenance plan set to delete files after 1 week. Instead it is deleting everthing older then 1 day. When I view the tsql in the designer, the xp_delete_file string looks correct. Is there anyway to see the exact xp_delete_file string that is actually being executed at run time?

I found the problem.

There is an "off by one" bug using the time unit of measure in "Maintenance" and "Cleanup" tasks.

If you select "Weeks" you get "Days", with "Days" you get "Hours", and "Hours" blows the index.

The patching procedure is a little complicated. Read this:

http://blogs.msdn.com/psssql/archive/2007/04/06/post-sql-server-2005-service-pack-2-sp2-fixes-explained.aspx

What service pack you are on?

There were maintenane related bugs in SP2 so that MS released hot fix on 03/05/2007.

Check the hot fix if you are already on SP2 applied before the hot fix release. If you are on SP1 apply the SP2 down loaded after 03/06/2007 which is hot fix included.

|||

I found out what the problem is.

There is an "off by one" bug where the wrong time unit of measure is being used.

"Hours" are being converted to "Days", Days" are being converted to "Hours", and "Hours" will blow with an invalid index.

This problem exists for "Maintenance Cleanup" tasks and "Clean Up History" tasks.

The fix is a little complicated because there are two versions of sp2 out there.

Read this to figure out the proper fix:

http://blogs.msdn.com/psssql/archive/2007/04/06/post-sql-server-2005-service-pack-2-sp2-fixes-explained.aspx

Monday, February 20, 2012

Lsit of sql object owners

Hi,
What tsql statement do i need to run to get a list of all sql objects'
owner?
Thanks
What version of SQL Server are you using?
"Mecn" <mecn@.yahoo.com> wrote in message
news:Oi7rmRmlIHA.3876@.TK2MSFTNGP06.phx.gbl...
> Hi,
> What tsql statement do i need to run to get a list of all sql objects'
> owner?
> Thanks
>
|||SQL2K sp4
"Aaron Bertrand [SQL Server MVP]" <ten.xoc@.dnartreb.noraa> wrote in message
news:03024435-8BF2-4036-84C1-A8EC991B7187@.microsoft.com...
> What version of SQL Server are you using?
>
> "Mecn" <mecn@.yahoo.com> wrote in message
> news:Oi7rmRmlIHA.3876@.TK2MSFTNGP06.phx.gbl...
>
|||SELECT 'Table',TABLE_SCHEMA, TABLE_NAME
FROM INFORMATION_SCHEMA.TABLES
UNION ALL
SELECT 'View',TABLE_SCHEMA, TABLE_NAME
FROM INFORMATION_SCHEMA.VIEWS
UNION ALL
SELECT 'Procedure/Function',ROUTINE_SCHEMA, ROUTINE_NAME
FROM INFORMATION_SCHEMA.ROUTINES;
"Mecn" <mecn@.yahoo.com> wrote in message
news:eaSwkJnlIHA.3636@.TK2MSFTNGP02.phx.gbl...
> SQL2K sp4
>
> "Aaron Bertrand [SQL Server MVP]" <ten.xoc@.dnartreb.noraa> wrote in
> message news:03024435-8BF2-4036-84C1-A8EC991B7187@.microsoft.com...
>
|||It worded,
Thanks a lot
"Aaron Bertrand [SQL Server MVP]" <ten.xoc@.dnartreb.noraa> wrote in message
news:632943B2-7BD5-45C3-9C61-E28CA44C5A3D@.microsoft.com...
> SELECT 'Table',TABLE_SCHEMA, TABLE_NAME
> FROM INFORMATION_SCHEMA.TABLES
> UNION ALL
> SELECT 'View',TABLE_SCHEMA, TABLE_NAME
> FROM INFORMATION_SCHEMA.VIEWS
> UNION ALL
> SELECT 'Procedure/Function',ROUTINE_SCHEMA, ROUTINE_NAME
> FROM INFORMATION_SCHEMA.ROUTINES;
>
>
> "Mecn" <mecn@.yahoo.com> wrote in message
> news:eaSwkJnlIHA.3636@.TK2MSFTNGP02.phx.gbl...
>

Lsit of sql object owners

Hi,
What tsql statement do i need to run to get a list of all sql objects'
owner?
ThanksWhat version of SQL Server are you using?
"Mecn" <mecn@.yahoo.com> wrote in message
news:Oi7rmRmlIHA.3876@.TK2MSFTNGP06.phx.gbl...
> Hi,
> What tsql statement do i need to run to get a list of all sql objects'
> owner?
> Thanks
>|||SQL2K sp4
"Aaron Bertrand [SQL Server MVP]" <ten.xoc@.dnartreb.noraa> wrote in message
news:03024435-8BF2-4036-84C1-A8EC991B7187@.microsoft.com...
> What version of SQL Server are you using?
>
> "Mecn" <mecn@.yahoo.com> wrote in message
> news:Oi7rmRmlIHA.3876@.TK2MSFTNGP06.phx.gbl...
>> Hi,
>> What tsql statement do i need to run to get a list of all sql objects'
>> owner?
>> Thanks
>|||SELECT 'Table',TABLE_SCHEMA, TABLE_NAME
FROM INFORMATION_SCHEMA.TABLES
UNION ALL
SELECT 'View',TABLE_SCHEMA, TABLE_NAME
FROM INFORMATION_SCHEMA.VIEWS
UNION ALL
SELECT 'Procedure/Function',ROUTINE_SCHEMA, ROUTINE_NAME
FROM INFORMATION_SCHEMA.ROUTINES;
"Mecn" <mecn@.yahoo.com> wrote in message
news:eaSwkJnlIHA.3636@.TK2MSFTNGP02.phx.gbl...
> SQL2K sp4
>
> "Aaron Bertrand [SQL Server MVP]" <ten.xoc@.dnartreb.noraa> wrote in
> message news:03024435-8BF2-4036-84C1-A8EC991B7187@.microsoft.com...
>> What version of SQL Server are you using?
>>
>> "Mecn" <mecn@.yahoo.com> wrote in message
>> news:Oi7rmRmlIHA.3876@.TK2MSFTNGP06.phx.gbl...
>> Hi,
>> What tsql statement do i need to run to get a list of all sql objects'
>> owner?
>> Thanks
>>
>|||It worded,
Thanks a lot
"Aaron Bertrand [SQL Server MVP]" <ten.xoc@.dnartreb.noraa> wrote in message
news:632943B2-7BD5-45C3-9C61-E28CA44C5A3D@.microsoft.com...
> SELECT 'Table',TABLE_SCHEMA, TABLE_NAME
> FROM INFORMATION_SCHEMA.TABLES
> UNION ALL
> SELECT 'View',TABLE_SCHEMA, TABLE_NAME
> FROM INFORMATION_SCHEMA.VIEWS
> UNION ALL
> SELECT 'Procedure/Function',ROUTINE_SCHEMA, ROUTINE_NAME
> FROM INFORMATION_SCHEMA.ROUTINES;
>
>
> "Mecn" <mecn@.yahoo.com> wrote in message
> news:eaSwkJnlIHA.3636@.TK2MSFTNGP02.phx.gbl...
>> SQL2K sp4
>>
>> "Aaron Bertrand [SQL Server MVP]" <ten.xoc@.dnartreb.noraa> wrote in
>> message news:03024435-8BF2-4036-84C1-A8EC991B7187@.microsoft.com...
>> What version of SQL Server are you using?
>>
>> "Mecn" <mecn@.yahoo.com> wrote in message
>> news:Oi7rmRmlIHA.3876@.TK2MSFTNGP06.phx.gbl...
>> Hi,
>> What tsql statement do i need to run to get a list of all sql objects'
>> owner?
>> Thanks
>>
>>
>