Fix For Sys.master_files &&<&&> Sys.database_files?

Feb 4, 2008

I had a procedure that created a filegroup and file, did some other work and then (theoretically) renamed the filegroup and file. Well, the DB got locked up the last time I tried to run it and the rollback was only partly successful. I now have a file with one name in master_files and another name in database_files. Is there a spiffy way of fixing this? I'm thinking all I need to do is (re)rename the file.

[Edit]

Some more examinaion shows that this discrepancy only appears on the mirrored server, not the principal.

View 3 Replies


ADVERTISEMENT

Master.sys.master_files WHERE Database_id = 2 &&<&&> Tempdb.sys.database_files

Oct 30, 2007



We had an issue last night where tempdb ran out of space on one of our servers. Upon investigation I found that SSMS was reporting only one data file assigned to tempdb. I knew this couldn't be the case and dove into the system tables to figure out what is going on. I found what appears to be data corruption. There are a number of file records that appear in the master.sys.master_database_files that do not appear in the sys.database_files table in tempdb.

I tried to add files that it showed already existed and they of course errored out. I restarted SQL Server to get tempdb rebuilt and that did not work either.


Has anyone else ever ran into this? What was the resolution?

Here are some queries to demonstrate what I am seeing. Terrible formatting I know, but I don't know of a better way.

/*------------------------

select * from master.sys.master_files where database_id = 2

select * from tempdb.sys.database_files

------------------------*/

database_id file_id file_guid type type_desc data_space_id name physical_name state state_desc size max_size growth is_media_read_only is_read_only is_sparse is_percent_growth is_name_reserved create_lsn drop_lsn read_only_lsn read_write_lsn differential_base_lsn differential_base_guid differential_base_time redo_start_lsn redo_start_fork_guid redo_target_lsn redo_target_fork_guid backup_lsn

----------- ----------- ------------------------------------ ---- ------------------------------------------------------------ ------------- -------------------------------------------------------------------------------------------------------------------------------- ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----- ------------------------------------------------------------ ----------- ----------- ----------- ------------------ ------------ --------- ----------------- ---------------- --------------------------------------- --------------------------------------- --------------------------------------- --------------------------------------- --------------------------------------- ------------------------------------ ----------------------- --------------------------------------- ------------------------------------ --------------------------------------- ------------------------------------ ---------------------------------------

2 1 NULL 0 ROWS 1 tempdev E:MSSQL$S1MSSQL.2MSSQLDATA empdb.mdf 0 ONLINE 524288 1280000 128000 0 0 0 0 0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL

2 2 NULL 1 LOG 0 templog E:MSSQL$S1MSSQL.2MSSQLDATA emplog.ldf 0 ONLINE 128000 268435456 64000 0 0 0 0 0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL

2 3 01E3A12D-9CC1-44B6-B077-947C45BD5FDC 0 ROWS 1 tempdb_Data_01 K:MSSQL$S1Data empdb empdb_Data_01.ndf 0 ONLINE 524288 -1 0 0 0 0 0 0 50000000011100001 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL

2 4 4E91B5E8-1EE9-4DA1-985F-A37CB7262BC6 0 ROWS 1 tempdb_Data_02 K:MSSQL$S1Data empdb empdb_Data_02.ndf 0 ONLINE 524288 -1 0 0 0 0 0 0 50000000013400001 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL

2 5 125B73CC-A6EB-464E-A8B8-50269EFD1311 0 ROWS 1 tempdb_Data_03 K:MSSQL$S1Data empdb empdb_Data_03.ndf 0 ONLINE 524288 -1 0 0 0 0 0 0 50000000015700001 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL

2 6 6C4CDA80-4AF0-42FE-BFCF-4E6AEF97956A 0 ROWS 1 tempdb_Data_04 K:MSSQL$S1Data empdb empdb_Data_04.ndf 0 ONLINE 524288 -1 0 0 0 0 0 0 50000000018000001 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL

2 7 360F5EE6-5207-402E-BFFC-88F2B4532DD2 0 ROWS 1 tempdev_11 S:MSSQLDATATEMP empdev_11.ndf 0 ONLINE 512000 1280000 128000 0 0 0 0 0 1347000000109400212 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL

2 8 60F262B1-32AC-433C-95CE-8450BBFA2247 0 ROWS 1 tempdev_12 S:MSSQLDATATEMP empdev_12.ndf 0 ONLINE 512000 1280000 128000 0 0 0 0 0 1348000000169600151 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL

