Showing posts with label restore. Show all posts
Showing posts with label restore. Show all posts

Wednesday, March 21, 2012

Is the re-start done?

Hi,

I was trying to restore a master database. This is what I did:
1. rebuild the master database and it was successful
2. restart server in single mode with
sqlservr.exe -c -m
and I got the following window:

************************************************** ********
2006-01-27 10:30:01.49 server Microsoft SQL Server 2000 - 8.00.2039 (Intel X
86)
May 3 2005 23:18:38
Copyright (c) 1988-2003 Microsoft Corporation
Standard Edition on Windows NT 5.2 (Build 3790: Service Pack 1)

2006-01-27 10:30:01.52 server Copyright (C) 1988-2002 Microsoft Corporation.

2006-01-27 10:30:01.52 server All rights reserved.
2006-01-27 10:30:01.52 server Server Process ID is 600.
2006-01-27 10:30:01.52 server Logging SQL Server messages in file 'e:\Microso
ft SQL Server\MSSQL\log\ERRORLOG'.
2006-01-27 10:30:01.54 server SQL Server is starting at priority class 'norma
l'(4 CPUs detected).
2006-01-27 10:30:01.71 server SQL Server configured for thread mode processin
g.
2006-01-27 10:30:01.74 server Using dynamic lock allocation. [2500] Lock Bloc
ks, [5000] Lock Owner Blocks.
2006-01-27 10:30:01.99 server Attempting to initialize Distributed Transactio
n Coordinator.
2006-01-27 10:30:04.04 spid3 Warning ******************
2006-01-27 10:30:04.04 spid3 SQL Server started in single user mode. Updates
allowed to system catalogs.
2006-01-27 10:30:04.04 spid3 Starting up database 'master'.
2006-01-27 10:30:04.29 server Using 'SSNETLIB.DLL' version '8.0.2039'.
2006-01-27 10:30:04.29 spid5 Starting up database 'model'.
2006-01-27 10:30:04.29 spid3 Server name is 'SQLTEST1'.
2006-01-27 10:30:04.31 spid7 Starting up database 'msdb'.
2006-01-27 10:30:04.31 spid8 Starting up database 'pubs'.
2006-01-27 10:30:04.31 spid9 Starting up database 'Northwind'.
2006-01-27 10:30:04.31 server SQL server listening on 10.10.4.17: 1433.
2006-01-27 10:30:04.33 server SQL server listening on 127.0.0.1: 1433.
2006-01-27 10:30:04.34 server SQL server listening on TCP, Shared Memory, Nam
ed Pipes.
2006-01-27 10:30:04.36 server SQL Server is ready for client connections
2006-01-27 10:30:04.67 spid5 Clearing tempdb database.
2006-01-27 10:30:05.54 spid5 Starting up database 'tempdb'.
2006-01-27 10:30:05.70 spid3 Recovery complete.
2006-01-27 10:30:05.70 spid3 SQL global counter collection task is created.

************************************************** **

Now an hour passed and the window is still there. The SSQL service manager on the toolbars still has a red icon but not green. My questions are how do I know the process is done? What is the next step after SQL global counter collection task? Where can I find more information?

Thanks a lot.

MarkMy recollection is from a desperate incident that occurred to me more than seven years ago when I had to restart a failed SQL Server instance. As I recall, when you run it from the command window like you've done, it stays in the state "forever". It is in essence, the SQL instance running (just on the console instead of as a service).

It's been a loooong time since I recovered a master database (note to self, something to practice soon). What I recall doing from before is getting it all started and then shutting the service down and then restarting again in "normal" mode.

Like I said, it's been a while.

Regards,

hmscott|||Once you see "Recovery Complete", you should be able to open a Query Analyzer or OSQL session with the server, in order to restore the master database. You are essentially looking at the errorlog in the command window, so the next entry will be the next error, warning, or information message that SQL Server sees fit to put in the errorlog.

Not sure what other information you would be after in this case. You can see if sqlservr is running in task manager, but you already know it is running at the command line.|||Thanks all. I understand now.|||I managed to restore the master database on a different server but I cannot modify the jobs I created before on the new server because the server name gets changed.

