Restore From Different Server - User (sid) Does Not Match Restored Db - Fix With Sp_changeobjectowner
Jul 20, 2005
This is more of a fyi than a question.
After restoring a live db backup to our development server there was
an identically named login Melb02 on both the db server and in the
restored db backup.
However if you log in as Melb02 on the server you cannot access any
objects owned by Melb02 on the restored db, without putting
Melb02.<object_name> in front. This would break our app so we needed
a workarround.
The mssql docs say that first check if the login is the owner, then
dbo then deny access - something to that effect. So this was
confusing.
workarround
I think what happened was that the db restored from the live remote
server had a different security id (sid) to the development server
although both users had the same name: Melb02. Thus if you log in as
Melb02 you can't get access to Melb02 objects on the restored db
because of the different sid.
we wrote a cursor that went though everything in sysobjects belonging
to Melb02 and did a : sp_changeobjectowner to a new user login that
our app now happily uses.
Jol.
View 1 Replies
ADVERTISEMENT
Apr 8, 2002
Hi I took a Full Backup on Production Server and Restored the Same Database on Testing Server, i am able to see all the Tables Stored Procedure and View except Logins, i am not able to see any logins, there are total 650 Logins under the Database how can i see the logins and how to restore the logins, while i am trying to create any logins it is saying Error Occured login is already existing in the Database..
Bye,
Madhavi
View 3 Replies
View Related
Jul 29, 2015
when execute the restore log command, in the messages window it shows how many seconds the restore takes, at the meantime, on the status bar, it also shows the seconds the command takes.
Two values are different and could be very different, please see below examples , restoring takes 1.8 seconds, but in total the command takes 4 seconds to complete, the other one is 8.1 seconds and 12 seconds.
What does SQL Server or Windows do after the restoring?
pic a:
pic b:
I did a xperf, I can see after the restoring is completed, sql server did garbage collect and log write, which just run very quickly, but storage is busy on reading the log file for nearly 2.2 seconds( 4-1.8), and 4 seconds ( 12-8.1) .
pic 1:
pic 2:
see pic 1 above, from 13 to 17, the restore operation is finished, but the storage jump to 100% active to do some reads, only reads no writes. zoom that period shows pic 2, it read 4096 (I don't know the unit size) for about 4 seconds, what does this do?
Data file, log file, backup file are no different drives, but all local drive, the interesting point is the read jumped after restoring, I tested it on different server, same result...
View 1 Replies
View Related
Mar 1, 2001
Hello,
Im running SQL 7.0 in production with no SQL service pack applied. I am trying to copy the database over to a test box running SQL 7.0 SP3. Both servers are NT 4.0 with SP6.1a. When I restore the database on the test box, I do not get the Users restored but I do get the Tables and other items. The SQL backup Im restoring from is a complete backup. Could the fact that the server Im restoring on is SQL 7.0 SP3 and it came from a pure SQL 7.0 server?
Thanks
View 2 Replies
View Related
Aug 22, 2007
Thanks in advance for help.
Could someone please help me for SWL backup restoration and db by user
I restored SQL 7.0 database to SQL 2000. ( by creating empty db on SQL 2000 and restored from SQL 7 backup) -- restore ok..
I need to use same SQL user which is admin for DB on SQL 7, for SQL 2000 also. ( DB user is sql user not domain user)
I put mixed authentication mode ( windows and SQL) in SQL 2000 enterprises manager security tab setting.
I can see DB user is available in DB user list on restored DB but can not access DB when I try to access from query analyser
I tried to create new login with same name as it was in SQL 7 and tried to give full admin access on SQL 2000 enterprise manager but I get error 21002:[ SQL DMO] User 'user' already exists.
Kind Regards
Sunod
View 1 Replies
View Related
Jan 24, 2006
I just restored my SQL server 2000 database on the SQL server 2005. after this i ran the Service broker sample ("Hello World") on this database by changing the AdventureWorks name to the new database name. The "setup.sql" runs fine. When i run the "SendMessage.sql" i was not getting any rows in the output (The message was not getting inserted into the queue). I checked the Service broker is enabled on this databased using the query "select is_broker_enabled from sys.databases where name = 'newdbname' " It was 1. I even tried the ALTER DATABASE SET ENABLE_BROKER. but it didnt work.
When i tried the sample on a newly created database it worked fine.
Is there any solution to make the restored database to work for service broker.
Thanks
Prashanth
View 3 Replies
View Related
May 3, 2001
Has anyone had problems with this SP? I am trying to change the owner of a stored procedure so I do the following:
sp_chaneobjectowner stored_procedure_name, dbo
(note: I have tried putting the object and new owner in single quotes, double quotes, brackets but still get same error message)
The message I get is that the object does not exist or is not a valid object for this operation.
However, it is a valid stored procedure. I see it there and can execute it. The only problem is that it has the wrong owner. Sure I can delete and recreate it, but I would like to figure out why this system SP is not working properly or what I am doing wrong.
Any suggestions would be appreciated
View 2 Replies
View Related
Oct 12, 2001
Can anyone help me with the code to change the name of the owner of all the tables in a database from @user1 to @user2 using sp_changeobjectowner in a loop with the help of system tables probably?? Thanks.
Di.
View 1 Replies
View Related
Jul 20, 2005
How do you use sqldmo object to execute system stored procedures? Anysuggestions would be appreciated.*** Sent via Developersdex http://www.developersdex.com ***Don't just participate in USENET...get rewarded for it!
View 1 Replies
View Related
Jun 3, 1999
I have 2 SQL Servers 7.
DBs on the first were upgraded from 6.5.
A DB has 2 users: dbo + user1. User1 is also uses user1 login
I created a DB backup on the first server copied it on the second & restored on the second into existing DB.
The problem is that after that user1 is not in the list of the restored DB on the second server & I can not
include it in the DB & grant access to user1 login to the same DB
and error message is
"15023 User or role "user1" already in exists in the current DB.
View 1 Replies
View Related
Oct 19, 2001
Hello,
Is it possible to use a dump from a database to do a restore of a db on a different server?
I have a SQL 2000 server and having been given a file called test.dmp (I am not sure what SQL version this is). Can I use this to do a restore to a new db I have created on my server? If so what method do I use?
Thanks
reorg
View 1 Replies
View Related
Aug 15, 2007
Hey Guys,
I have a .dmp backup file from an oracle database. I want to restore it into an sql server database. Can this be done?
View 2 Replies
View Related
May 16, 2007
Is there any workaround on this? I need to migrate my data in sql server 2005 into sql server 2000. Thanks in advance.
View 2 Replies
View Related
Oct 25, 2014
I have restored the master db in single user mode.
Processed 440 pages for database 'master', file 'master' on file 1.
Processed 3 pages for database 'master', file 'mastlog' on file 1.
The master database has been successfully restored. Shutting down SQL Server.
SQL Server is terminating this process.
I removed single user mode parameter(-m;)..When I start SQL Server in configuration manager getting below error .The request failed or the service did not respond in a timely fashion. Consult the event log or other applicable error logs for details
View 7 Replies
View Related
Jan 17, 2007
I have a SQL 2k database backup and I restore it in sql server 2005.
Is this now a SQL Server 2005 database or a 2K database in a 2005 server.
Means do I need to convert databases somehow when I migrated from 2000 to 2005. Is the above mentioned way a way to migrate... or are ther some conversation tools.
Any help / links / ressources would be Great...
Felix
View 5 Replies
View Related
Apr 29, 2015
have a Prod Server A having TDE enabled on 2 of those databases. I have a Prod Server B having TDE enabled on 3 of those databases. Now I have to create a single Dev server Server C for all the above 5 databases residing on the two servers. So how can I restore all the 5 database backup files on server C.
Does it mean that I need to copy the certificates and Keys from both the Prod server to this Dev Box and then restore the backup files. Once done, I can enable the encryption ON on those 5 database on Dev box or is there any different approach.Also how will tempdb behave in this scenario.
View 5 Replies
View Related
May 9, 2008
Hi all,
I am new to SQL Server 2005 and databasing in general, I have had a webhost restore a copy of my online database but now it is read only.
Could someone tell me how I go about letting the database to be writeable etc for online use.
If I right click the db and go to permissions there is nothing in there, should there be?
Do you have to manually set permissions for each table after restore???
Any help would be great
View 5 Replies
View Related
Dec 7, 2006
This is my first time to deploy an asp.net2 web site. Everything is working fine on my local computer but when i published the web site on a remote computer i get the error "Failed to generate a user instance of SQL Server due to failure in retrieving the user's local application data path. Please make sure the user has a local user profile on the computer. The connection will be closed" (only in pages that try to access the database)
Help pleaseee
View 3 Replies
View Related
Jan 31, 2002
I'm trying to copy a database from one server to another. I'm attempting to do this by restoring a SQL 7 DB from a saved disk backup.
The FULL backup works fine. I'm only backing up "db1" with all objects, tables, etc.
I then proceed to do a restore... but it keeps bombing on the restore part because the users are not present in the new database.
I've also tried doing this as an export from on database to another. But it also fails because the users are not in the new database.
Am I missing something? Do I need to copy the Master DB too?
How do I copy the users w/o having to install each and EVERY one .... individually...? (There are 500+)
Is there a better way to restore/copy a db from one server to another? I can't figure out why it's bombing out on the part where it adds users. (I'm trying to copy my database from prod to test... but exact mirror copies)
Thanks!
View 1 Replies
View Related
Oct 4, 2007
How can i Restore a Database as a sql user authenication rather than windows user authentication.
View 8 Replies
View Related
May 17, 2007
Hello.
I am trying to perform a backup and restore of a user's default database. the user- "myuser", was created with a default database. I have backed the user database and tried to restore it in different ways and I always get the same error when trying to connect with the user after restore:
"Cannot open user default database.Login failed (error 4064)".
It happens if I don't delete the user before restoring the database.
If I try to delete the user before restore and create it afterwards, when I try to set the default user database to the same database I get the error:
"user, group or role 'myuser' already exist in the database"
And when I try to delete the user from the restored database (in order to recreate it) I cannot, because the user's schema is connected to objects in the database.
Can anyone help?... How do I restore??
Thanx,
Nili.
View 2 Replies
View Related
Dec 31, 2014
In Windows Server 2012. How do I do a System Restore to a previous restore point?I need to install the 64 bit and 32 bit Oracle Client Install for connections in SSIS and to create Oracle Linked Servers.
If you make a mistake it is not fun removing it. Sometimes it corrupts the machine and it is difficult to uninstall since there is not an Oracle Universal installer for Oracle 11g.If you install the 32 bit before the 64 you mess up the machine.how to create a restore point.
View 6 Replies
View Related
Apr 22, 2004
i need a sql statment or procedure to kill all user connection to one database.
And Deny new connection for a little time.
So i can a restore this database from a dump.
I can this do only in exclusiv modus. without any other connection.
Can anybody help me??
thanks and best regards from Berlin, Germany
View 4 Replies
View Related
Jul 23, 2005
Dear group,I am a DB-Administrator for a Company that creates and maintains asoftware solution based on SQL-Server and Crystal-Reports.The Crystal-Reports part uses the following method to present data.First a specific user (database authentification) is created with afixed password. Then Crystal Reports uses thisuser/password-information to login to the database and present or printthe data.I recently received a database from a customer of ours and i restoredit on my machine. It worked perfectly except that the Crystal Reportspart did not function at all (showing only blank reports).After dropping the specific user and creating the fixed password thething worked.So my question: does restoring a SQL-Server database on a differentmachine alter or eliminate login and user information ?Any reply will be highly appreciated.Greetings from ViennaUli
View 2 Replies
View Related
Jul 20, 2005
Environment is SQL Server 2000 64 bit.I restore from a script 'my' database, this works fine. However, allthe tables are also found in master, no data though.Anyone experienced this?
View 2 Replies
View Related
Sep 16, 2007
Hi!
I have a SQL 2000 database that has several tables with the same name but with different users/logins.
Example:
Database "Customers"
Table Customer with user / login CompanyA
Table Customer with user / login CompanyB
Table Contact with user / login CompanyA
Table Contact with user / login CompanyB
I need to split these into two different database's
Database "CustomersA"
Table Customer with user / login CompanyA
Table Contact with user / login CompanyA
Database "CustomersB"
Table Customer with user / login CompanyB
Table Contact with user / login CompanyB
Any good idea how to do this?
Ingar
View 5 Replies
View Related
Jul 6, 2004
I am currently designing an adp front end that links to a Sql Server database.
In terms on front end upgrade prespective i am thinking about a logon routine procedure ( which should be a vba code code that runs at startup) to check wheter the adp front end which is being used is the latest release hence compatible with the database current version.
Create and manage version number at back end level is quiet easy however to set a version number or whatever else information in the adp is somewhat a big hassle as database properties are not available from visual basic when using adp.
Was also thinking about using my xml file which holds my configuration information such as Data source - catalog but that's mean deployment of new front end must be carried out with local xml file change.
Also any manual update of information about version in xml file could allow old front end to run with database.
Please any tips and advises on how to handle this issue highly appreciated.
Regards to everybody
View 2 Replies
View Related
Jan 31, 2014
I'd like to get a extract table result, with a reference id primary key, showing the maximum dates for events and who was responsible for them. I can get the max(date) field in columns using PIVOT, but can't see a way to get the 'who' field without lots of LEFT JOINs.
Here's some test data and code which shows the principle:
CREATE TABLE #t
(
ref INT ,
id INT ,
who VARCHAR(10) ,
checkin DATE
[Code] ....
The result set is:
ref 1 who1 2 who2 3 who3 4 who4
123 2014-01-18 carol 2014-01-18 andy 2014-01-16 bill 2014-01-17 carol
456 NULL NULL 2014-01-17 NULL NULL NULL NULL NULL
Is there some way to avoid all the LEFT JOINs, maybe by using another PIVOT, to produce the same result?
View 4 Replies
View Related
Aug 8, 2015
I am stuck with a query that I am working on. I have data like below.
DECLARE @Input TABLE
(
OrderID INT,
AccountID INT,
StatusID INT,
Value INT
)
INSERT INTO @Input VALUES (1,1,1,15), (2,1,1,20), (3,2,1,5), (4,2,2,40), (5,3,1,20), (6,1,2,40), (7,1,2,40)
If an Account's value reaches 20 for StatusID = 1 and 40 for StatusID = 2, that is a called "Good". I want to find out which order made the Account become "Good".
By looking at the data, it is understandble that AccountID 1 crossed Status ID 1's limit of 20 with order 2, but the status ID 2's limit was only crossed after the 6th order was placed. So my output should show 6 for AccountID 1.
For AccountID 2, value of statusID 1 was 5 with orderid 3, but it reached the limit for status id 2 of 40 with order 4. But the first condition was not met. so it shouldn't be seen in the output.
Same with AccountID 3 as well, It reached the limit of status id 1 with order 5 but the limit for order 2 wasn't reached so it should be ignored as well.
I wrote the code as below, its working fine but I still know there are better ways to write since I will be working with atleast a million records.
;WITH CTE AS
(
SELECT OrderID,AccountID, StatusID, SUM(Value) OVER(Partition By AccountID, StatusID ORDER BY OrderID) AS RunningTotal
FROM @Input
[Code] ....
View 2 Replies
View Related
Sep 24, 2015
I am using the following views from two db's to find records that don't match.
My question is can I have output of fields from the second table
SELECT distinct T1.[last name],t1.[first name],ENum
FROM ECLINICIAN_Info T1
WHERE NOT EXISTS(SELECT *
FROM ACLINICIAN_Info T2
WHERE t1.Enum = t2.Anum
and t1.[last name] = t2.lname and t1.[first name] = t2.Fname)
I would like to include t2.Anum in my select ...
View 5 Replies
View Related
Feb 12, 2015
I have two table People and Employee, both have firstname and lastname as fields
I want to display only the names that don't match on firstname and lastname
View 3 Replies
View Related
Aug 6, 2015
CREATE TABLE #NAME1(FULLNAME VARCHAR (100))
INSERT INTO #NAME1(FULLNAME) VALUES('JOHN X. DOE')
INSERT INTO #NAME1(FULLNAME) VALUES('FITZGERALD F. SCOTT')
CREATE TABLE #NAME2(LASTNAME VARCHAR(25), MI VARCHAR(2), FIRSTNAME VARCHAR(25))
INSERT INTO #NAME2(LASTNAME, MI, FIRSTNAME) VALUES('DOE', 'X', 'JOHN')
INSERT INTO #NAME2(LASTNAME, FIRSTNAME) VALUES('FITZGERALD', 'F SCOTT')
My task is to find matches between these two tables on "name."
View 1 Replies
View Related