2 9 A18FA498-37A6-4A52-ABA6-C915FD50123E 0 ROWS 1 tempdev_13 S:MSSQLDATATEMP empdev_13.ndf 0 ONLINE 512000 1280000 128000 0 0 0 0 0 1349000000001600060 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL

2 10 2DC2BCCC-3DD8-45D3-B454-5DB88D0B6783 0 ROWS 1 tempdb_Data_05 K:MSSQL$S1Data empdb empdb_Data_05.ndf 0 ONLINE 524288 1024000 65536 0 0 0 0 0 50000000020400001 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL

2 11 06A09B39-09C7-41C6-B11A-BEC1785039B0 0 ROWS 1 tempdb_Data_06 K:MSSQL$S1Data empdb empdb_Data_06.ndf 0 ONLINE 524288 1024000 65536 0 0 0 0 0 50000000022700001 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL

2 12 14F1019E-B3FE-4B7C-827B-880D3E0C430C 0 ROWS 1 tempdev2 I:MSSQLDATATEMP empdev2.ndf 0 ONLINE 256000 640000 65536 0 0 0 0 0 103000000037600078 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL

2 13 743D3EC0-8011-4ECC-8CA6-256C65B37FC5 0 ROWS 1 tempdev3 I:MSSQLDATATEMP empdev3.ndf 0 ONLINE 256000 640000 65536 0 0 0 0 0 103000000043000001 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL

2 14 968C0C01-95C9-4EA2-97B6-0DEFBBB8FEB5 0 ROWS 1 tempdev4 J:MSSQLDATATEMP empdev4.ndf 0 ONLINE 256000 640000 65536 0 0 0 0 0 108000000039000001 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL

2 15 D4551A7F-3998-41E3-81B5-627168CBE77A 0 ROWS 1 tempdev5 J:MSSQLDATATEMP empdev5.ndf 0 ONLINE 256000 640000 65536 0 0 0 0 0 108000000041400001 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL

2 16 701E5614-E61C-46CB-8D23-F8726B6B1F4F 0 ROWS 1 tempdev6 S:MSSQLDATATEMP empdev6.ndf 0 ONLINE 256000 640000 65536 0 0 0 0 0 114000000013600081 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL

2 17 B4AB50DF-8004-4CBA-B97F-683BD8791FF4 0 ROWS 1 tempdev7 S:MSSQLDATATEMP empdev7.ndf 0 ONLINE 256000 640000 65536 0 0 0 0 0 114000000019200001 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL

2 18 C0A50693-6311-4F33-B20B-6C030CC4F65F 0 ROWS 1 tempdev_14 S:MSSQLDATATEMP empdev_14.ndf 0 ONLINE 512000 1280000 128000 0 0 0 0 0 1349000000279900070 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL

2 19 800B86A7-142F-46C9-984F-8673CEFE2DDD 0 ROWS 1 tempdev_01 S:MSSQLDATATEMP empdev_01.ndf 0 ONLINE 512000 -1 128000 0 0 0 0 0 1350000000553600232 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL

2 20 4A008D1B-89E1-4F07-AB5C-CADBFB6ABE44 0 ROWS 1 tempdev01 F:MSSQLDATA empdb empdev01.ndf 0 ONLINE 524288 -1 128 0 0 0 0 0 78000000008100001 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL

2 21 B6B63467-4179-47FD-A226-58639B92F402 0 ROWS 1 tempdev03 T:MSSQLDATATEMP empdev03.ndf 0 ONLINE 524288 -1 0 0 0 0 0 0 234000000253600164 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL

2 22 2A075CBA-C600-47D9-B6B1-8231743EC5AF 0 ROWS 1 tempdev04 T:MSSQLDATATEMP empdev04.ndf 0 ONLINE 524288 -1 128 0 0 0 0 0 234000000262600001 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL

2 23 EDAFB1FB-3B3D-4F7E-B335-8056F2FA9EAD 0 ROWS 1 tempdev1 F:MSSQL$S1DATA empdb empdev1.ndf 0 ONLINE 524288 -1 0 0 0 0 0 0 453000006813300252 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL

2 27 1BFE36F9-B621-4B7C-99C8-0C262ADFFEF9 0 ROWS 1 tempdev02 F:MSSQLDATA empdb empdev02.ndf 0 ONLINE 524288 -1 0 0 0 0 0 0 430000003795400001 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL

2 29 7C8D9FDF-E2D9-4274-BC3D-B2EC060C4B39 0 ROWS 1 tempdev_02 S:MSSQLLOGTEMPDB empdev_02.ndf 0 ONLINE 524288 -1 0 0 0 0 0 0 4030000039691100043 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL

2 31 60973FF9-A35F-433C-9E58-D29F00E4D5A7 0 ROWS 1 tempdev_03 S:MSSQLLOGTEMPDB empdev_03.ndf 0 ONLINE 524288 -1 0 0 0 0 0 0 4033000048392400207 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL

2 32 506E7E19-4D0A-47D8-A687-C9658500F367 0 ROWS 1 tempdev_04 S:MSSQLDATATEMP empdev_04.ndf 0 ONLINE 524288 -1 0 0 0 0 0 0 4033000048449300130 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL

2 33 4DFD4A82-FD5C-4CEE-8939-C01C596B3714 0 ROWS 1 tempdev_05 S:MSSQLDATATEMP empdev_05.ndf 0 ONLINE 524288 -1 0 0 0 0 0 0 4033000048515100001 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL

2 34 B6A34F7D-7FBD-460F-B6FF-ACED575FE2D4 0 ROWS 1 tempdev _06 S:MSSQLDATATEMP empdev _06.ndf 0 ONLINE 524288 -1 0 0 0 0 0 0 4033000048659000118 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL

2 35 4B33C871-B52E-4514-8EBB-E856F151A96D 0 ROWS 1 tempdev_07 S:MSSQLDATATEMP empdev_07.ndf 0 ONLINE 524288 -1 0 0 0 0 0 0 4033000049131800087 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL

2 36 40575107-6C34-408A-BF04-DDF7D71935BE 0 ROWS 1 tempdev_08 S:MSSQLDATATEMP empdev_08.ndf 0 ONLINE 524288 -1 0 0 0 0 0 0 4033000049137600001 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL

2 37 C1DCC4CF-740A-4EB6-AF2E-7B105477251F 0 ROWS 1 tempdev_09 S:MSSQLDATATEMP empdev_09.ndf 0 ONLINE 524288 8192000 524288 0 0 0 0 0 4035000024325400202 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL

(32 row(s) affected)


file_id file_guid type type_desc data_space_id name physical_name state state_desc size max_size growth is_media_read_only is_read_only is_sparse is_percent_growth is_name_reserved create_lsn drop_lsn read_only_lsn read_write_lsn differential_base_lsn differential_base_guid differential_base_time redo_start_lsn redo_start_fork_guid redo_target_lsn redo_target_fork_guid backup_lsn

----------- ------------------------------------ ---- ------------------------------------------------------------ ------------- -------------------------------------------------------------------------------------------------------------------------------- ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----- ------------------------------------------------------------ ----------- ----------- ----------- ------------------ ------------ --------- ----------------- ---------------- --------------------------------------- --------------------------------------- --------------------------------------- --------------------------------------- --------------------------------------- ------------------------------------ ----------------------- --------------------------------------- ------------------------------------ --------------------------------------- ------------------------------------ ---------------------------------------

1 NULL 0 ROWS 1 tempdev E:MSSQL$S1MSSQL.2MSSQLDATA empdb.mdf 0 ONLINE 524288 1280000 128000 0 0 0 0 0 NULL NULL NULL NULL 95000000084000037 11815719-7EBA-453D-B93C-1CA083FADA76 2007-10-30 10:00:02.263 NULL NULL NULL NULL NULL

2 NULL 1 LOG 0 templog E:MSSQL$S1MSSQL.2MSSQLDATA emplog.ldf 0 ONLINE 128000 268435456 64000 0 0 0 0 0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL

(2 row(s) affected)

View 7 Replies View Related

Could Not Locate File 'xxx_Log' For Database 'master' In Sys.database_files

Nov 12, 2007

Hi All,

I am truncating Transactionlog€¦ following the steps mentioned in MSKB.. what is the problem?



Use master
Go

Backup log xxx with truncate_only
go
Dbcc shrinkfile(xxx_Log)
Go

Msg 8985, Level 16, State 1, Line 1
Could not locate file 'xxx_Log' for database 'master' in sys.database_files.
The file either does not exist, or was dropped.


Please help me.

Thanks in advance

View 31 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved