Detach/attach Move Fails To Bring Over Roles & Logins Correctly
May 23, 2001
A database move was accomplished by detaching the database from the legacy server and attaching it to the new server. The servers ran NT 4, SP6a, SQL 7 SP2. The new server had the same name and IP as the old server.
However that process (detach attach) does not bring over the users (who had access to the database on the legacy systems) correctly.
Under databases, roles the users existed. Under security, logins they did not.
We were obliged to drop the roles and recreate the logins and assign new roles. In the case of an NT user group we were unable to drop it. We had to create a new one and add the users to that group under User Manager.
So far I have not found anything that deals with the user account/role problem.
We have to move a similar database tonight. Do any of you know of an alternative "move" that brings the user roles/logins across correctly?
Thanks in advance.
View 4 Replies
ADVERTISEMENT
Mar 23, 2006
I created a db in ssms; I detached it and moved it into a subdirectory of a vb app. Now sql server says the database does not exist. If I recreate the database in smss, I can run an INSERT INTO using that db as the destination. However, this only works if I keep it in the mssql data directory. How can I move it to the apps subdirectory so that it can be deployed with the app and still work? BTW, I also tried creating the databases in VS2005 with same results.
This is the connection string (tried this and non-express version with same results):
strDbConn = "Provider=SQLNCLI;Data Source=.SQLEXPRESS; AttachDbFilename=" & DbPath & ";User Instance=True;Trusted_Connection=Yes"
This is the sql statement:
sqlCopyTable = "SELECT * INTO "
sqlCopyTable = sqlCopyTable & CleanDbName & ".dbo." & CleanTableName
sqlCopyTable = sqlCopyTable & " FROM " & RawTableName & ";"
ConnectSQLExpress RawDbPath, "Source"
ConnectSQLExpress CleanDbPath, "Destination"
SourceDbConn.Execute sqlCopyTable
View 1 Replies
View Related
May 9, 2001
This might sound dumb, but BOL says you can use detach/attach to "MOVE" a database but can you detach and copy the files to a new server, leaving the files on the original and running the attach on the new and the old? (effectually a way to copy)? I know how to use data transformations/import,export was curious?
Help appreciated!!
View 4 Replies
View Related
Mar 5, 2006
Hello,
I am new user of SQL Server. I have some problems with these words. I want to make my database works in my specified permissions. I will specify permissions with schemas and these schema wants an owner. I want this owner should be my user. When creating a user it needs a valid login. I am selecting my login and it occurs and error says this login has an different user. I am specifying permissions with roles. But i can't make association all of them. I hope i told my problem to you as well. If you explain these words to me and tell me how can i do my database's works with my own schemas, users and roles i'll be grateful. Thanks for advices.
Happy coding...
View 4 Replies
View Related
Aug 11, 2004
Hello,
MSSQLSERVER VER : 2000
Using - Attach and Detach Database to move the database from one Server to another server.
I did detached the database from Production and attached my test server, everything OK
Questions about - syslogins & sysdevices data dictionary tables
1. When I select * from sysdevices on production it shows all the database name size,phyname etc. After attaching to my test server I cannot see these things.. I know because it different master database but, how do I fix this.
2. syslogins - is there way to move all the syslogins after attaching to test server.
Please let me know if you guys have done anything on this.
Thanks.
Regards,
K.
View 2 Replies
View Related
May 23, 2006
How I can detach from DB and validate it?
(I mean check if it is detached or not)
Is there any why to return a value from sp_detach_db in C++?
(may a cross posting, please check under developer posts)
View 1 Replies
View Related
Oct 10, 2006
I've just created ASPNETDB database with ASP.NET Security. Now, I want to send this db to orther computer.First, I detached this db, then when I used attach database in that computer, there is an error :Error 602: Could not find row in sysindexes for database ID 8, object ID 1, indext ID 1. RUN DBCC CHECKTABLE on sysindexes. Please help me .Thank.
View 3 Replies
View Related
Jan 4, 2002
I have developed a db on a local machine (98) and would like to move it to another machine running nt 4 where it will function as a production db. I am mapped to see the other server (called "labnt"). The drive on "labnt" is partitioned, with the c drive holding programs, and the e drive designed to hold the data.
I would like to move the db (called SNB01) to the MSSQLData subdirectory on the e-drive. I have tried the following sproc to detach:
EXEC sp_detach_db 'SNB01', 'true'
And the following to reattach:
EXEC sp_attach_db @dbname = 'SNB01',
@filename1 = 'labntewmssqldataSNB01_Data.mdf',
@filename2 = 'labntewmssqldataSNB01_log.ldf'
The above path was given me by our network admin guy.
QA gives the following error:
Server: Msg 5105, Level 16, State 4, Line 1
Device activation error. The physical file name 'labntewmssqldataSNB01_Data.mdf' may be incorrect.
Please help. I am thrashing about. D. Lewis
View 7 Replies
View Related
Nov 11, 2001
In SQL when I right click on Databases the option to use Attach/Detach is greyed out. I don't understand why. I'm running SQL 7 on Win2000 server and I have Win2k at sp2 and SQL at sp2.
Help please!
Chris
View 1 Replies
View Related
Sep 23, 2004
Hi folks,
Is it possible to detach a database on SQL Server 2000 and attach it to SQL Server 7 ? I know it's fine to do the other way around. Also, any adverse effects I should be aware of ?
Thanks
View 3 Replies
View Related
Nov 5, 2007
Hello, everyone:
I want to move a database instance (about 50 user databases) to another server, both are running SQL Server 2000. Which method is better, retore from backup files or detach/attach? Some papers said restore amybe cause incorrect login and password transfer. Is it true?
Thanks
ZYT
View 5 Replies
View Related
Jan 2, 2004
An original database (eg A.mdf) is imported/exported to a different server as named B.mdf. The detach of A.mdf was unitentionally not done. It seems that both the database were updated.
A.mdf - 123000KB 25/12/2003
A_log.ldf - 14000KB 25/12/2003
B.mdf - 67000KB 25/12/2003
B_log.ldf - 1024KB 25/12/2003
In this case, which mdf & ldf should be the correct database?
If I I remove A.mdf database by "detach", will B.mdf database work?
SQL server 2000 and SP3 installed.
Assistance is appreciated
View 9 Replies
View Related
Jun 9, 2008
Hello Experts, How Can i Attach and Detach my MDf file to an instance of SQL server 2005 Programatically or by T-SQL :)
ElmasryA1
View 1 Replies
View Related
Mar 21, 2002
What problems could be invoked by stopping SQL Server and copying a user databases data and log files and pasting these files over existing files on another machine.
Ex:
MyDB on Server1
MyDB on Server2
Stop SQL Server Server1 and Server2
Copy Server1.MyDB files
Over write Server2.MyDB files
Start SQL Server Server1 and Server2
Make sense. This scenerio seems to work but wonder what side affects could result.
Any comments would be helpful!!
View 1 Replies
View Related
Jun 9, 2008
Hello Professionals, How can i attach and detach my mdf file to an instanse of sql 2005 programatically or by T-SQL
ElmasryA1
View 1 Replies
View Related
Sep 8, 2005
Alan writes "Is it possible to create scripts which can be started remotely
to attach and detach databases into SQLExpress 2005.
If so how."
View 1 Replies
View Related
May 21, 2007
Hi, all experts here,
Thank you for your kind attention.
I am having a question on detach/attach database. As when we detach/attach database, we have to copy both of .mdf and .ldf files to the targeted filepaths, in this case, when the database is large, then it takes a pretty while to copy the physical files though. In this case, I dont really see the point to detach/attach the database? Instead, backup/restore may be faster? (also, as detach the database, the files has to be taken offline)
Just confused about the way we trasfer database files with detach/attach. I am looking forward to hearing from you shortly for any advices for that.
With best regards,
Yours sincerely,
View 3 Replies
View Related
Apr 15, 2008
Hello all,
We are planning to change the location of the log files from my production server. We have setup the mirroring also for those databases. I know for the databases without mirroring job i could detach the database, copy the log file to the target location and attach the database with the new logfile location. But for the mirroring databases I don't have any idea how to do that. Could some body guide me thorugh the process on how to do this task? thank you very much for all your help!
View 16 Replies
View Related
Jun 18, 2002
We have a hardware problem and will be getting a new RAID HDD system.
I've asked the tech onsite to backup and detach the MSDB and then reattach.
Can this be done, I expect to have him detach the new MSDB when MSSQL is re-installed. Then replace that file with the previously detached version and run reattach from QA(?)
Will this work.
TIA
JeffP...
View 3 Replies
View Related
Jan 30, 2000
I have similar question like Tim asked but from a different angle. I wish I pose my question here too anybody can help answer this.
I tried to use detach and attach method to do backup of the user database (not master, maybe we can do master too) on another server, but it looks the login and permission credential would not go together. I come to see different kind of message I tried to login as non-sa user after I attatch the database on different machine. I would be denied for SQL timeout. It looks like loginand user dose not exist in new server because I did not move master database too. But even if I recreate the login when I tried to associate user with login I will see a message saying user or role already exist in database. If I go back to check the user it did not show up on enterprize manager on that database.
So my question would be
1). how to move login and user together with user database.
2) do we have to move master database where the login infor. reside
3). if so how to move master database from one server to another when other server already have master database exist?
Hope somebody can answer this.
Wislon
View 2 Replies
View Related
Mar 20, 2014
We have 5 databases which will sum up to 8+TB, housed in our EDW server. We are planning to migrate to another storage system for better performance.
I am planning Full backup and Differential backup and detach the DB and restore the DB in the new storage system.
Or should I detach,copy the data and log file and attach the files, will this approach have any advantages ?
View 5 Replies
View Related
Jul 15, 2006
I'm trying to see the differences between Backup/Restore and Attach/Detach. I backup and detach a database from SQL Server 2000 SP3 and then attach and restore it to SQL Server 2005 SP1.
The differences I noticed are:
1. The restored database has a much larger initial size (database size is same) for data and log.
2. The attached database has a last backup date
3. If the backup is restored over a database, the restored database is showing owned by the database owner of the database restored over but syslogins and sysusers do not match.
I don't understand why #1 happens.
Are there any other differences between Backup/Restore and Attach/Detach?
Thanks,
Peter
View 2 Replies
View Related
May 16, 2008
I have been struggling with this for a while and cannot get it right. I have read countless articles on the internet as well as MSDN documentation about SQL Server 2005 and no success so far.
What I want is a database with multiple SCHEMAS, DATABASE ROLES and USERS in order to have a finer grade of security to access the various objects.
My schemas are (in order to simplify the situation and provide an example of the setup):
- [dbo] the standard DBO schema which is always default. Contains public objects.
- [com] a special module integrated into the system
- [ofc] contains objects used by back-office only
- [aud] contains objects used for auditing, etc.
Each of these schemas has their fair share of tables, views, functions and stored procedures which have been created appropriately (i.e. CREATE TABLE [ofc].[Addresses]), in other words prefixed by the name of the schema to which they belong.
Then I have created various database roles (don't confuse them with SQL2005 application roles) as follows:
- PublicRole mostly used for viewing, no data alterations
- WorkerRole used by front end processes that need write access to data in [dbo] and [aud]
- OfficeRole used by back-office for dealing with backoffice data (basically [ofc], [aud] stuff)
- AdminRole used by application administrator
Each of these database roles has been defined with owner 'dbo', none of them own any schemas. And last but not least to each of these roles I have selected the above named schemas (dbo, ofc, aud) as securables and for each of those securables schemas I have then given the correct set of GRANT/DENY on the Alter, Control, Delete, Execute, Insert, References, Select, Update, Take ownership and View definition.
As an example, the PublicRole role has been given the following permissions (Y=GRANT, N=DENY):
Table #1 of Application Permissions [dbo] [com] [ofc] [aud]Alter N N N N
Control N N N N Delete N N N N Execute Y Y N Y Insert N N N Y References Y Y N Y Select Y Y N Y Update N N N Y Take ownership N N N N View definition N N N N
And I have the following minimum set of database users defined (the server login has the same name):
- upublic, assigned to PublicRole
- uworker, assigned to WorkerRole
- uoffice, assigned to OfficeRole
- uadmin, assigned to AdminRole
As I understand when I assign these users to a particular custom Database Role, the users inherit the permissions granted to THAT role thus liberating me from having to assign the permissions to each and every user account on the same role.
What I expected was that when I logged in to the database with the upublic user account I would at least be able to view (SELECT at least) ALL the objects with the exception of those in th e[ofc] schema. Unfortunately the account is not able to access ANYTHING at all, I get an error like
"The SELECT permission has been denied on object XYZ, database DB, schema 'dbo'"
So, when I use Management Studio to look at the properties I selected the PublicRole and it showed the upublic user as a member of the role (Members of this role). So far so good.
Then when I switch to the Securables page for this role it shows all the schemas I defined and for each of them the same list shown in Table #1 except it has two lines for each permission, the first for Grantor dbo and the second for Grantor upublic. The first has the same permissions I assigned to the role (as shown on Table #1) but the 2nd does not show a checkmark on either GRANT or DENY!!! For example ([x] = checked, [ ] unchecked):
Table #2 Explicit permissions for Securable
Permission Grantor Grant Grant-with Deny
Select dbo [x] [ ] [ ] Select upublic [ ] [ ] [ ]
What am I doing wrong here? Apparently I then have to repeat the whole grant/deny for EACH and EVERY USER I define when the idea was that I would grant/deny on the database role and every member of that role would inherit those permissions automatically.
View 3 Replies
View Related
Apr 5, 2008
Sql 2005
I want to grate execute permissions on my stored procedures to a role. While creating the role, it asks for "schemas owned by this role".
To me, the schema is merely a namespace that allows you to group objects, but arent schemas such as db_datawriter roles that are central to the db and only admin type users should have ownership of these, correct ?
In a nutshell, I want to:
create a new role and assign a user to that role
with a stored procedure, grant execute permissions to this role
I was confused by the sql 2005 dialog that asks me to take ownership of roles such as db_datawriter, db_datareader etc, wouldnt that mess up other things with the database ?
help ...
I think its time I review all of the above items
role
user
login
schema
View 4 Replies
View Related
Jun 20, 2005
A question on the permissions hierarchy:
Since logins, database users, and database roles are both principals and securables - what does it mean to GRANT permission on a login/user/role to another principal? Does it mean that for a login - you can GRANT permission to EXECUTE AS that login or modify it, for example?
View 3 Replies
View Related
Mar 6, 2000
I use detach/attach method to move database to a new SQL Server 7 on MSCS. The security information was lost in the new server. Database Access permission was gone and I failed to select it again because message showed the database role is already exist. The default databases were also posted incorrectly. Would you please to tell me how to fix this type of peoblem or let me know how to move the login info such as login id, password, database permisson to the new server which locates in a different machine.
Thank you very much.
Rich
View 3 Replies
View Related
Feb 28, 2008
Hi!
I did:
alter database mydb set single_user with rollback immediate;
exec sp_detach_db @dbname='mydb', @keepfulltextindexfile='true';
then I tried to copy files to new location on other drives, same server but got
>>Cannot copy <myfile>: Access is denied
Make sure the disk is not full or write-protected and that the file is not currently in use<<
I also tried rename of file without success.
I also tried with db service stoppet (not preferred) without success.
How to find out, which process locks the files?
Best regards
View 7 Replies
View Related
Jun 25, 2007
I have SQL Server 2005 on a DEV box and I have a linked server on that box.
It has several logins that I would like to move over to our production server when I re-create the linked server.
Now I can export the script to create that linked server, but when I do so it doesn't provide me with the user's login password.
Is there a way to export the password as part of the script so I can move the linked server AND all the users associated to it over to a new server?
View 1 Replies
View Related
Jul 20, 2005
If I detach a database on a server, then attach the database with asingle file only using the data file...will I lose any transactionsthat were in the original log file? There is a debate going on here atwork where some people think that during the detach, transactions inthe log file are saved to the data file.Thanks!
View 4 Replies
View Related
Sep 20, 2004
Folks, i had a database with data and log file on seperate disks. After reboot, i've lost the log file; now i am trying to attache the data file using EM and QA, i get the following error; plz guide:
sp_attach_single_file_db 'production', 'd:production_data.mdf'
Server: Msg 1813, Level 16, State 2, Line 1
Could not open new database 'production'. CREATE DATABASE is aborted.
Device activation error. The physical file name 'D:production_log.LDF' may be incorrect.
Howdy!
View 2 Replies
View Related
Nov 1, 2005
Hi,
I am facing a problem with permissions while creating a database using script (i am using SQL Express database).
I am excuting a script using following command
osql -E -S <servername><instancename> -i <scriptpath> -o <log file name>
It is throwing the below error (copied from log file)
"1> 2> 3> 4> 5> 6> 7> Msg 1802, Level 16, State 4, Server DEV2SMSPUBTOOL, Line 3
CREATE DATABASE failed. Some file names listed could not be created.
Check related errors.
Msg 5123, Level 16, State 1, Server DEV2SMSPUBTOOL, Line 3
CREATE FILE encountered operating system error 5(Access is denied.)
while attempting to open or create the physical file 'C:Program
FilesMicrosoft Publishing ToolDATApubDB_Data.MDF'.
1> 2> 3> Msg 15010, Level 16, State 1, Server DEV2SMSPUBTOOL, Procedure sp_dboption, Line 64
The database 'pubDB' does not exist. Use sp_helpdb to show available
databases."
This problem occurs only if i give "program files" path for creating mdf and ldf files.
But i have admin previliges on the machine.
Can some doby suggest me if any other approach for creating database.
Thanks a lot for help
Krishna.s
View 1 Replies
View Related
Feb 4, 2008
Hi All:
Using SQL Express 2005.
I want to attach some *.mdf files that are located in a folder other than the SQL Server Data folder (for example, D:MyData). If I do so, then I get an error message that the files can not be updated because they are read only.
If I move the files to the SQL ServerData folder then they attach without errors and work fine.
Is there some way I can tell SQL Server to allow the attachments in my other folder as well?
View 7 Replies
View Related