Should I change the server name in the master and msdb databases? Will sp_dropserver old_server_name and sp_addserver new_server_name work?

Thanks a lot.|||I managed to restore the master database on a different server but I cannot modify the jobs I created before on the new server because the server name gets changed.

Should I change the server name in the master and msdb databases? Will sp_dropserver old_server_name and sp_addserver new_server_name work?

Thanks a lot.

I had a similar problem once before. Be sure to run sp_dropserver and sp_addserver. However, I think I ultimately had to go into the msdb database and open the sysjobs table and manually edit the "originating server" field to the new server name.

If I recall correctly, that did the trick.

Regards,

hmscott|||I ended up using update sysjobs table like this:
update sysjobs set originating_server = new_server
and the jobs are working now.

I also notice that several other system tables have the old server name, should I change them as well?

Thanks.|||Not if they cause no problems. This is what is can be referred to as "poking the bear" in the SQL Server world.

The master database is never too happy about being restored to a server of a different name. It can be done, but it should be avoided for these sorts of reasons. Is this for a hardware upgrade?|||No, I am practising the database disaster recovery. The master database recovery is one Scenario.

Wednesday, March 7, 2012

Is restore or Detach/Attach better?

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

ZYTAll databases store the SID (Security Identifier) of the logins that have permissions on that database. When you restore or attach a database to a new instance, these users may become orphaned, if there is no login with the corresponding SID. When you create the SQL Authenticated logins on the new server, make sure you specify the SID that they should have. Windows logins have their SIDs specified by the Domain Controllers, and need not be specified in the create login statement.|||MCrowley:

Thanks for the reply. Can DTS transfer login with SID? What I am concerning is to transfer login from old server to new one.

Thanks

ZY

All databases store the SID (Security Identifier) of the logins that have permissions on that database. When you restore or attach a database to a new instance, these users may become orphaned, if there is no login with the corresponding SID. When you create the SQL Authenticated logins on the new server, make sure you specify the SID that they should have. Windows logins have their SIDs specified by the Domain Controllers, and need not be specified in the create login statement.|||Google "sp_help_revlogin" for some help to transfer sql accounts|||when the db is restored run (from the restored db)

If you do not bring logins over and create them manually

-- to view broken users
sp_change_users_login 'report' -- will give you list of "broken" users.

you then run sp_change_users_login auto_fix, 'username' for each user:

I just use this little sql script after restoring a db (make db current):

set nocount on
declare @.v_dbuser varchar(255)
declare @.sql nvarchar(255)
declare c1 cursor for
select a.name from sysusers a, master..syslogins b
where a.name = b.name
open c1
fetch c1 into @.v_dbuser
while (@.@.FETCH_STATUS <> -1)
BEGIN
print 'Fixing User ' + @.v_dbuser
set @.sql = 'sp_change_users_login ''auto_fix'',' + @.v_dbuser
exec sp_executesql @.sql
fetch c1 into @.v_dbuser
END
CLOSE C1
DEALLOCATE C1|||Nice little script! I have always done that manually...now next time we create or sync a dev database, I'll whip out your little script and be the instant envy of my peers!

Yeah, I know...I need a new set of peers.

One could probably also just add a "check every database" loop outside of this one and handle all the databases on a new server at once...though I suppose that is a pretty infrequent occurrence and probably not a justifiable expenditure of effort relative to the creation of a script to do it.

Is restore of a republishing database possible from one of its subscribers in merge replic

