Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Droping or moving old tables Expand / Collapse
Author
Message
Posted Wednesday, March 6, 2013 10:13 PM
SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Tuesday, August 5, 2014 3:32 AM
Points: 190, Visits: 473
How to validate the last updated date for each of the tables.
I want you to check if the tables are updated in real-time

·How to check if the tables going to move or delete have any dependencies.

·Please include any suggestions for how to drop these tables.

The reason for moving or deleting these tables is we are running out of space on that server.
Post #1427765
Posted Wednesday, March 6, 2013 11:34 PM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Yesterday @ 7:34 AM
Points: 7,098, Visits: 12,606
You can check the dependencies of the table using the Catalog Views:

USE AdventureWorks2008R2;
GO
SELECT referencing_schema_name,
referencing_entity_name,
referencing_id,
referencing_class_desc,
is_caller_dependent
FROM sys.dm_sql_referencing_entities('[Person].[PersonPhone]', 'OBJECT');

You can check the index usage stats, but if you yourself have selected from the table your stats will be polluted. These stats are reset after a service restart so if you check these stats after a restart and do not touch the table yourself you might get lucky to know if anyone is accessing it.

USE AdventureWorks2008R2;
GO
SELECT *
FROM sys.dm_db_index_usage_stats
WHERE OBJECT_NAME(object_id) = 'Department'
AND OBJECT_SCHEMA_NAME(object_id) = 'HumanResources';

You may want to setup a Trace to look for queries referencing the table and run it for a few months. Else you could risk it, export the table to a file using bcp and the native data format (fastest), save off the DDL for the table with all indexes and permissions, and drop the table.


__________________________________________________________________________________________________
There are no special teachers of virtue, because virtue is taught by the whole community. --Plato
Post #1427784
Posted Wednesday, March 6, 2013 11:41 PM
SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Tuesday, August 5, 2014 3:32 AM
Points: 190, Visits: 473
Thanks for your reply.
Post #1427786
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse