Disk Space

  • I am able to pull all database file from each server by using this..

    -- creates a table DatabaseFiles

    IF OBJECT_ID('DatabaseFiles') IS NULL

    BEGIN

    SELECT TOP 0 * INTO DatabaseFiles

    FROM sys.database_files

    ALTER TABLE DatabaseFiles

    ADD CreationDate DATETIME DEFAULT(GETDATE())

    END

    -- inserts data into table DatabaseFiles

    EXECUTE sp_msforeachdb 'INSERT INTO DatabaseFiles SELECT *, GETDATE() FROM [?].sys.database_files'

    --slect data from SELECT * FROM DatabaseFiles

    SELECT name,physical_name,size FROM DatabaseFiles where type_desc<>'log'

    Now I want to list all database files from the disk and then I need to get

    List from the Disk NOT IN (DatabaseList) that will be my final list of files to delete.Now How do i list the files from disks.

    Once i get my list i want to delete them from the DOS prompt as i cudnt delete some files directly because it gives me an error saying the file is used by some program.

    THanks

Viewing post 31 (of 30 total)

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