Hi,
I've a republishing database (using merge replication) which has more than 1
subscriber. The database has gone into suspect mode and there is a problem
with 2 tables. I've all the data on its subscribers. However, each
subscriber also has some changes which have not been sent to the publisher
after it has gone to Suspect mode. Unfortunately, we don't have a backup of
the republishing database.
Is it possible to backup the database on one of the subscribers and restore
it on the publisher with the keep_replication switch? If yes, will it lead
to some data loss with the chages that remain pending at the subscribers and
have not been transferred to the republisher yet? If I can't restore using
one of the subscribers, do I have other options?
The two tables that have gone bad in the republishing database have the data
on the subscribers.
Regards,
Rajnish Gupta
You can do this, but there are some caveats - review
http://msdn2.microsoft.com/en-us/library/aa237097(sql.80).aspx - for SQL
2000 and for SQL 2005 follow:
http://msdn2.microsoft.com/en-us/library/ms152497.aspx
Hilary Cotter
Looking for a SQL Server replication book?
http://www.nwsu.com/0974973602.html
Looking for a FAQ on Indexing Services/SQL FTS
http://www.indexserverfaq.com
"Rajnish Gupta" <guptarajnish@.hotmail.com> wrote in message
news:OfMWOHiZHHA.4420@.TK2MSFTNGP02.phx.gbl...
> Hi,
> I've a republishing database (using merge replication) which has more than
> 1 subscriber. The database has gone into suspect mode and there is a
> problem with 2 tables. I've all the data on its subscribers. However, each
> subscriber also has some changes which have not been sent to the publisher
> after it has gone to Suspect mode. Unfortunately, we don't have a backup
> of the republishing database.
> Is it possible to backup the database on one of the subscribers and
> restore it on the publisher with the keep_replication switch? If yes, will
> it lead to some data loss with the chages that remain pending at the
> subscribers and have not been transferred to the republisher yet? If I
> can't restore using one of the subscribers, do I have other options?
> The two tables that have gone bad in the republishing database have the
> data on the subscribers.
> Regards,
> Rajnish Gupta
>
|||Dear Hilary,
Thanks for your quick response. I'll go through the link for SQL Server 2005
as this is what I'm using.
Do you recommend recovering the database only or the log file also?
Regards,
Rajnish Gupta
"Hilary Cotter" <hilary.cotter@.gmail.com> wrote in message
news:%23iEGb6iZHHA.4000@.TK2MSFTNGP02.phx.gbl...
> You can do this, but there are some caveats - review
> http://msdn2.microsoft.com/en-us/library/aa237097(sql.80).aspx - for SQL
> 2000 and for SQL 2005 follow:
> http://msdn2.microsoft.com/en-us/library/ms152497.aspx
> --
> Hilary Cotter
> Looking for a SQL Server replication book?
> http://www.nwsu.com/0974973602.html
> Looking for a FAQ on Indexing Services/SQL FTS
> http://www.indexserverfaq.com
>
> "Rajnish Gupta" <guptarajnish@.hotmail.com> wrote in message
> news:OfMWOHiZHHA.4420@.TK2MSFTNGP02.phx.gbl...
>
|||both.
Hilary Cotter
Looking for a SQL Server replication book?
http://www.nwsu.com/0974973602.html
Looking for a FAQ on Indexing Services/SQL FTS
http://www.indexserverfaq.com
"Rajnish Gupta" <guptarajnish@.hotmail.com> wrote in message
news:OPZTkNzZHHA.5080@.TK2MSFTNGP02.phx.gbl...
> Dear Hilary,
> Thanks for your quick response. I'll go through the link for SQL Server
> 2005 as this is what I'm using.
> Do you recommend recovering the database only or the log file also?
> Regards,
> Rajnish Gupta
> "Hilary Cotter" <hilary.cotter@.gmail.com> wrote in message
> news:%23iEGb6iZHHA.4000@.TK2MSFTNGP02.phx.gbl...
>
|||Dear Hilary,
I'll try the restore tomorrow. It will be a lighter day on the database.
I've gone through the SQL Server 2005 link and I understand that I just have
to restore the database (by taking any of the subscriber's backup) with the
"Keep Replication" switch. After restore the Publisher will automatically
receive updates from other subscribers. The other subscribers are configured
for pull subscriptions. The other subscribers will also receive the data
propagated to the publisher by each of them. So all of them will be
synchronised with the data each of them have been holding up while the
publisher has been down.
I hope I haven't missed anything.
Regards,
Rajnish Gupta
"Hilary Cotter" <hilary.cotter@.gmail.com> wrote in message
news:%23uUfJu9ZHHA.5080@.TK2MSFTNGP02.phx.gbl...
> both.
> --
> Hilary Cotter
> Looking for a SQL Server replication book?
> http://www.nwsu.com/0974973602.html
> Looking for a FAQ on Indexing Services/SQL FTS
> http://www.indexserverfaq.com
>
> "Rajnish Gupta" <guptarajnish@.hotmail.com> wrote in message
> news:OPZTkNzZHHA.5080@.TK2MSFTNGP02.phx.gbl...
>
|||I think you will have to recreate the jobs unless they are all pull. Make
sure you script everything out before you do the restore.
Hilary Cotter
Looking for a SQL Server replication book?
http://www.nwsu.com/0974973602.html
Looking for a FAQ on Indexing Services/SQL FTS
http://www.indexserverfaq.com
"Rajnish Gupta" <guptarajnish@.hotmail.com> wrote in message
news:%2350myBlaHHA.4520@.TK2MSFTNGP06.phx.gbl...
> Dear Hilary,
> I'll try the restore tomorrow. It will be a lighter day on the database.
> I've gone through the SQL Server 2005 link and I understand that I just
> have to restore the database (by taking any of the subscriber's backup)
> with the "Keep Replication" switch. After restore the Publisher will
> automatically receive updates from other subscribers. The other
> subscribers are configured for pull subscriptions. The other subscribers
> will also receive the data propagated to the publisher by each of them. So
> all of them will be synchronised with the data each of them have been
> holding up while the publisher has been down.
> I hope I haven't missed anything.
> Regards,
> Rajnish Gupta
> "Hilary Cotter" <hilary.cotter@.gmail.com> wrote in message
> news:%23uUfJu9ZHHA.5080@.TK2MSFTNGP02.phx.gbl...
>

Friday, February 24, 2012

Is possible restore only a MDF file from backup file?

Hi,
have a problem, I need restore only MDF file from my backup file named
data.BAK, beacause the LDF file is too big, is possible?
After restore data file, I need create a new empty log file for my db.
thx!I'm afraid not. When you do a RESTORE, SQL Server need to be able to create
the same amount of file, with the
same logical name and the same file size as you had when the backup was take
n.
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
"Luca" <luca_milan@.hotmail.com> wrote in message news:5027603c.0403241209.210d6711@.posting.
google.com...
> Hi,
> have a problem, I need restore only MDF file from my backup file named
> data.BAK, beacause the LDF file is too big, is possible?
> After restore data file, I need create a new empty log file for my db.
> thx!|||Sorry,
I posted below the response for command restore filelistonly, any
suggestion for save this DB, I have only a db_2.BAK file:
db_2_Data|D:\MSSQLDataAndLogs\db_2_Data.mdf D PRIMARY 218693632 35184372
080640
db_2_Log|D:\MSSQLDataAndLogs\db_2_Log.ldf L NULL 54643130368 35184372080
640
Thanks a lot for any Help!!!
*** Sent via Developersdex http://www.examnotes.net ***
Don't just participate in USENET...get rewarded for it!|||Did you see my earlier post?
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
"luca milan" <luca_milan@.hotmail.com> wrote in message news:uo862BeEEHA.1272@.TK2MSFTNGP11.p
hx.gbl...
> Sorry,
> I posted below the response for command restore filelistonly, any
> suggestion for save this DB, I have only a db_2.BAK file:
> db_2_Data|D:\MSSQLDataAndLogs\db_2_Data.mdf D PRIMARY 218693632 35184372
> 080640
> db_2_Log|D:\MSSQLDataAndLogs\db_2_Log.ldf L NULL 54643130368 35184372080
> 640
> Thanks a lot for any Help!!!
> *** Sent via Developersdex http://www.examnotes.net ***
> Don't just participate in USENET...get rewarded for it!|||No, sorry,
but I have find a valid MDF file and with sp_attach_single_file_db all
work fine!
Thx
*** Sent via Developersdex http://www.examnotes.net ***
Don't just participate in USENET...get rewarded for it!