Showing posts with label cloned. Show all posts
Showing posts with label cloned. Show all posts

Saturday, February 25, 2012

Cloning a SQL 2005 Database

hi,
I have cloned a VM of a SQL Server 2005 database to a new server with a
different name.
I have run the sp_dropserver and sp_addserver commands as well documented to
change the server name within the sql instance to the new cloned server name.
The issue i have is that the logins on the new cloned server still contains
the local group and local account details from the old machine.
I have renamed the groups and accounts within NT, but when i try to change
rename the logins within sql , i get the error.
TITLE: Microsoft SQL Server Management Studio
Unable to rename LBOPS2\SQLServer2005MSSQLUser$LBOPS2$MSSQLSERVER.
(ObjectExplorer)
ADDITIONAL INFORMATION:
Rename failed for Login 'LAOPS2\SQLServer2005MSSQLUser$LAOPS2$MSSQLSERVER' .
(Microsoft.SqlServer.Smo)
For help, click:
[url]http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=9.00. 2047.00&EvtSrc=Microsoft.SqlServer.Management.Smo. ExceptionTemplates.FailedOperationExceptionText&Ev tID=Rename+Login&LinkId=20476[/url]
An exception occurred while executing a Transact-SQL statement or batch.
(Microsoft.SqlServer.ConnectionInfo)
The name change cannot be performed because the SID of the new name does not
match the old SID of the principal. (Microsoft SQL Server, Error: 15098)
For help, click:
[url]http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=09.00 .2050&EvtSrc=MSSQLServer&EvtID=15098&LinkId=20476[ /url]
BUTTONS:
OK
Many Thanks
Jon
Hi Jon
"Jon Bird" wrote:

> hi,
> I have cloned a VM of a SQL Server 2005 database to a new server with a
> different name.
> I have run the sp_dropserver and sp_addserver commands as well documented to
> change the server name within the sql instance to the new cloned server name.
> The issue i have is that the logins on the new cloned server still contains
> the local group and local account details from the old machine.
> I have renamed the groups and accounts within NT, but when i try to change
> rename the logins within sql , i get the error.
> TITLE: Microsoft SQL Server Management Studio
> --
> Unable to rename LBOPS2\SQLServer2005MSSQLUser$LBOPS2$MSSQLSERVER.
> (ObjectExplorer)
> --
> ADDITIONAL INFORMATION:
> Rename failed for Login 'LAOPS2\SQLServer2005MSSQLUser$LAOPS2$MSSQLSERVER' .
> (Microsoft.SqlServer.Smo)
> For help, click:
> [url]http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=9.00. 2047.00&EvtSrc=Microsoft.SqlServer.Management.Smo. ExceptionTemplates.FailedOperationExceptionText&Ev tID=Rename+Login&LinkId=20476[/url]
> --
> An exception occurred while executing a Transact-SQL statement or batch.
> (Microsoft.SqlServer.ConnectionInfo)
> --
> The name change cannot be performed because the SID of the new name does not
> match the old SID of the principal. (Microsoft SQL Server, Error: 15098)
> For help, click:
> [url]http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=09.00 .2050&EvtSrc=MSSQLServer&EvtID=15098&LinkId=20476[ /url]
> --
> BUTTONS:
> OK
> --
>
> Many Thanks
> Jon
>
Have you looked at using the script in:
http://support.microsoft.com/kb/246133/
Then dropping the logins and re-creating new ones with the same SIDs.
John

Cloning a SQL 2005 Database

