|
|
|
Help!!!
|
|||
|---|---|---|---|
|
#18+
Помогите люди добрые была у нас база MS SQL 7.0 c двумя лог файлами на разных дисках. Сделали sp_deattach_db удалили лог файлы при выполнении sp_attach_single_file_db пишет что имя файла одного лога некорректное и не хочет подключать базу что делать?!!! ... |
|||
|
:
Нравится:
Не нравится:
|
|||
| 06.11.2002, 21:16:44 |
|
||
|
Help!!!
|
|||
|---|---|---|---|
|
#18+
привет. вот, смотри, только я этого ни разу не делал и за последствия ответственности не несу. сделай резервные копии файлов обязательно. Удачи! ============================================ From: "Jasper Smith" <jasper_smith9@hotmail.com> Subject: Re: attaching an MDF without an LDF Date: Tuesday, August 20, 2002 12:22 AM Here's a technique I have used in the past - you need to change the file/database names as this was for a specific case : If you did not detach the database prior to copying it then you will not be able to attach it easily (probably). First thing to try is make sure the folder 'D:\DATA2K\MSSQL$SKINNER2K\DATA\ exists,if not then create it,copy your MDF there and retry your statement If that doesn't work then you're in a bit of trouble but you can try this 1) Make sure you have a copy of PowerDVD301_2_Data.MDF 2) Create a new database called fake (default file locations) 3) Stop SQL Service 4) Delete the fake_Data.MDF and copy PowerDVD301_2_Data.MDF to where fake_Data.MDF used to be and rename the file to fake_Data.MDF 5) Start SQL Service 6) Database fake will appear as suspect in EM 7) Open Query Analyser and in master database run the following : sp_configure 'allow updates',1 go reconfigure with override go update sysdatabases set status=-32768 where dbid=DB_ID('fake') go sp_configure 'allow updates',0 go reconfigure with override go This will put the database in emergency recovery mode 8) Stop SQL Service 9) Delete the fake_Log.LDF file 10) Restart SQL Service 11) In QA run the following (with correct path for log) dbcc rebuild_log('fake','h:\fake_log.ldf') go dbcc checkdb('fake') -- to check for errors go 12) Now we need to rename the files, run the following (make sure there are no connections to it) in Query Analyser (At this stage you can actually access the database so you could use DTS or bcp to move the data to another database .) use master go sp_helpdb 'fake' go /* Make a note of the names of the files , you will need them in the next bit of the script to replace datafilename and logfilename - it might be that they have the right names */ sp_renamedb 'fake','PowerDVD301' go alter database PowerDVD301 MODIFY FILE(NAME='datafilename', NEWNAME = 'PowerDVD301_Data') go alter database PowerDVD301 MODIFY FILE(NAME='logfilename', NEWNAME = 'PowerDVD301_Log') go dbcc checkdb('PowerDVD301') go sp_dboption 'PowerDVD301','dbo use only','false' go use PowerDVD301 go sp_updatestats go 13) You should now have a working database. However the log file will be small so it will be worth increasing its size Unfortunately your files will be called fake_Data.MDF and fake_Log.LDF but you can get round this by detaching the database properly and then renaming the files and reattaching it 14) Run the following in QA sp_detach_db PowerDVD301 --now rename the files then reattach sp_attach_db 'PowerDVD301','h:\dvd.mdf','h:\DVD.ldf' HTH Jasper Smith ... |
|||
|
:
Нравится:
Не нравится:
|
|||
| 06.11.2002, 21:20:28 |
|
||
|
Help!!!
|
|||
|---|---|---|---|
|
#18+
Спасибо! Помогло! мир не без добрых людей. ... |
|||
|
:
Нравится:
Не нравится:
|
|||
| 06.11.2002, 22:44:17 |
|
||
|
|

start [/forum/topic.php?fid=46&fpage=3382&tid=1819003]: |
0ms |
get settings: |
6ms |
get forum list: |
15ms |
check forum access: |
3ms |
check topic access: |
3ms |
track hit: |
30ms |
get topic data: |
8ms |
get forum data: |
2ms |
get page messages: |
47ms |
get tp. blocked users: |
1ms |
| others: | 194ms |
| total: | 309ms |

| 0 / 0 |
