SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Database Restore Failing


Database Restore Failing

Author
Message
jayoub
jayoub
SSCertifiable
SSCertifiable (5.8K reputation)SSCertifiable (5.8K reputation)SSCertifiable (5.8K reputation)SSCertifiable (5.8K reputation)SSCertifiable (5.8K reputation)SSCertifiable (5.8K reputation)SSCertifiable (5.8K reputation)SSCertifiable (5.8K reputation)

Group: General Forum Members
Points: 5751 Visits: 713

I am hoping you can help me out here.
Specifications
SQL Server 2014 SP2 CU8
Windows Server 2012
3 instances on one server (but hardly used)

Scenario
We have a daily restore that happens - taking .bak files from our production server and restoring them to another Non Production server. We use PowerShell to copy the bak files over then we have an SQL Agent job that drops all the current databases and restores the bak files one at atime. The process has been working for overone year now.

Problem:

Suddenly the restore is failing with the following error message

RESTORE FILELIST is terminatingabnormally. [SQLSTATE 42000] (Error 3013) The instance of the SQL Server Database Engine cannot obtain a LOCKresource at this time. Rerun yourstatement when there are fewer active users. Ask the database administrator tocheck the lock and memory configuration for this instance, or to check forlong-running transactions. [SQLSTATE HY000] (Error 1204)

I am also getting the following error in the SQL Server Error Log
A significant part of sql server process memory has been paged out. This may result in a performance degradation. Duration: 7216 seconds. Working set (KB): 542564, committed (KB): 2194080, memory utilization: 24%.

Actions:

We checked the memory configuration on the instance and it is set to the default.

Today we rebooted the server – it’sa VM

Thoughts

The restore happens at 2AM, so there are litteraly are no users connecting to the machine,
We are constantly dealing with SAN latency issues and I wonder if this could be the cause.

Please any help isappreciated.



Jeff
NewBornDBA2017
NewBornDBA2017
Hall of Fame
Hall of Fame (3.7K reputation)Hall of Fame (3.7K reputation)Hall of Fame (3.7K reputation)Hall of Fame (3.7K reputation)Hall of Fame (3.7K reputation)Hall of Fame (3.7K reputation)Hall of Fame (3.7K reputation)Hall of Fame (3.7K reputation)

Group: General Forum Members
Points: 3681 Visits: 913
Maybe a silly suggestion but can you set the DB offline and then run the restore or maybe change your script to kill active sessions?

ALTER DB [DBNAME] set offline with rollback immediate
GO
Restore DB..................
jayoub
jayoub
SSCertifiable
SSCertifiable (5.8K reputation)SSCertifiable (5.8K reputation)SSCertifiable (5.8K reputation)SSCertifiable (5.8K reputation)SSCertifiable (5.8K reputation)SSCertifiable (5.8K reputation)SSCertifiable (5.8K reputation)SSCertifiable (5.8K reputation)

Group: General Forum Members
Points: 5751 Visits: 713
Thanks for the reply
we are actually dropping the databases and then restoring.

The memory settings are both default Min = 0 and max = 2147483647
We have been using these setting for over one year now with no errors
I am asking the system administrators to run a full diag on the host to see if there are any hardware or driver errors

Jeff
jayoub
jayoub
SSCertifiable
SSCertifiable (5.8K reputation)SSCertifiable (5.8K reputation)SSCertifiable (5.8K reputation)SSCertifiable (5.8K reputation)SSCertifiable (5.8K reputation)SSCertifiable (5.8K reputation)SSCertifiable (5.8K reputation)SSCertifiable (5.8K reputation)

Group: General Forum Members
Points: 5751 Visits: 713
This morning I rebooted the server and re ran the job and It completed fine
I am hoping the reboot takes care of the problem.

Jeff
goher2000
goher2000
Hall of Fame
Hall of Fame (3.9K reputation)Hall of Fame (3.9K reputation)Hall of Fame (3.9K reputation)Hall of Fame (3.9K reputation)Hall of Fame (3.9K reputation)Hall of Fame (3.9K reputation)Hall of Fame (3.9K reputation)Hall of Fame (3.9K reputation)

Group: General Forum Members
Points: 3916 Visits: 1602
you can probably avoid additional resources used by power-shell by simply mapping the drive on the destination server through tsql and restore the backup, you do not even need to copy file

exec xp_cmdshell "net use x: \\sourceserver\backupdir /user:domain\user password"
go
restore database demodb from disk='x:\demodb.bak'
go
exec xp_cmdshell "net use x: /delete"
go




Jeff Moden
Jeff Moden
SSC Guru
SSC Guru (859K reputation)SSC Guru (859K reputation)SSC Guru (859K reputation)SSC Guru (859K reputation)SSC Guru (859K reputation)SSC Guru (859K reputation)SSC Guru (859K reputation)SSC Guru (859K reputation)

Group: General Forum Members
Points: 859979 Visits: 47116
goher2000 - Friday, March 9, 2018 1:31 PM
you can probably avoid additional resources used by power-shell by simply mapping the drive on the destination server through tsql and restore the backup, you do not even need to copy file

exec xp_cmdshell "net use x: \\sourceserver\backupdir /user:domain\user password"
go
restore database demodb from disk='x:\demodb.bak'
go
exec xp_cmdshell "net use x: /delete"
go