hi,
I have cloned a VM of a SQL Server 2005 database to a new server with a
different name.
I have run the sp_dropserver and sp_addserver commands as well documented to
change the server name within the sql instance to the new cloned server name.
The issue i have is that the logins on the new cloned server still contains
the local group and local account details from the old machine.
I have renamed the groups and accounts within NT, but when i try to change
rename the logins within sql , i get the error.
TITLE: Microsoft SQL Server Management Studio
--
Unable to rename LBOPS2\SQLServer2005MSSQLUser$LBOPS2$MSSQLSERVER.
(ObjectExplorer)
--
ADDITIONAL INFORMATION:
Rename failed for Login 'LAOPS2\SQLServer2005MSSQLUser$LAOPS2$MSSQLSERVER'.
(Microsoft.SqlServer.Smo)
For help, click:
http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=9.00.2047.00&EvtSrc=Microsoft.SqlServer.Management.Smo.ExceptionTemplates.FailedOperationExceptionText&EvtID=Rename+Login&LinkId=20476
--
An exception occurred while executing a Transact-SQL statement or batch.
(Microsoft.SqlServer.ConnectionInfo)
--
The name change cannot be performed because the SID of the new name does not
match the old SID of the principal. (Microsoft SQL Server, Error: 15098)
For help, click:
http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=09.00.2050&EvtSrc=MSSQLServer&EvtID=15098&LinkId=20476
--
BUTTONS:
OK
--
Many Thanks
JonHi Jon
"Jon Bird" wrote:
> hi,
> I have cloned a VM of a SQL Server 2005 database to a new server with a
> different name.
> I have run the sp_dropserver and sp_addserver commands as well documented to
> change the server name within the sql instance to the new cloned server name.
> The issue i have is that the logins on the new cloned server still contains
> the local group and local account details from the old machine.
> I have renamed the groups and accounts within NT, but when i try to change
> rename the logins within sql , i get the error.
> TITLE: Microsoft SQL Server Management Studio
> --
> Unable to rename LBOPS2\SQLServer2005MSSQLUser$LBOPS2$MSSQLSERVER.
> (ObjectExplorer)
> --
> ADDITIONAL INFORMATION:
> Rename failed for Login 'LAOPS2\SQLServer2005MSSQLUser$LAOPS2$MSSQLSERVER'.
> (Microsoft.SqlServer.Smo)
> For help, click:
> http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=9.00.2047.00&EvtSrc=Microsoft.SqlServer.Management.Smo.ExceptionTemplates.FailedOperationExceptionText&EvtID=Rename+Login&LinkId=20476
> --
> An exception occurred while executing a Transact-SQL statement or batch.
> (Microsoft.SqlServer.ConnectionInfo)
> --
> The name change cannot be performed because the SID of the new name does not
> match the old SID of the principal. (Microsoft SQL Server, Error: 15098)
> For help, click:
> http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=09.00.2050&EvtSrc=MSSQLServer&EvtID=15098&LinkId=20476
> --
> BUTTONS:
> OK
> --
>
> Many Thanks
> Jon
>
Have you looked at using the script in:
http://support.microsoft.com/kb/246133/
Then dropping the logins and re-creating new ones with the same SIDs.
John

Cloning a SQL 2005 Database

hi,
I have cloned a VM of a SQL Server 2005 database to a new server with a
different name.
I have run the sp_dropserver and sp_addserver commands as well documented to
change the server name within the sql instance to the new cloned server name
.
The issue i have is that the logins on the new cloned server still contains
the local group and local account details from the old machine.
I have renamed the groups and accounts within NT, but when i try to change
rename the logins within sql , i get the error.
TITLE: Microsoft SQL Server Management Studio
--
Unable to rename LBOPS2\SQLServer2005MSSQLUser$LBOPS2$MSS
QLSERVER.
(ObjectExplorer)
ADDITIONAL INFORMATION:
Rename failed for Login 'LAOPS2\SQLServer2005MSSQLUser$LAOPS2$MS
SQLSERVER'.
(Microsoft.SqlServer.Smo)
For help, click:
http://go.microsoft.com/fwlink?Prod...in&LinkId=20476
An exception occurred while executing a Transact-SQL statement or batch.
(Microsoft.SqlServer.ConnectionInfo)
The name change cannot be performed because the SID of the new name does not
match the old SID of the principal. (Microsoft SQL Server, Error: 15098)
For help, click:
http://go.microsoft.com/fwlink?Prod...98&LinkId=20476
BUTTONS:
OK
--
Many Thanks
JonHi Jon
"Jon Bird" wrote:

> hi,
> I have cloned a VM of a SQL Server 2005 database to a new server with a
> different name.
> I have run the sp_dropserver and sp_addserver commands as well documented
to
> change the server name within the sql instance to the new cloned server na
me.
> The issue i have is that the logins on the new cloned server still contain
s
> the local group and local account details from the old machine.
> I have renamed the groups and accounts within NT, but when i try to change
> rename the logins within sql , i get the error.
> TITLE: Microsoft SQL Server Management Studio
> --
> Unable to rename LBOPS2\SQLServer2005MSSQLUser$LBOPS2$MSS
QLSERVER.
> (ObjectExplorer)
> --
> ADDITIONAL INFORMATION:
> Rename failed for Login 'LAOPS2\SQLServer2005MSSQLUser$LAOPS2$MS
SQLSERVER'
.
> (Microsoft.SqlServer.Smo)
> For help, click:
> http://go.microsoft.com/fwlink?Prod...in&LinkId=20476
> --
> An exception occurred while executing a Transact-SQL statement or batch.
> (Microsoft.SqlServer.ConnectionInfo)
> --
> The name change cannot be performed because the SID of the new name does n
ot
> match the old SID of the principal. (Microsoft SQL Server, Error: 15098)
> For help, click:
> http://go.microsoft.com/fwlink?Prod...98&LinkId=20476
> --
> BUTTONS:
> OK
> --
>
> Many Thanks
> Jon
>
Have you looked at using the script in:
http://support.microsoft.com/kb/246133/
Then dropping the logins and re-creating new ones with the same SIDs.
John

Cloned SQL 2005 Install

I need a little help with a cloned SQL 2005 install. We have a couple of Virtual Machines that SQL 2005 was installed on. The install was orginally completed on <pc1> and then duped over to <pc2>. The problem now is that <pc2> is showing information from <pc1> everywhere. I have reviewd this document: http://msdn2.microsoft.com/en-us/library/ms143799.aspx, and it doesn't seem to help any. I have used the sp_dropserver command with 'droplogins' to try to recreate the logins for <pc2> but it's still showing the logins from <pc1>. Can someone please help me out, I'm not sure what I'm doing wrong here. Thanks!

Am I looking at a re-install here?

The doc says there is no need to re-install, but those commands just aren't taking care of the problem. When I run @.@.servername it does show the correct server as node 0, but the logins are still there from <pc1>. I deleted the 3 logins that were referenced to the old PC, now I just can't get them re-created for <pc2>

|||What logins are you referring to?

Cloned Drive

