This topic has been archived. It cannot be replied.
-
枫下家园 / 电脑用户 / Can I copy a MDF file from a SQL7 to another one directly and rebuild the database completely?
-mildkiller(M.K.);
2002-9-28
(#772583@0)
-
yes. you can use sp_attach_db to rebuild the database and use sp_change_users_login to update the user info
-yangn(Raymond);
2002-9-28
(#772592@0)
-
Really!! Could you pls give me more details? Thanks a lot! May I have your number?
-mildkiller(M.K.);
2002-9-28
(#772605@0)
-
看Online Book里面有例子,copy paste出来就可以了。
-johnnyhatesjazz(Rock and Roll);
2002-9-28
(#772619@0)
-
1. sp_attach_db @dbname='database name',@filename1='location of .mdf'
2. use new_db
exec sp_change_users_login 'report'
exec sp_change_users_login 'update_one','user_name','login_name'
-yangn(Raymond);
2002-9-28
(#772631@0)
-
dettach first, then use OS command to move the mdf ldf file to the new location, then re-attach (execute the store procedure stated upstairs)
-unix_guy(一年了);
2002-9-28
(#772627@0)
-
Thanks everybody above! Another question, how to rebuild complete connection for existing ASP files to access SQL? I've migrated SQL database to the new srv, but how to recover all security such like login users?
-mildkiller(M.K.);
2002-9-28
(#772718@0)
-
since the security setting is stored in master db, if you don't restore master from the previous server, you have to manually set up login on the new server anduse sp_change_users_login to map the user in db and the login id in security setting.
-yangn(Raymond);
2002-9-28
{85}
(#772736@0)
-
After I restored db completely, I got conflict while I tried to create same login user. It said existing user is already there, but no permit actrually~~
-mildkiller(M.K.);
2002-9-28
(#772807@0)