GOD NO!!!! NEVER EVER PUT A PASSWORD IN CLEAR TEXT!!!!

--Jeff Moden

RBAR is pronounced ree-bar and is a Modenism for Row-By-Agonizing-Row.
First step towards the paradigm shift of writing Set Based code:
Stop thinking about what you want to do to a row... think, instead, of what you want to do to a column.
If you think its expensive to hire a professional to do the job, wait until you hire an amateur. -- Red Adair

Helpful Links:
How to post code problems
How to post performance problems
Forum FAQs
Jeff Moden
Jeff Moden
SSC Guru
SSC Guru (859K reputation)SSC Guru (859K reputation)SSC Guru (859K reputation)SSC Guru (859K reputation)SSC Guru (859K reputation)SSC Guru (859K reputation)SSC Guru (859K reputation)SSC Guru (859K reputation)

Group: General Forum Members
Points: 859979 Visits: 47116
jayoub - Thursday, March 8, 2018 11:41 AM
This morning I rebooted the server and re ran the job and It completed fine
I am hoping the reboot takes care of the problem.

Unless your scripts are putting the databases that you're trying to drop into the "SINGLE USER" mode, you will likely run into this problem again. The reboot you did probably cleared a connection somewhere.


--Jeff Moden

RBAR is pronounced ree-bar and is a Modenism for Row-By-Agonizing-Row.
First step towards the paradigm shift of writing Set Based code:
Stop thinking about what you want to do to a row... think, instead, of what you want to do to a column.
If you think its expensive to hire a professional to do the job, wait until you hire an amateur. -- Red Adair

Helpful Links:
How to post code problems
How to post performance problems
Forum FAQs
goher2000
goher2000
Hall of Fame
Hall of Fame (3.9K reputation)Hall of Fame (3.9K reputation)Hall of Fame (3.9K reputation)Hall of Fame (3.9K reputation)Hall of Fame (3.9K reputation)Hall of Fame (3.9K reputation)Hall of Fame (3.9K reputation)Hall of Fame (3.9K reputation)

Group: General Forum Members
Points: 3916 Visits: 1602
Jeff Moden - Friday, March 9, 2018 2:13 PM
goher2000 - Friday, March 9, 2018 1:31 PM
you can probably avoid additional resources used by power-shell by simply mapping the drive on the destination server through tsql and restore the backup, you do not even need to copy file

exec xp_cmdshell "net use x: \\sourceserver\backupdir /user:domain\user password"
go
restore database demodb from disk='x:\demodb.bak'
go
exec xp_cmdshell "net use x: /delete"
go


GOD NO!!!! NEVER EVER PUT A PASSWORD IN CLEAR TEXT!!!!

well you dont have to if you give permission to service account of your destination server on backup folder..




goher2000
goher2000
Hall of Fame
Hall of Fame (3.9K reputation)Hall of Fame (3.9K reputation)Hall of Fame (3.9K reputation)Hall of Fame (3.9K reputation)Hall of Fame (3.9K reputation)Hall of Fame (3.9K reputation)Hall of Fame (3.9K reputation)Hall of Fame (3.9K reputation)

Group: General Forum Members
Points: 3916 Visits: 1602
goher2000 - Friday, March 9, 2018 2:20 PM
Jeff Moden - Friday, March 9, 2018 2:13 PM
goher2000 - Friday, March 9, 2018 1:31 PM
you can probably avoid additional resources used by power-shell by simply mapping the drive on the destination server through tsql and restore the backup, you do not even need to copy file

exec xp_cmdshell "net use x: \\sourceserver\backupdir /user:domain\user password"
go
restore database demodb from disk='x:\demodb.bak'
go
exec xp_cmdshell "net use x: /delete"
go


GOD NO!!!! NEVER EVER PUT A PASSWORD IN CLEAR TEXT!!!!

well you dont have to if you give permission to service account of your destination server on backup folder..

another way, you can create credentials and use them




goher2000
goher2000
Hall of Fame
Hall of Fame (3.9K reputation)Hall of Fame (3.9K reputation)Hall of Fame (3.9K reputation)Hall of Fame (3.9K reputation)Hall of Fame (3.9K reputation)Hall of Fame (3.9K reputation)Hall of Fame (3.9K reputation)Hall of Fame (3.9K reputation)

Group: General Forum Members
Points: 3916 Visits: 1602
goher2000 - Friday, March 9, 2018 2:24 PM
goher2000 - Friday, March 9, 2018 2:20 PM
Jeff Moden - Friday, March 9, 2018 2:13 PM
goher2000 - Friday, March 9, 2018 1:31 PM
you can probably avoid additional resources used by power-shell by simply mapping the drive on the destination server through tsql and restore the backup, you do not even need to copy file

exec xp_cmdshell "net use x: \\sourceserver\backupdir /user:domain\user password"
go
restore database demodb from disk='x:\demodb.bak'
go
exec xp_cmdshell "net use x: /delete"
go


GOD NO!!!! NEVER EVER PUT A PASSWORD IN CLEAR TEXT!!!!

well you dont have to if you give permission to service account of your destination server on backup folder..

another way, you can create credentials and use them

I never tried but you might be able to run it using

EXECUTE AS





Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum








































































































































































SQLServerCentral


Search