I have a machine named DOG with MSDE (computername=DOG). I clone the machine
to another and rename the machine CAT. When I do this, SQL Server reports
"Your SQL Server installation is either corrupt or has been tampered with
(unknown package id). Please rerun setup." I understand why this happens,
the computername changed.
Is there a way to change the package id to work with the new computername?
Of course I can reinstall MSDE, but that defeats the mai purpose of the
clone.
TIA,
Will
hi Will,
Will T wrote:
> I have a machine named DOG with MSDE (computername=DOG). I clone the
> machine to another and rename the machine CAT. When I do this, SQL
> Server reports "Your SQL Server installation is either corrupt or has
> been tampered with (unknown package id). Please rerun setup." I
> understand why this happens, the computername changed.
> Is there a way to change the package id to work with the new
> computername? Of course I can reinstall MSDE, but that defeats the
> mai purpose of the clone.
to the best of my knowledge, this was a problem with SQL Server 7.0 and MSDE
1.0(http://support.microsoft.com/default...b;en-us;229875), as SQL
Server 7.0 could be "managed" rerunning the setup (
http://databasejournal.com/features/...0894_2194711_3 ),
where no work around was available for MSDE 1.0...
for SQL Server 2000, if you change the computer name, you only need to
delete and re-create the server registration in Enterprise Manager, but as
MSDE doew not provide it, you need nothing on MSDE 2000...
Andrea Montanari (Microsoft MVP - SQL Server)
http://www.asql.biz/DbaMgr.shtmhttp://italy.mvps.org
DbaMgr2k ver 0.14.0 - DbaMgr ver 0.59.0
(my vb6+sql-dmo little try to provide MS MSDE 1.0 and MSDE 2000 a visual
interface)
-- remove DMO to reply

Clone new database from existing

How do I go about creating a cloned copy of an existing database on the same server? I basically want to set up a test copy of a production database, but let it reside on the same server with a slightly different name, prefixed with 'Testing_".

I typically just use Studio Express Manager and not scripts to do admin tasks. Here's what I tried that didn't work so well:

* Had full backups of production db
* Detached production database I wanted to clone
* From within Win Explorer, copy the .mdf and .ldf files within same data folder and gave them a new name, prefixing with "Testing_"
* Re-attached prodution db
* Attached "Testing_..." database

Sql Express seems confused at this point with new database I attached. It references the full path of the database I copied from (c:\program files\microsoft sql server\mssql.1\data\...". I rename the datbase, removing full path and prefixing with "Testing_".

* Using Sql authentication, changed the default database for the Login account to the new cloned copy of database.
* Did some query level data sanitizing to the cloned copy of the db. I am positive I performed this on the correct db.
* Was able to connect/authenticate to the cloned copy through a custom VB app on my dev machine, and all looked well.
* Tried to connect to the cloned db from another machine and couldn't. Went back to my dev machine and noticed the original production db looked hosed -- there were no tree nodes available to it! Was still able to connect to the cloned "Testing_" db copy, but not able to connect/authenticate anymore to the production copy.
* Detached cloned copy of "Testing_" db and moved it out of the data folder.
* Detached production db. Got an error msg indicating operation failure of some kind, but the database was gone from the tree.
* Reattached the production db but couldn't hit it from my custom vb app. Re-did the login and user accounts used by the app and was able to hit it. However, the data sanitizing I had done earlier in the cloned copy clearly was visibile in the production db!
* Had to restore production db from backup. Had problems authenticating from app, and recreated User account before the app was to connect.

Q1: What I am doing wrong? Sql Express was obviously as confused as me somewhere along the line.

Q2: Is specifying a default database used by a Login account necessary for a VB app like mine. I think it was something I discovered in the past, however, this would seemingly present a problem whenever I want my app to hit a different database, established through a connection string.

TIA...

Rick

hi Rick,

when doing this kind of "sorcery", please be carefull when "re-registering" the database..

just to cross check, usually you should:
-detach the original db;

-copy it elsewhere or rename destination files (mdf, ldf and eventual ndf) say, with your prefix.. (orig.mdf becomes clone_of_orig.mdf and the like);

-reattach the original db via

USE [master]

GO

CREATE DATABASE [myDB] ON

( FILENAME = N'C:\Program Files\Microsoft SQL Server\MSSQL.3\MSSQL\Data\myDB.mdf' ),

( FILENAME = N'C:\Program Files\Microsoft SQL Server\MSSQL.3\MSSQL\Data\myDB_log.ldf' )

FOR ATTACH

GO

-the original logical db name is correct, as the original physical file(s) pointers..

-attach the cloned db via

USE [master]

GO

CREATE DATABASE [CLONE_of_myDB] ON

( FILENAME = N'C:\Program Files\Microsoft SQL Server\MSSQL.3\MSSQL\Data\clone_of_myDB.mdf' ),

( FILENAME = N'C:\Program Files\Microsoft SQL Server\MSSQL.3\MSSQL\Data\clone_of_myDB_log.ldf' )

FOR ATTACH

GO

as you can see, the logical name of the db is different, as are the referenced phisical file names..

-the internal logical names of each physical file are not considered to collide with other database's logical names, so you are not in trouble here..

regards

|||Hmmh... what you described is exactly what I did, with pecuilar results, except use Sql Express Manager.

- I detached original db
- Copied to new set and renamed (cloned)
- Reattached original db
- Attached cloned db

Is Sql Express Manager not up to this task?

Rick|||

Do you get an error message or what are you experiencing ? If you can′t get attach / detach to run for you, you can also use the backup / restore functionality for this.

HTH, jens K. Suessmeyer.


http://www.sqlserver2005.de

|||All I got was some meaningless generic "operation failed" type of error, plus, the odd behavior I described above when sanitizing (running update queries against) the cloned database.

I did try restoring the source db and specifying clone db as target, but was prevented from doing so with a message to the effect of "target database not in dataset so not allowable."

If somebody wouldn't mind trying to clone a db from the same server through Sql Express Manager, and let me know the results, I'd feel better about trying it again. When I tried it, I discovered I was simultaneously sanitizing both databases.

Rick|||The 'safest' (and easiest) method to do this is to do a backup, and then restore to a different name and/or location. Read up on RESTORE in Books Online.|||Alright, I was able to do that through Express Manager this time. Much easier and safer. Thanks, both of you.

Rick